/* ============ VARIABLES ============ */
:root {
    --sidebar-bg: #1a1a1a;
    --sidebar-hover: #2a2a2a;
    --sidebar-active: #0d6efd;
    --sidebar-text: #b8b8b8;
    --sidebar-text-active: #ffffff;
    --sidebar-width: 260px;
    
    --bg-main: #f5f6fa;
    --bg-card: #ffffff;
    --border-color: #e5e7eb;
    --text-primary: #1f2937;
    --text-muted: #6b7280;
    
    --accent: #0d6efd;
    --accent-hover: #0b5ed7;
    --danger: #dc3545;
    --success: #198754;
    --warning: #f59e0b;
    
    --radius: 10px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
    --shadow: 0 2px 8px rgba(0,0,0,.06);
    --shadow-lg: 0 8px 24px rgba(0,0,0,.12);
    
    --transition: all .2s ease;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

/* ============ LOGIN ============ */
.login-page {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-wrapper {
    width: 100%;
    max-width: 400px;
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 48px 40px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: var(--accent);
    color: white;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 4px;
    color: var(--text-primary);
}

.login-subtitle {
    color: var(--text-muted);
    margin: 0 0 32px;
    font-size: 14px;
}

.login-form .form-control {
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.login-form .form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(13,110,253,.1);
}

.btn-login {
    padding: 12px;
    border-radius: var(--radius);
    font-weight: 600;
    margin-top: 8px;
}

/* ============ APP LAYOUT ============ */
.admin-page {
    overflow: hidden;
    height: 100vh;
}
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ============ SIDEBAR ============ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-header {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    color: white;
    font-size: 18px;
    font-weight: 700;
}

.sidebar-header i {
    color: var(--accent);
    font-size: 24px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
}

.nav-section-title {
    padding: 16px 20px 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    color: rgba(255,255,255,.35);
    text-transform: uppercase;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: var(--transition);
    border-left: 3px solid transparent;
    font-size: 14px;
    cursor: pointer;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
}

.nav-item.active {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
    border-left-color: var(--accent);
}

.nav-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.nav-badge {
    margin-left: auto;
    background: var(--accent);
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.sidebar-footer {
    padding: 16px 0;
    border-top: 1px solid rgba(255,255,255,.08);
}

/* ============ MAIN CONTENT ============ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100vh;
    scroll-behavior: smooth;
}

/* Scrollbar personalizado (estilo Magnific) */
.main-content::-webkit-scrollbar {
    width: 10px;
}
.main-content::-webkit-scrollbar-track {
    background: transparent;
}
.main-content::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
    border: 2px solid var(--bg-main);
}
.main-content::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Firefox */
.main-content {
    scrollbar-width: thin;
    scrollbar-color: #d1d5db transparent;
}
/* ============ TOP BAR ============ */
.topbar {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.topbar-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.stat-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f3f4f6;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.stat-chip i {
    font-size: 13px;
    color: var(--text-muted);
}

.stat-chip-warn {
    background: #fef3c7;
    color: #92400e;
}
.stat-chip-warn i { color: #d97706; }

.stat-chip-link {
    background: #dbeafe;
    color: #1e40af;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}
.stat-chip-link:hover { background: #bfdbfe; }
.stat-chip-link i { color: #1e40af; }

.topbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
    margin: 0 4px;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

.action-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    color: var(--text-primary);
}

.action-btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}
.action-btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: white;
}

.action-btn-danger:hover {
    background: #fef2f2;
    border-color: var(--danger);
    color: var(--danger);
}

.action-label {
    display: inline;
}

/* ============ BREADCRUMB ============ */
.breadcrumb-bar {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 32px;
}

.breadcrumb-custom {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 13px;
    flex-wrap: wrap;
}

.bc-item a {
    color: var(--text-muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}
.bc-item a:hover { color: var(--accent); }

.bc-current {
    color: var(--text-primary);
    font-weight: 600;
}

.bc-sep {
    color: var(--text-muted);
    font-size: 11px;
}

/* ============ CONTENT BODY ============ */
.content-body {
    padding: 24px 32px;
    flex: 1;
}

.content-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
    overflow: hidden;
}

.section-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    background: #fafbfc;
}

.section-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.section-title i {
    color: var(--accent);
}

.section-count {
    background: #e5e7eb;
    color: var(--text-muted);
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

/* ============ FOLDER LIST ============ */
.folder-list {
    padding: 8px;
}

.folder-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    text-decoration: none;
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    border: 1px solid transparent;
}

.folder-row:hover {
    background: #f9fafb;
    border-color: var(--border-color);
    color: var(--text-primary);
}

.folder-icon {
    width: 40px;
    height: 40px;
    background: #fef3c7;
    color: #d97706;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.folder-info {
    flex: 1;
    min-width: 0;
}

.folder-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.folder-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.folder-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.badge-lock {
    background: #fef3c7;
    color: #92400e;
}

.badge-mw {
    background: #dbeafe;
    color: #1e40af;
}

.folder-arrow {
    color: var(--text-muted);
    font-size: 14px;
}

/* ============ DROPZONE ============ */
.dropzone {
    margin: 20px;
    border: 2px dashed #d1d5db;
    border-radius: var(--radius);
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: #fafbfc;
}

.dropzone:hover, .dropzone.over {
    border-color: var(--accent);
    background: #eff6ff;
}

.dropzone.over {
    transform: scale(1.01);
}

.dz-content i {
    font-size: 40px;
    color: var(--accent);
    margin-bottom: 12px;
    display: block;
}

.dz-title {
    font-weight: 600;
    font-size: 15px;
    margin: 0 0 4px;
    color: var(--text-primary);
}

.dz-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

.progress-wrap {
    margin-top: 20px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.progress-wrap .progress {
    height: 8px;
    border-radius: 4px;
    background: #e5e7eb;
    overflow: hidden;
}

.progress-wrap .progress-bar {
    background: var(--accent);
    transition: width .3s;
}

.progress-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ============ PHOTO GRID ============ */
.photo-grid {
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.photo-item {
    position: relative;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: var(--transition);
}

.photo-item:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow);
}

.photo-item.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(13,110,253,.2);
}

.photo-thumb {
    aspect-ratio: 1;
    overflow: hidden;
    background: #f3f4f6;
}

.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s;
}

.photo-item:hover .photo-thumb img {
    transform: scale(1.05);
}

.photo-check {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 5;
    cursor: pointer;
}

.photo-check input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.check-mark {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255,255,255,.9);
    border: 2px solid #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: transparent;
    font-size: 14px;
    font-weight: bold;
}

.photo-check input:checked + .check-mark {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.photo-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 5;
    opacity: 0;
    transition: var(--transition);
}

.photo-item:hover .photo-actions {
    opacity: 1;
}

.photo-delete {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(220,53,69,.9);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 13px;
    transition: var(--transition);
}

.photo-delete:hover {
    background: var(--danger);
    color: white;
    transform: scale(1.1);
}

.photo-name {
    padding: 8px 10px;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-top: 1px solid var(--border-color);
    background: #fafbfc;
}

/* ============ BULK ACTIONS ============ */
.bulk-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-sm);
    animation: slideIn .2s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.bulk-count {
    font-size: 13px;
    font-weight: 600;
    color: #1e40af;
    margin-right: 4px;
}

.bulk-btn {
    padding: 5px 12px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.bulk-btn:hover {
    background: #f9fafb;
}

.bulk-btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}
.bulk-btn-danger:hover {
    background: #b91c1c;
    color: white;
}

/* ============ EMPTY STATE ============ */
.empty-state {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    opacity: .3;
    margin-bottom: 12px;
    display: block;
}

.empty-state p {
    margin: 4px 0;
}

/* ============ TOAST ============ */
.toast-success {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--success);
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1000;
    animation: slideInRight .3s ease;
    font-size: 14px;
    font-weight: 500;
}

.toast-success.hide {
    opacity: 0;
    transform: translateX(20px);
    transition: all .3s;
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ============ MODAL ============ */
.modal-content {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-title i {
    color: var(--accent);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 12px 20px;
}

.form-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    font-size: 14px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(13,110,253,.1);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 992px) {
    :root {
        --sidebar-width: 220px;
    }
    .action-label { display: none; }
    .topbar, .breadcrumb-bar, .content-body {
        padding-left: 20px;
        padding-right: 20px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .3s;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }
    .stat-chip { display: none; }
    .topbar-divider { display: none; }
}



/* ============ LIGHTBOX ============ */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn .2s ease;
}

.lightbox.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.lb-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,.1);
    color: white;
    border: none;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 10;
    backdrop-filter: blur(10px);
}

.lb-close:hover {
    background: rgba(255,255,255,.2);
    transform: scale(1.1);
}

.lb-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255,255,255,.1);
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 10;
    backdrop-filter: blur(10px);
}

.lb-nav:hover {
    background: rgba(255,255,255,.2);
    transform: translateY(-50%) scale(1.1);
}

.lb-prev { left: 20px; }
.lb-next { right: 20px; }

.lb-content {
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.lb-content img {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0,0,0,.5);
}

.lb-info {
    text-align: center;
    color: white;
}

.lb-name {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 4px;
}

.lb-counter {
    font-size: 13px;
    color: rgba(255,255,255,.6);
}

.lb-actions {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.lb-btn {
    padding: 10px 20px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.lb-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.lb-btn.selected {
    background: var(--success);
}

/* Hint de zoom en miniatura */
.photo-zoom-hint {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0,0,0,.6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    opacity: 0;
    transition: var(--transition);
    backdrop-filter: blur(4px);
}

.photo-thumb:hover .photo-zoom-hint {
    opacity: 1;
}

/* Cursor pointer en miniatura */
.photo-thumb {
    cursor: zoom-in;
}

/* Responsive lightbox */
@media (max-width: 768px) {
    .lb-nav {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    .lb-prev { left: 10px; }
    .lb-next { right: 10px; }
    .lb-close {
        top: 10px;
        right: 10px;
        width: 38px;
        height: 38px;
    }
}