/* =============================================
   WP DRIVE COLEGIAL - ESTILOS CON SIDEBAR
   Diseño tipo Google Drive
   ============================================= */

* {
    box-sizing: border-box;
}

body.wpdc-lightbox-open {
    overflow: hidden;
}

/* =============================================
   WRAPPER PRINCIPAL CON SIDEBAR
   ============================================= */

.wpdc-gallery-wrapper {
    display: flex;
    gap: 0;
    background: #f0f0f1;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    overflow: hidden;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* =============================================
   SIDEBAR DE NAVEGACIÓN
   ============================================= */

.wpdc-sidebar {
    width: 260px;
    min-width: 260px;
    background: #ffffff;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: 800px;
}

.wpdc-sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid #e0e0e0;
}

.wpdc-sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 500;
    color: #1d2327;
}

.wpdc-sidebar-logo svg {
    flex-shrink: 0;
}

.wpdc-sidebar-nav {
    flex: 1;
    padding: 8px 0;
}

.wpdc-nav-section {
    padding: 0 8px;
}

.wpdc-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 24px;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-bottom: 2px;
    color: #5f6368;
    font-size: 14px;
    user-select: none;
    position: relative;
}

.wpdc-nav-item:hover {
    background-color: #f1f3f4;
}

.wpdc-nav-item.active {
    background-color: #e8f0fe;
    color: #1967d2;
}

.wpdc-nav-item.active .wpdc-nav-icon {
    color: #1967d2;
}

/* Indicador de expansión para carpetas con hijos */
.wpdc-nav-item.wpdc-expanded::before {
    content: '▼';
    position: absolute;
    left: 0;
    font-size: 10px;
    color: #5f6368;
    transition: transform 0.2s;
}

.wpdc-nav-item.wpdc-collapsed::before {
    content: '▶';
    position: absolute;
    left: 0;
    font-size: 10px;
    color: #5f6368;
}

.wpdc-nav-item.wpdc-nav-root::before {
    content: none;
}

.wpdc-nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.wpdc-nav-icon svg {
    width: 20px;
    height: 20px;
}

/* Iconos con colores */
.wpdc-icon-folder-root svg {
    fill: #1967d2;
}

.wpdc-icon-folder {
    font-size: 20px;
    color: #5f6368;
}

.wpdc-nav-item.active .wpdc-icon-folder {
    color: #1967d2;
}

.wpdc-nav-item.active .wpdc-icon-folder-root svg {
    fill: #1967d2;
}

.wpdc-nav-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Subcarpetas con indentación */
.wpdc-nav-subitem {
    padding-left: 44px;
}

.wpdc-nav-subitem.wpdc-expanded::before,
.wpdc-nav-subitem.wpdc-collapsed::before {
    left: 24px;
}

.wpdc-nav-subitem-2 {
    padding-left: 60px;
}

.wpdc-nav-subitem-2.wpdc-expanded::before,
.wpdc-nav-subitem-2.wpdc-collapsed::before {
    left: 40px;
}

.wpdc-nav-subitem-3 {
    padding-left: 76px;
}

.wpdc-nav-subitem-3.wpdc-expanded::before,
.wpdc-nav-subitem-3.wpdc-collapsed::before {
    left: 56px;
}

/* =============================================
   CONTENEDOR PRINCIPAL
   ============================================= */

.wpdc-gallery-container {
    flex: 1;
    background: #f0f0f1;
    display: flex;
    flex-direction: column;
}

/* =============================================
   HEADER
   ============================================= */

.wpdc-gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #fff;
    border-bottom: 1px solid #dcdcde;
}

.wpdc-gallery-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    color: #1d2327;
}

.wpdc-gallery-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Toggle de vistas */
.wpdc-view-toggle {
    display: inline-flex;
    gap: 0;
    border: 1px solid #8c8f94;
    border-radius: 3px;
    overflow: hidden;
    background: #f0f0f1;
}

.wpdc-view-btn {
    background: #f0f0f1;
    border: none;
    border-right: 1px solid #8c8f94;
    color: #2c3338;
    padding: 4px 8px;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.wpdc-view-btn:last-child {
    border-right: none;
}

.wpdc-view-btn .dashicons {
    width: 18px;
    height: 18px;
    font-size: 18px;
}

.wpdc-view-btn:hover {
    background: #dcdcde;
}

.wpdc-view-btn.active {
    background: #2271b1;
    color: #fff;
}

.wpdc-gallery-count {
    font-size: 13px;
    color: #646970;
    background: #f0f0f1;
    padding: 6px 12px;
    border-radius: 12px;
    white-space: nowrap;
}

/* =============================================
   ÁREA DE SUBIDA
   ============================================= */

.wpdc-upload-area {
    background: #fff;
    border-bottom: 1px solid #dcdcde;
    padding: 20px;
}

.wpdc-upload-dropzone {
    border: 2px dashed #8c8f94;
    border-radius: 4px;
    padding: 40px 20px;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
    background: #fafafa;
}

.wpdc-upload-dropzone:hover {
    border-color: #2271b1;
    background: #f0f6fc;
}

.wpdc-upload-dropzone.dragover {
    border-color: #2271b1;
    background: #e0f0ff;
    border-style: solid;
    transform: scale(1.01);
}

.wpdc-upload-icon {
    font-size: 56px;
    margin-bottom: 16px;
    line-height: 1;
    opacity: 0.5;
}

.wpdc-upload-dropzone:hover .wpdc-upload-icon,
.wpdc-upload-dropzone.dragover .wpdc-upload-icon {
    opacity: 1;
    transform: translateY(-4px);
    transition: all 0.3s;
}

.wpdc-upload-text {
    font-size: 15px;
    color: #2c3338;
    margin: 0 0 20px 0;
    font-weight: 500;
}

.wpdc-upload-btn {
    font-size: 14px !important;
    padding: 10px 24px !important;
    height: auto !important;
    background: #2271b1 !important;
    border-color: #2271b1 !important;
    color: #fff !important;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.wpdc-upload-btn:hover {
    background: #135e96 !important;
    border-color: #135e96 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(34, 113, 177, 0.3);
}

.wpdc-upload-progress {
    margin-top: 20px;
}

.wpdc-upload-bar {
    width: 100%;
    height: 32px;
    background: #e0e0e0;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 12px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.wpdc-upload-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #2271b1, #135e96);
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.wpdc-upload-status {
    text-align: center;
    font-size: 13px;
    color: #646970;
    margin: 0;
    font-weight: 500;
}

/* =============================================
   CONTENIDO - VISTA GRID (CUADRÍCULA)
   ============================================= */

.wpdc-gallery-content {
    padding: 20px;
    background: #f0f0f1;
    min-height: 400px;
    flex: 1;
    overflow-y: auto;
}

.wpdc-view-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

/* =============================================
   ITEMS INDIVIDUALES
   ============================================= */

.wpdc-gallery-item {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
    display: flex;
    flex-direction: column;
}

.wpdc-gallery-item:hover {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1, 0 2px 6px rgba(0,0,0,0.05);
    transform: translateY(-2px);
}

/* Preview cuadrado */
.wpdc-item-preview {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    background: #f6f7f7;
    overflow: hidden;
    border-radius: 2px 2px 0 0;
}

.wpdc-item-preview-inner {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.wpdc-thumbnail {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 2px;
}

.wpdc-icon-large {
    font-size: 64px;
    line-height: 1;
    opacity: 0.6;
}

/* Colores tipo Google Drive para iconos */
.wpdc-item-folder .wpdc-icon-large {
    color: #5F6368;
    opacity: 1;
}

.wpdc-folder-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 3px 8px;
    font-size: 10px;
    border-radius: 3px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* Info del item */
.wpdc-item-info {
    padding: 12px;
    background: #fff;
    border-top: 1px solid #f0f0f1;
}

.wpdc-item-name {
    font-size: 14px;
    font-weight: 400;
    margin: 0 0 6px 0;
    color: #2c3338;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
}

.wpdc-item-meta {
    font-size: 12px;
    color: #646970;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.wpdc-meta-type {
    font-weight: 500;
}

/* Acciones al hover */
.wpdc-item-actions {
    position: absolute;
    bottom: 54px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.wpdc-gallery-item:hover .wpdc-item-actions {
    opacity: 1;
}

.wpdc-gallery-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 52px;
    background: rgba(0, 0, 0, 0);
    transition: background 0.2s;
    pointer-events: none;
    border-radius: 2px 2px 0 0;
}

.wpdc-gallery-item:hover::before {
    background: rgba(0, 0, 0, 0.4);
}

/* Botones */
.wpdc-btn {
    background: #fff;
    border: 1px solid #2271b1;
    color: #2271b1;
    padding: 8px 14px;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    line-height: 1;
}

.wpdc-btn:hover {
    background: #2271b1;
    color: #fff;
    border-color: #135e96;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.wpdc-btn-view {
    background: #2271b1;
    color: #fff;
}

.wpdc-btn-view:hover {
    background: #135e96;
    border-color: #0a4a78;
}

.wpdc-btn-download {
    padding: 8px 10px;
    min-width: 38px;
}

.wpdc-btn .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
    line-height: 1;
}

.wpdc-btn-download .dashicons {
    margin: 0;
}

/* Carpetas */
.wpdc-item-folder .wpdc-item-preview {
    background: linear-gradient(135deg, #f0f6fc 0%, #e3f2fd 100%);
}

.wpdc-item-folder .wpdc-icon-large {
    color: #5F6368;
    opacity: 1;
    font-size: 72px;
}

.wpdc-item-folder:hover .wpdc-icon-large {
    transform: scale(1.05);
    transition: all 0.2s;
}

/* =============================================
   VISTA DE LISTA
   ============================================= */

.wpdc-view-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.wpdc-view-list .wpdc-gallery-item {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    gap: 16px;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #dcdcde;
    border-left: none;
    border-right: none;
    border-top: none;
    border-radius: 0;
}

.wpdc-view-list .wpdc-gallery-item:first-child {
    border-top: 1px solid #dcdcde;
}

.wpdc-view-list .wpdc-item-preview {
    width: 56px;
    height: 56px;
    padding-bottom: 0;
    border-radius: 3px;
}

.wpdc-view-list .wpdc-item-info {
    padding: 0;
    border: none;
}

.wpdc-view-list .wpdc-item-name {
    margin-bottom: 4px;
}

.wpdc-view-list .wpdc-item-actions {
    position: relative;
    opacity: 1;
    transform: none;
    bottom: auto;
    left: auto;
}

.wpdc-view-list .wpdc-gallery-item::before {
    display: none;
}

.wpdc-view-list .wpdc-icon-large {
    font-size: 32px;
}

/* =============================================
   ESTADOS
   ============================================= */

.wpdc-loading {
    text-align: center;
    padding: 80px 20px;
    color: #646970;
}

.wpdc-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f0f0f1;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.wpdc-error {
    background: #fcf0f1;
    border: 1px solid #f86368;
    border-left-width: 4px;
    border-radius: 4px;
    padding: 16px 20px;
    margin: 20px;
}

.wpdc-error h4 {
    color: #d63638;
    margin: 0 0 8px;
    font-size: 15px;
}

.wpdc-error p {
    margin: 0;
    color: #50575e;
    font-size: 14px;
}

.wpdc-empty {
    text-align: center;
    padding: 80px 20px;
    color: #646970;
    font-size: 15px;
}

/* =============================================
   LIGHTBOX
   ============================================= */

.wpdc-lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 999999;
    backdrop-filter: blur(4px);
}

.wpdc-lightbox-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.wpdc-lightbox-content {
    width: 100%;
    height: 100%;
    max-width: 1400px;
    max-height: 900px;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.wpdc-lightbox-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.wpdc-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    color: #1d2327;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 10;
}

.wpdc-lightbox-close:hover {
    background: #fff;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* =============================================
   NOTIFICACIONES
   ============================================= */

.wpdc-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #fff;
    border-left: 4px solid #2271b1;
    padding: 16px 20px;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 999999;
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.3s ease;
    max-width: 400px;
    font-size: 14px;
    line-height: 1.5;
}

.wpdc-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.wpdc-notification-success {
    border-left-color: #00a32a;
    background: #edfaed;
    color: #1e4620;
}

.wpdc-notification-warning {
    border-left-color: #dba617;
    background: #fcf9e8;
    color: #614200;
}

.wpdc-notification-error {
    border-left-color: #d63638;
    background: #fcf0f1;
    color: #3c1518;
}

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 1024px) {
    .wpdc-view-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .wpdc-sidebar {
        width: 220px;
        min-width: 220px;
    }
}

@media (max-width: 782px) {
    .wpdc-gallery-wrapper {
        flex-direction: column;
    }

    .wpdc-sidebar {
        width: 100%;
        max-height: 300px;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }

    .wpdc-view-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
    }
    
    .wpdc-gallery-content {
        padding: 16px;
    }

    .wpdc-gallery-header {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 12px;
    }

    .wpdc-gallery-title {
        font-size: 18px;
    }

    .wpdc-gallery-controls {
        width: 100%;
        justify-content: space-between;
    }

    .wpdc-lightbox-container {
        padding: 20px;
    }

    .wpdc-upload-area {
        padding: 16px;
    }

    .wpdc-upload-dropzone {
        padding: 30px 15px;
    }

    .wpdc-upload-icon {
        font-size: 48px;
    }
}

@media (max-width: 600px) {
    .wpdc-view-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .wpdc-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .wpdc-view-list .wpdc-gallery-item {
        grid-template-columns: 48px 1fr;
        gap: 12px;
    }

    .wpdc-view-list .wpdc-item-preview {
        width: 48px;
        height: 48px;
    }

    .wpdc-view-list .wpdc-item-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
        margin-top: 8px;
    }

    .wpdc-notification {
        max-width: 90%;
        right: 5%;
        font-size: 13px;
    }

    .wpdc-upload-text {
        font-size: 14px;
    }

    .wpdc-upload-btn {
        font-size: 13px !important;
        padding: 8px 20px !important;
    }

    .wpdc-sidebar-logo span {
        font-size: 18px;
    }
}