/* ============================================= */
/* 1. CORE & THEME DEFINITIONS                 */
/* ============================================= */
:root {
    --header-height: 60px;
    --sidebar-width: 250px;
    --modal-bg: rgba(42, 53, 130, 0.9);
    --panel-solid-bg: #2a3582; 
    --text-primary: white;
    --text-secondary: rgba(255, 255, 255, 0.8);
    --panel-bg: rgba(255, 255, 255, 0.1);
    --panel-border-color: rgba(255, 255, 255, 0.2);
    --item-hover-bg: rgba(255, 255, 255, 0.15);
    --item-active-bg: rgba(255, 255, 255, 0.25);
    --storage-bar-bg: rgba(0, 0, 0, 0.2);
    --storage-bar-fill: white;
    --blur-effect: blur(10px);
    --panel-radius: 15px;
    --button-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --popover-bg: rgba(30, 41, 59, 0.9);
    --popover-border: rgba(255, 255, 255, 0.2);
    --danger-bg: #e74c3c;
    --danger-hover-bg: #c0392b;
    --success-bg: #2ecc71;
    --success-hover-bg: #27ae60;
}
body.light-theme, html.light-theme {
    --modal-bg: rgba(255, 255, 255, 0.95);
    --panel-solid-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --panel-bg: rgba(249, 250, 251, 0.8);
    --panel-border-color: rgba(0, 0, 0, 0.1);
    --item-hover-bg: rgba(0, 0, 0, 0.05);
    --item-active-bg: rgba(0, 0, 0, 0.1);
    --storage-bar-bg: #e2e8f0;
    --storage-bar-fill: #3f51b5;
    --popover-bg: #ffffff;
    --popover-border: #e2e8f0;
}
body.dark-theme, html.dark-theme {
    --modal-bg: rgba(30, 30, 36, 0.9);
    --panel-solid-bg: #1e1e24;
    --text-primary: #e0e0e0;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --panel-bg: rgba(255, 255, 255, 0.05);
    --panel-border-color: rgba(255, 255, 255, 0.1);
    --item-hover-bg: rgba(255, 255, 255, 0.08);
    --item-active-bg: rgba(255, 255, 255, 0.12);
    --storage-bar-bg: rgba(255, 255, 255, 0.1);
    --storage-bar-fill: #e0e0e0;
    --popover-bg: #2a2a2a;
    --popover-border: rgba(255, 255, 255, 0.15);
}


/* General Reset & Body */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

/* --- THEME BACKGROUND RULES --- */
body {
    background: linear-gradient(135deg, #1a237e 0%, #3f51b5 100%) !important;
    font-family: 'Segoe UI', sans-serif;
    color: var(--text-primary);
    transition: color 0.3s ease;
}
body.light-theme {
    background: #f0f2f5 !important;
}
body.dark-theme {
    background: #121212 !important;
}


/* ============================================= */
/* 2. MAIN LAYOUT (STABLE POSITIONING VERSION) */
/* ============================================= */
.header {
    height: var(--header-height);
    width: 100%;
    padding: 0 25px;
    background: var(--panel-solid-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1100;
}
.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}
.header-brand h1 {
    margin: 0;
    font-size: 24px;
    font-weight: bold;
    color: var(--text-primary);
}
i.menu-toggle {
    font-size: 24px;
    color: var(--text-primary);
    cursor: pointer;
    display: none;
}
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar {
    background: var(--panel-solid-bg);
    transition: transform 0.3s ease;
    width: var(--sidebar-width);
    height: 100vh;
    padding: 20px 15px;
    padding-top: calc(var(--header-height) + 20px);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1099;
    border-right: 1px solid var(--panel-border-color);
}

/* === CẬP NHẬT GIAO DIỆN "GMAIL" === */
.main-content-wrapper {
    margin-left: var(--sidebar-width);
    /* Thêm padding cho nội dung (vì panel con đã bị xóa) */
    padding: 20px;
    padding-top: calc(var(--header-height) + 20px);
    height: 100vh;
    overflow-y: auto;
    width: calc(100% - var(--sidebar-width));

    /* Style bo tròn và nền */
    background-color: var(--panel-solid-bg);
    border-top-left-radius: 24px; 
}

#content-placeholder {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

@media (min-width: 993px) {
    .header-brand {
        display: block;
    }
}
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 1200;
        border-right: none;
        box-shadow: 5px 0 15px rgba(0,0,0,0.2);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content-wrapper {
        margin-left: 0;
        width: 100%;
        border-top-left-radius: 0; /* Bỏ bo tròn trên mobile */
    }
    i.menu-toggle {
        display: block;
    }
    .header-brand {
        display: none;
    }
    .page-overlay.show {
        display: block;
    }
    .user-menu-btn .user-name {
        display: none;
    }
}


/* ============================================= */
/* 3. POPOVER & SHARED COMPONENT STYLES        */
/* ============================================= */
.sidebar-menu { list-style: none; margin-bottom: 20px; padding: 0; }
.sidebar-menu li a, .admin-link-container a { display: flex; align-items: center; gap: 15px; padding: 12px 15px; border-radius: 8px; color: var(--text-primary); text-decoration: none; font-weight: 500; transition: all 0.2s; margin-bottom: 5px; }
.sidebar-menu li a .fa-solid, .admin-link-container a .fa-solid { width: 20px; text-align: center; }
.sidebar-menu li a:hover, .admin-link-container a:hover { background-color: var(--item-hover-bg); }
.sidebar-menu li a.active, .admin-link-container a.active { background-color: var(--item-active-bg); }
.sidebar-footer { margin-top: auto; }
.admin-link-container { padding-bottom: 15px; margin-bottom: 15px; border-bottom: 1px solid var(--panel-border-color); }
.storage-status { padding-top: 20px; }
.storage-info { font-size: 14px; color: var(--text-secondary); margin-bottom: 8px; }
.storage-bar-container { width: 100%; background-color: var(--storage-bar-bg); border-radius: 5px; overflow: hidden; height: 8px; }
.storage-bar { height: 100%; background-color: var(--storage-bar-fill); transition: width 0.5s ease; border-radius: 5px; }

.page-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); z-index: 1199; }
.header-btn { background: transparent; border: none; color: var(--text-primary); width: 40px; height: 40px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 18px; transition: background-color 0.2s ease; }
.header-btn:hover { background-color: var(--item-hover-bg); }
.user-menu-btn { background: transparent; border: none; color: var(--text-primary); padding: 5px 10px 5px 5px; border-radius: 20px; cursor: pointer; display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 500; }
.user-menu-btn:hover { background-color: var(--item-hover-bg); }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background-color: var(--item-active-bg); }
.popover { display: none; position: fixed; top: 65px; background: var(--popover-bg); backdrop-filter: var(--blur-effect); border: 1px solid var(--popover-border); border-radius: 10px; width: 280px; box-shadow: 0 10px 25px rgba(0,0,0,0.2); z-index: 1300; }
.popover::before { content: ''; position: absolute; bottom: 100%; border: 8px solid transparent; border-bottom-color: var(--popover-border); }
.popover::after { content: ''; position: absolute; bottom: 100%; margin-bottom: -1.5px; border: 7px solid transparent; border-bottom-color: var(--popover-bg); }
#user-popover { right: 20px; width: 220px; }
#user-popover::before, #user-popover::after { right: 30px; }
#apps-popover { right: 70px; }
#apps-popover::before, #apps-popover::after { right: 20px; }
.popover-header { padding: 15px; border-bottom: 1px solid var(--panel-border-color); }
.popover-body { padding: 0; }
.popover-menu { list-style: none; padding: 10px; margin:0;}
.popover-menu a { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 6px; color: var(--text-primary); text-decoration: none; font-size: 15px; }
.popover-menu a:hover { background-color: var(--item-hover-bg); }
.popover-footer { padding: 10px; border-top: 1px solid var(--panel-border-color); }
.theme-switcher { display: flex; justify-content: space-around; }
.theme-switcher button { flex: 1; background: none; border: 1px solid transparent; color: var(--text-secondary); padding: 8px; border-radius: 6px; cursor: pointer; font-size: 20px; }
.theme-switcher button:hover { background: var(--item-hover-bg); color: var(--text-primary); }
.theme-switcher button.active { background: var(--item-active-bg); color: var(--text-primary); border-color: var(--panel-border-color); }
.apps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 15px; max-height: 320px; overflow-y: auto; }
.app-shortcut { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 10px; border-radius: 8px; text-decoration: none; color: var(--text-primary); transition: background-color 0.2s ease; }
.app-shortcut:hover { background-color: var(--item-hover-bg); }
.app-shortcut img, .app-shortcut .fa-solid, .app-shortcut .fa-brands { width: 32px; height: 32px; font-size: 28px; margin-bottom: 8px; object-fit: contain; text-align: center; }
.app-shortcut span { font-size: 12px; text-align: center; }
.app-drawer-icon { width: 20px; height: 20px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.app-drawer-icon span { background-color: var(--text-primary); border-radius: 50%; }


/* ============================================= */
/* 4. MODAL & PAGE-SPECIFIC STYLES               */
/* ============================================= */
.modal {
    display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%;
    overflow: auto; background-color: rgba(0,0,0,0.5); backdrop-filter: blur(5px);
    justify-content: center; align-items: center;
}
.modal-content {
    background: var(--modal-bg); backdrop-filter: var(--blur-effect); border: 1px solid var(--panel-border-color);
    margin: auto; padding: 0; border-radius: var(--panel-radius); width: 90%; max-width: 500px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2); color: var(--text-primary); position: relative; overflow: hidden;
}
.modal-header { padding: 20px 25px; border-bottom: 1px solid var(--panel-border-color); position: relative; }
.modal-header .modal-title, .modal-content h3 { margin: 0; font-size: 20px; color: var(--text-primary); padding-right: 30px; }
.close-button, .close-btn {
    color: var(--text-secondary); position: absolute; top: 50%; transform: translateY(-50%); right: 25px;
    font-size: 28px; font-weight: bold; cursor: pointer; transition: color 0.2s; line-height: 1;
}
.close-button:hover, .close-btn:hover { color: var(--text-primary); }
.modal-body { padding: 25px; }
.modal-body label, .modal-content label { display: block; margin-bottom: 8px; color: var(--text-secondary); }
.modal-body input[type="text"], .modal-content input[type="text"] {
    width: 100%; padding: 10px 12px; margin-bottom: 15px; border: 1px solid var(--panel-border-color);
    border-radius: 8px; background-color: var(--item-hover-bg); color: var(--text-primary); font-size: 16px;
}
.modal-actions, .modal-buttons {
    display: flex; justify-content: flex-end; gap: 10px; padding: 20px 25px;
    background-color: rgba(0,0,0,0.1); border-top: 1px solid var(--panel-border-color);
}
.modal-actions .btn-modal, .modal-buttons button {
    padding: 10px 20px; border: 1px solid var(--panel-border-color); border-radius: 8px;
    cursor: pointer; font-size: 15px; font-weight: 600; background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary); transition: all 0.2s ease;
}
.modal-actions .btn-modal:hover, .modal-buttons button:hover { 
    background: rgba(255, 255, 255, 0.2); 
    border-color: rgba(255, 255, 255, 0.3);
}
.modal-buttons button.cancel-btn {
    background: transparent;
}
.modal-buttons .confirm-btn {
     background: rgba(255, 255, 255, 0.1);
}
#confirmDeleteBtn {
    color: var(--danger-bg);
    background: rgba(255, 255, 255, 0.1);
}
#confirmDeleteBtn:hover {
    background: var(--danger-bg);
    color: white;
}

.fab-popover {
    position: fixed;
    width: 220px;
    display: none;
    z-index: 1250;
    right: 25px;            /* Căn sang phải 25px */
    bottom: 90px;           /* Căn lên trên nút FAB 90px */
    height: auto;           /* Buộc chiều cao tự động theo nội dung */
    min-height: unset;      /* Hủy mọi min-height có thể bị kế thừa */
}
.fab-popover .popover-body.popover-menu {
    padding: 8px;
    height: auto !important;
    min-height: unset !important;
}
.fab-popover::before {
    content: '';
    position: absolute;
    top: 100%;
    right: 20px;
    border-width: 8px;
    border-style: solid;
    border-color: var(--popover-border) transparent transparent transparent;
}
.fab-popover::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 21px;
    margin-top: -1.5px;
    border-width: 7px;
    border-style: solid;
    border-color: var(--popover-bg) transparent transparent transparent;
}

#breadcrumb a {
    color: var(--text-primary); text-decoration: none; opacity: 0.8;
}
#breadcrumb a:hover {
    opacity: 1; text-decoration: underline;
}
#breadcrumb a:first-child {
    opacity: 1;
}
#breadcrumb span {
    color: var(--text-secondary); margin: 0 5px;
}
.content-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    width: 100%;
}
.file-input { display: none; }
.upload-progress { display: none; background: var(--panel-bg); backdrop-filter: var(--blur-effect); border-radius: 10px; padding: 15px; margin-bottom: 20px; border: 1px solid var(--panel-border-color); flex-shrink: 0;}
.progress-bar { width: 100%; height: 8px; background: var(--storage-bar-bg); border-radius: 4px; overflow: hidden; margin-bottom: 8px; }
.progress-fill { height: 100%; background: var(--item-active-bg); width: 0%; transition: width 0.1s ease; }
.progress-text { font-size: 14px; color: var(--text-primary); text-align: center; font-weight: 500; }

/* === KHỐI .files-section ĐÃ ĐƯỢC XÓA (vì không còn dùng) === */

/* === SỬA LỖI DRAG-OVER (target ID thay vì class) === */
#filesSection.dragover { 
    border-color: var(--text-primary); 
    background: var(--item-active-bg); 
    box-shadow: 0 0 25px rgba(255,255,255,0.1); 
    border-radius: 24px; /* Thêm bo tròn cho khớp layout */
}

.section-header { color: var(--text-primary); font-size: 20px; margin-bottom: 20px; display: flex; justify-content: flex-start; align-items: center; gap: 10px; }
.view-controls { background: var(--storage-bar-bg); border-radius: 8px; padding: 4px; display: inline-flex; margin-left: auto; }
.view-btn { background: transparent; border: none; color: var(--text-secondary); width: 36px; height: 36px; border-radius: 6px; cursor: pointer; font-size: 16px; transition: all 0.3s ease; }
.view-btn.active { background: var(--item-active-bg); color: var(--text-primary); }
#filesContainer { flex-grow: 1; overflow-y: auto; }
#filesContainer.grid-view { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; align-content: start; }
.grid-view .file-item { background: var(--item-hover-bg); border: 1px solid var(--panel-border-color); border-radius: var(--panel-radius); padding: 20px; display: flex; flex-direction: column; text-align: center; color: var(--text-primary); transition: all 0.3s ease; position: relative; }
.grid-view .file-item:hover { transform: translateY(-5px); background: var(--item-active-bg); box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1); }
.grid-view .file-icon { font-size: 36px; margin-bottom: 15px; flex-grow: 0; display: flex; align-items: center; justify-content: center; min-height: 80px; }
.grid-view .file-name { font-weight: 600; color: var(--text-primary); margin-bottom: 5px; word-break: break-all; min-height: 40px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; }
.grid-view .file-size { color: var(--text-secondary); font-size: 12px; margin-bottom: 15px; }
.grid-view .file-actions { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--panel-border-color); display: flex; gap: 10px; justify-content: center; align-items: center; }
#filesContainer.list-view { display: flex; flex-direction: column; gap: 8px; }
.list-view .file-item { display: flex; align-items: center; background: var(--item-hover-bg); border: 1px solid var(--panel-border-color); padding: 12px 15px; border-radius: 10px; color: var(--text-primary); position: relative;}
.list-view .file-item:hover { background: var(--item-active-bg); }
.list-view .file-main-info { display: flex; align-items: center; flex: 1; min-width: 0; }
.list-view .file-icon { font-size: 24px; color: var(--text-primary); width: 40px; text-align: center; margin-right: 15px; flex-shrink: 0; }
.list-view .file-name { font-weight: 500; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-view .file-date { font-size: 14px; color: var(--text-secondary); width: 160px; flex-shrink: 0; text-align: center; }
.list-view .file-size { font-size: 14px; color: var(--text-secondary); width: 110px; flex-shrink: 0; text-align: right; }
.list-view .file-actions { display: flex; gap: 5px; margin-left: 20px; flex-shrink: 0; }
.file-item > .grid-view-content, .file-item > .list-view-content { display: none; }
#filesContainer.grid-view .file-item > .grid-view-content { display: flex; flex-direction: column; flex-grow: 1; }
#filesContainer.list-view .file-item > .list-view-content { display: flex; align-items: center; width: 100%; }
.btn-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 15px; padding: 0; color: var(--text-primary); background: transparent; border: none; cursor: pointer; transition: background-color 0.2s; }
.btn-icon:hover { background: var(--item-active-bg); }
.list-view .btn-more-options { display: none; }
.file-dropdown-menu { display: none; position: absolute; top: calc(100% + 5px); right: 0; background: var(--popover-bg); backdrop-filter: var(--blur-effect); border: 1px solid var(--popover-border); border-radius: 8px; box-shadow: 0 5px 15px rgba(0,0,0,0.2); z-index: 999; padding: 5px; min-width: 180px; }
.file-dropdown-menu.show { display: block; }
.file-dropdown-menu button, .file-dropdown-menu .dropdown-info { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: none; color: var(--text-primary); padding: 8px 12px; text-align: left; border-radius: 4px; cursor: pointer; font-size: 14px; }
.file-dropdown-menu button:hover { background: var(--item-hover-bg); }
.file-dropdown-menu .dropdown-info { cursor: default; opacity: 0.7; }
.file-dropdown-menu i { width: 18px; text-align: center; color: var(--text-secondary); }
.grid-view .file-item .file-dropdown-menu { min-width: auto; }
.grid-view .file-item .file-dropdown-menu .dropdown-info:first-of-type, .grid-view .file-item .file-dropdown-menu hr, .grid-view .file-item .file-dropdown-menu button { display: none; }
.grid-view .file-item .file-dropdown-menu .dropdown-info { display: flex; }
.fab-upload { display: flex; align-items: center; justify-content: center; position: fixed; bottom: 25px; right: 25px; height: 56px; background: var(--item-active-bg); border: 1px solid var(--panel-border-color); backdrop-filter: var(--blur-effect); color: var(--text-primary); border-radius: 28px; width: auto; padding: 0 20px; font-size: 16px; box-shadow: 0 4px 12px rgba(0,0,0,0.3); cursor: pointer; z-index: 1050; transition: all 0.2s ease; flex-shrink: 0; gap: 10px; }
.fab-upload:hover { background: var(--item-hover-bg); transform: scale(1.05); }
.fab-upload span { display: inline; font-weight: 600; }
@media (max-width: 768px) { .fab-upload { border-radius: 50%; width: 56px; padding: 0; } .fab-upload span { display: none; } .list-view .file-date, .list-view .file-size, .list-view .file-actions { display: none; } .list-view .btn-more-options { display: flex; margin-left: auto; } }
.album-container {
    display: flex;
    flex-direction: row;
    gap: 20px;
    height: 100%;
}
.album-management-panel { width: 300px; flex-shrink: 0; }
.album-display-panel { overflow-y: auto; flex-grow: 1; min-width: 0; }
#uploadSection { margin-bottom: 20px; }
#album-content-wrapper { flex-grow: 1; }

.album-management-panel h3 { 
    font-size: 20px; 
    margin-bottom: 20px; 
    border-bottom: 1px solid var(--panel-border-color); 
    padding-bottom: 15px; 
    text-align: center; 
}
.form-group { margin-bottom: 15px; }
.album-item { background: var(--item-hover-bg); padding: 12px 15px; margin-bottom: 8px; border-radius: 8px; cursor: pointer; border-left: 4px solid transparent; display: flex; justify-content: space-between; align-items: center; transition: all 0.2s ease; }
.album-item:hover { background: var(--item-active-bg); transform: translateX(3px); }
.album-item.active { background: var(--item-active-bg); border-left-color: #667eea; transform: translateX(0); }
.album-info { display: flex; align-items: center; justify-content: space-between; flex-grow: 1; min-width: 0; }
.album-name { font-weight: 500; word-break: break-all; font-size: 15px; flex-grow: 1; margin-right: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.album-count { background: var(--storage-bar-bg); padding: 3px 7px; border-radius: 10px; font-size: 11px; flex-shrink: 0; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 15px; margin-top: 20px;}
.photo-item { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; cursor: pointer; background-color: var(--storage-bar-bg);}
.photo-item img { width: 100%; height: 100%; object-fit: cover; }
.photo-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 10px; background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.6) 100%); color: #fff; font-size: 13px; }
.album-header-actions { display: flex; gap: 10px; margin-left: auto; }
.album-header-actions .icon-btn { background: var(--item-hover-bg); border: none; border-radius: 50%; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; font-size: 1em; color: var(--text-primary); cursor: pointer; transition: all 0.2s ease; }
.album-header-actions .icon-btn:hover { background: var(--item-active-bg); transform: translateY(-2px); }
.album-placeholder { text-align: center; color: var(--text-secondary); margin: auto; padding: 50px; }
.fullscreen-viewer { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.95); z-index: 3000; backdrop-filter: var(--blur-effect); flex-direction: column; }
.viewer-footer { width: 100%; padding: 15px 25px; background: rgba(0,0,0,0.3); backdrop-filter: var(--blur-effect); border-top: 1px solid var(--panel-border-color); display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; gap: 20px; order: 3; }
.viewer-note { flex-grow: 1; text-align: left; color: #fff; }
.viewer-note .note-display { display: flex; align-items: center; gap: 15px; }
.viewer-note .note-text { font-style: italic; color: #eee; }
.viewer-note .note-edit-form { display: none; gap: 10px; align-items: center; }
.viewer-note .note-edit-form input { background: rgba(255,255,255,0.9); color: #333; flex-grow: 1; }
.viewer-image-container { flex-grow: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 20px; position:relative; order: 2; }
.viewer-image { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 10px; }
.viewer-controls { position: absolute; top: 20px; right: 20px; display: flex; gap: 10px; z-index: 5; }
.viewer-nav { position: absolute; top: 50%; left: 20px; right: 20px; display: flex; justify-content: space-between; transform: translateY(-50%); }
.viewer-btn { background: var(--item-active-bg); border: none; color: white; width: 50px; height: 50px; border-radius: 50%; cursor: pointer; font-size: 24px; display:flex; align-items:center; justify-content:center;}
.copy-success-msg { color: var(--success-bg); font-weight: 600; font-size: 14px; margin-left: 15px; opacity: 0; transition: opacity 0.5s ease; }
.copy-success-msg.show { opacity: 1; }
.album-actions-header { display: flex; margin-bottom: 20px; flex-shrink: 0; }
.album-backdrop { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1099; }
#closeManagerBtn { display: none; }
.create-album-btn { display: flex; align-items: center; justify-content: center; position: fixed; bottom: 25px; right: 25px; height: 56px; background: var(--item-active-bg); border: 1px solid var(--panel-border-color); backdrop-filter: var(--blur-effect); color: var(--text-primary); border-radius: 50%; width: 56px; font-size: 24px; box-shadow: 0 4px 12px rgba(0,0,0,0.3); cursor: pointer; z-index: 1050; transition: all 0.3s ease; }
.create-album-btn:hover { background: var(--item-hover-bg); transform: translateY(-2px); }
.create-album-btn .fab-text { display: none; font-size: 15px; font-weight: 600; }
@media (max-width: 992px) {
    .album-container { flex-direction: column; }
    .album-management-panel, .album-display-panel { width: 100%; }
    .photo-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
    .album-actions-header { display: flex; }
    #toggleAlbumManagerBtn { background: var(--panel-bg); border: 1px solid var(--panel-border-color); color: var(--text-primary); padding: 10px 15px; border-radius: 10px; font-size: 15px; cursor: pointer; }
    
    .album-management-panel { 
        position: fixed; 
        top: 0; 
        left: 0; 
        height: 100%; 
        z-index: 1200; /* SỬA: Tăng z-index để trượt đè lên header */
        transform: translateX(-100%); 
        transition: transform 0.3s ease-in-out; 
        border-radius: 0 var(--panel-radius) var(--panel-radius) 0; 
        box-shadow: 5px 0 15px rgba(0,0,0,0.2); 
        background: var(--panel-solid-bg); /* Fix lỗi trong suốt */
        width: 300px; /* Đặt chiều rộng cố định */
        max-width: 90vw; /* Giới hạn chiều rộng trên điện thoại nhỏ */
        padding: 20px 15px; /* Thêm đệm cho nội dung */
        padding-top: calc(var(--header-height) + 20px); /* Đẩy nội dung xuống dưới header */ 
    }
    .album-management-panel.show { transform: translateX(0); }
    .album-backdrop.show { display: block; }

    #closeManagerBtn { 
        display: block; 
        position: absolute; 
        top: 15px; 
        right: 15px; 
        background: var(--storage-bar-bg);
        border: none;
        color: var(--text-primary); 
        font-size: 20px; 
        cursor: pointer;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        line-height: 36px;
        text-align: center;
        transition: all 0.2s ease;
    }
    #closeManagerBtn:hover {
        background: var(--item-active-bg);
    }
}
@media (min-width: 993px) {
    #toggleAlbumManagerBtn { display: none; }
    .album-actions-header { display: none; }
    .create-album-btn { width: auto; border-radius: 28px; padding: 0 20px; }
    .create-album-btn .fab-text { display: inline-block; }
    .create-album-btn .fa-plus { font-size: 16px; }
}
.trash-container { display: flex; flex-direction: column; }
#trashFilesContainer { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex-grow: 1; }
.trash-item { display: flex; align-items: center; background: var(--item-hover-bg); padding: 12px 20px; border-radius: 10px; justify-content: space-between; transition: background-color 0.2s ease; }
.trash-item:hover { background: var(--item-active-bg); }
.trash-info { display: flex; align-items: center; gap: 15px; min-width: 0; flex-grow: 1; }
.trash-icon { font-size: 24px; }
.trash-details { min-width: 0; }
.trash-name { font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trash-size { color: var(--text-secondary); font-size: 13px; }
.trash-right-panel { display: flex; align-items: center; gap: 20px; flex-shrink: 0; }
.trash-date { font-size: 14px; color: var(--text-secondary); width: 150px; text-align: center; }
.trash-actions { display: flex; gap: 10px; }
.trash-actions .btn-icon { background: var(--storage-bar-bg); width: 36px; height: 36px; font-size: 15px;}
.trash-actions .btn-icon:hover { transform: scale(1.1); background: var(--item-active-bg); }
.trash-actions .btn-icon.restore-btn:hover { color: var(--success-bg); }
.trash-actions .btn-icon.delete-perm-btn:hover { color: var(--danger-bg); }
.settings-wrapper {
    display: flex;
    flex-direction: row;
    gap: 20px;
    height: 100%;
}
.settings-nav { width: 220px; flex-shrink: 0; }
.settings-content { flex-grow: 1; overflow-y: auto; }
.settings-menu { list-style: none; padding: 0; margin: 0; }
.settings-menu a { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 8px; text-decoration: none; color: var(--text-primary); font-weight: 500; }
.settings-menu a:hover { background: var(--item-hover-bg); }
.settings-menu a.active { background: var(--item-active-bg); }
.settings-menu a .fa-solid { width: 20px; text-align: center; color: var(--text-secondary); }
.setting-section { margin-bottom: 40px; }
.setting-section h2 { font-size: 24px; padding-bottom: 15px; border-bottom: 1px solid var(--panel-border-color); margin-bottom: 25px; }
.form-row { display: flex; align-items: center; gap: 15px; margin-bottom: 20px; }
.form-row label { flex-basis: 200px; font-weight: 600; }
.form-row .control { flex-grow: 1; }
.theme-options { display: flex; gap: 15px; }
.theme-option { border: 2px solid var(--panel-border-color); padding: 10px; border-radius: 8px; cursor: pointer; text-align: center; width: 120px; }
.theme-option.active { border-color: #667eea; background: var(--item-active-bg); }
.theme-option .icon { font-size: 24px; margin-bottom: 8px; }

/* === CẬP NHẬT CSS CHO ADMIN PANEL (SỬA LỖI THEME) === */
/* CSS cũ cho .admin-panel đã được xóa bỏ vì không còn dùng */

#user-table-container { 
    overflow-y: auto; 
    flex-grow: 1; 
    /* Sửa lỗi theme */
    background: var(--panel-bg); 
    backdrop-filter: var(--blur-effect);
    border: 1px solid var(--panel-border-color);
    color: var(--text-primary);
    /* Giữ nguyên style cũ của bạn */
    border-radius: var(--panel-radius); /* Dùng biến bo tròn chung */
    padding: 10px; 
}
table { width: 100%; border-collapse: collapse; }
th, td { 
    padding: 15px; 
    text-align: left; 
    border-bottom: 1px solid var(--panel-border-color); /* Sửa lỗi theme */
    vertical-align: middle; 
}
th { 
    background-color: var(--item-hover-bg); /* Sửa lỗi theme */
    font-weight: 600; 
    position: sticky; 
    top: 0; 
    z-index: 1; 
}
tr:last-child td { border-bottom: none; }
tr:hover { background-color: var(--item-hover-bg); } /* Sửa lỗi theme */

/* Giữ nguyên các style cho nút, nhưng cập nhật màu cho input/select */
.actions-cell select, .actions-cell button, .quota-input { 
    padding: 6px 10px; 
    border-radius: 5px; 
    border: 1px solid var(--panel-border-color); /* Sửa lỗi theme */
    background: var(--item-hover-bg); /* Sửa lỗi theme */
    color: var(--text-primary); /* Sửa lỗi theme */
    margin-right: 5px; 
    cursor: pointer; 
    font-family: 'Segoe UI', sans-serif; 
    font-size: 14px; 
}

/* Các nút xóa/lưu giữ nguyên */
.btn-delete { background-color: var(--danger-bg); color: white; border-color: var(--danger-bg); }
.btn-delete:hover { background-color: var(--danger-hover-bg); }
.btn-save { background-color: var(--success-bg); color: white; border-color: var(--success-bg); }
.btn-save:hover { background-color: var(--success-hover-bg); }

#loading { 
    text-align: center; 
    padding: 40px; 
    font-size: 18px; 
    color: var(--text-secondary); /* Sửa lỗi theme */
}

/* Thanh usage-bar giữ nguyên */
.usage-bar-container { width: 100%; background-color: #e9ecef; border-radius: 5px; overflow: hidden; height: 10px; }
.usage-bar { height: 100%; background: var(--button-gradient); transition: width 0.5s ease; }

.login-wrapper { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.login-logo { font-size: 80px; color: var(--text-primary); opacity: 0.9; text-shadow: 0 5px 15px rgba(0,0,0,0.2); }
.form-box { background: var(--panel-bg); backdrop-filter: var(--blur-effect); border: 1px solid var(--panel-border-color); padding: 40px; border-radius: var(--panel-radius); box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); width: 100%; max-width: 420px; color: var(--text-primary); }
.form-box h2 { font-size: 28px; text-align: center; margin-bottom: 10px; }
.form-box p { text-align: center; margin-bottom: 30px; color: var(--text-secondary); }
.btn-primary { display: block; text-align: center; width: 100%; padding: 14px; background: var(--button-gradient); color: white; border: none; border-radius: 10px; font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.3s ease; text-decoration: none; }
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 10px 20px -10px rgba(118, 75, 162, 0.5); }