/* ===================================================
   ADMIN PANEL — Global Styles
   Admin panel always uses its own light palette,
   independent of the public site dark/light theme.
   =================================================== */

/* ─── ADMIN PALETTE (fixed, never overridden by theme) ─── */
.admin-shell {
    --a-bg: #FAFAF7;
    --a-surface: #FFFFFF;
    --a-sidebar: #1A1A1A;
    --a-text: #1A1A1A;
    --a-text-secondary: #666666;
    --a-text-muted: #999999;
    --a-text-on-dark: #E8E4DC;
    --a-border: #E4DDD4;
    --a-accent: #BFA07A;
    --a-accent-hover: #9E8060;
    --a-font-serif: 'Cormorant Garamond', Georgia, serif;
    --a-font-sans: 'Jost', 'Helvetica Neue', sans-serif;

    display: flex;
    min-height: 100vh;
    background: var(--a-bg) !important;
    color: var(--a-text) !important;
}

/* ─── SIDEBAR ─── */
.admin-shell .admin-sidebar {
    width: 240px;
    height: 100vh;
    background: var(--a-sidebar);
    color: var(--a-text-on-dark);
    display: flex;
    flex-direction: column;
    transition: width 0.25s ease;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    overflow: hidden;
}
.admin-shell.sidebar-collapsed .admin-sidebar {
    width: 60px;
}

.admin-shell .sidebar-header {
    padding: 1.2rem 1rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    white-space: nowrap;
    flex-shrink: 0;
}
.admin-shell .sidebar-brand {
    font-family: var(--a-font-serif);
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 3px;
    color: var(--a-accent);
    white-space: nowrap;
    flex: 1;
}
.admin-shell .sidebar-brand-icon {
    font-family: var(--a-font-serif);
    font-size: 1.4rem;
    font-weight: 400;
    color: var(--a-accent);
    flex: 1;
    text-align: center;
}
.admin-shell .collapse-btn {
    background: none;
    border: none;
    color: rgba(240, 236, 230, 0.55);
    cursor: pointer;
    padding: 0.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.2s;
    border-radius: 2px;
}
.admin-shell .collapse-btn:hover {
    color: var(--a-accent);
}
.admin-shell .collapse-btn svg {
    width: 18px;
    height: 18px;
}
.admin-shell.sidebar-collapsed .sidebar-header {
    justify-content: center;
}
.admin-shell.sidebar-collapsed .collapse-btn {
    margin: 0 auto;
}

/* Navigation */
.admin-shell .sidebar-nav {
    flex: 1;
    min-height: 0;
    padding: 0.6rem 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.12) transparent;
}
.admin-shell .sidebar-nav::-webkit-scrollbar {
    width: 4px;
}
.admin-shell .sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}
.admin-shell .sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
}
.admin-shell .sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(191,160,122,0.4);
}
.admin-shell .nav-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.5rem 1.2rem;
    color: rgba(240, 236, 230, 0.85);
    font-family: var(--a-font-sans);
    font-size: 0.83rem;
    font-weight: 400;
    letter-spacing: 0.5px;
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    white-space: nowrap;
    overflow: hidden;
}
.admin-shell .nav-item:hover {
    color: #FFFFFF;
    background: rgba(255,255,255,0.08);
    border-left-color: var(--a-accent);
}
.admin-shell .nav-item.active {
    color: var(--a-accent);
    background: rgba(191,160,122,0.14);
    border-left-color: var(--a-accent);
    font-weight: 500;
}
.admin-shell .nav-icon {
    font-size: 1.05rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}
.admin-shell .nav-label {
    overflow: hidden;
}
.admin-shell.sidebar-collapsed .nav-item {
    justify-content: center;
    padding: 0.5rem 0;
    border-left: none;
}
.admin-shell.sidebar-collapsed .nav-label {
    display: none;
}
.admin-shell.sidebar-collapsed .nav-icon {
    font-size: 1.2rem;
}
.admin-shell .nav-sub-item {
    font-size: 0.76rem;
    padding-left: 2.4rem;
    color: rgba(240, 236, 230, 0.6);
    border-left-color: transparent;
}
.admin-shell .nav-sub-item:hover {
    color: rgba(240, 236, 230, 0.9);
}
.admin-shell .nav-sub-item.active {
    color: var(--a-accent);
    background: rgba(191,160,122,0.08);
}
.admin-shell.sidebar-collapsed .nav-sub-item {
    padding-left: 0;
}

/* Sidebar footer — kept for backwards compat, now empty */
.admin-shell .sidebar-footer {
    display: none;
}

/* ─── MAIN AREA ─── */
.admin-shell .admin-main {
    flex: 1;
    margin-left: 240px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.25s ease;
}
.admin-shell.sidebar-collapsed .admin-main {
    margin-left: 60px;
}

/* Topbar */
.admin-shell .admin-topbar {
    display: flex;
    align-items: center;
    height: 56px;
    padding: 0 2rem;
    background: var(--a-surface);
    border-bottom: 1px solid var(--a-border);
    position: sticky;
    top: 0;
    z-index: 50;
}
.admin-shell .topbar-spacer { flex: 1; }
.admin-shell .topbar-right {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}
.admin-shell .admin-username {
    font-family: var(--a-font-sans);
    font-size: 0.82rem;
    font-weight: 400;
    letter-spacing: 0.5px;
    color: var(--a-text-secondary);
}
.admin-shell .btn-logout {
    font-family: var(--a-font-sans);
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 2px;
    text-transform: uppercase;
    background: none;
    border: 1px solid var(--a-border);
    color: var(--a-text-secondary);
    padding: 0.4rem 1rem;
    cursor: pointer;
    transition: all 0.2s;
}
.admin-shell .btn-logout:hover {
    border-color: var(--a-accent);
    color: var(--a-accent);
}

/* Content */
.admin-shell .admin-content {
    flex: 1;
    padding: 2rem;
}

/* Mobile */
.admin-shell .mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--a-text);
    cursor: pointer;
    padding: 0.3rem;
}
.admin-shell .sidebar-overlay { display: none; }

@media (max-width: 768px) {
    .admin-shell .admin-sidebar {
        transform: translateX(-100%);
        width: 280px !important;
    }
    .admin-shell .admin-sidebar.mobile-open {
        transform: translateX(0);
    }
    .admin-shell .admin-main {
        margin-left: 0 !important;
    }
    .admin-shell .mobile-menu-btn { display: block; }
    .admin-shell .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 99;
    }
    .admin-shell .admin-content { padding: 1.2rem; }
    .admin-shell.sidebar-collapsed .admin-sidebar {
        width: 280px !important;
    }
}

/* ─── ADMIN COMMON STYLES ─── */

/* Page header */
.admin-shell .admin-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.admin-shell .admin-page-header h1 {
    font-family: var(--a-font-serif);
    font-size: 2rem;
    font-weight: 400;
    font-style: italic;
    color: var(--a-text);
    margin: 0;
}

/* Stat cards */
.admin-shell .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.2rem;
    margin-bottom: 2.5rem;
}
.admin-shell .stat-card {
    background: var(--a-surface);
    border: 1px solid var(--a-border);
    border-top: 3px solid var(--a-accent);
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.admin-shell .stat-card-label {
    font-family: var(--a-font-sans);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--a-text-secondary);
    margin-bottom: 0.5rem;
}
.admin-shell .stat-card-value {
    font-family: var(--a-font-serif);
    font-size: 2.2rem;
    font-weight: 600;
    color: var(--a-text);
    line-height: 1;
}

/* Tables */
.admin-shell .admin-table-wrap {
    background: var(--a-surface);
    border: 1px solid var(--a-border);
    border-top: 3px solid var(--a-accent);
    overflow-x: auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.admin-shell .admin-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--a-font-sans);
    font-size: 0.85rem;
    font-weight: 400;
}
.admin-shell .admin-table thead {
    border-bottom: 1px solid var(--a-border);
}
.admin-shell .admin-table th {
    padding: 0.9rem 1.2rem;
    text-align: left;
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--a-text-secondary);
    white-space: nowrap;
}
.admin-shell .admin-table td {
    padding: 0.8rem 1.2rem;
    border-bottom: 1px solid var(--a-border);
    color: var(--a-text);
    vertical-align: middle;
}
.admin-shell .admin-table tr:last-child td { border-bottom: none; }
.admin-shell .admin-table tr:hover td {
    background: rgba(191,160,122,0.05);
}

/* Badges */
.admin-shell .badge {
    display: inline-block;
    padding: 0.25rem 0.7rem;
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-family: var(--a-font-sans);
    border-radius: 2px;
}
.admin-shell .badge-success { background: rgba(76,175,80,0.12); color: #2E7D32; }
.admin-shell .badge-warning { background: rgba(255,152,0,0.12); color: #E65100; }
.admin-shell .badge-muted { background: rgba(0,0,0,0.06); color: var(--a-text-muted); }

/* Admin buttons */
.admin-shell .btn-admin {
    font-family: var(--a-font-sans);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 0.6rem 1.5rem;
    border: 1px solid var(--a-accent);
    background: var(--a-accent);
    color: #FFFFFF;
    cursor: pointer;
    transition: all 0.2s;
}
.admin-shell .btn-admin:hover {
    background: var(--a-accent-hover);
    border-color: var(--a-accent-hover);
}
.admin-shell .btn-admin-primary {
    background: var(--a-accent);
    border-color: var(--a-accent);
    color: #FFFFFF;
}
.admin-shell .btn-admin-outline {
    background: transparent;
    color: var(--a-text);
    border-color: var(--a-border);
}
.admin-shell .btn-admin-outline:hover {
    border-color: var(--a-accent);
    color: var(--a-accent);
}
.admin-shell .btn-admin-danger {
    background: transparent;
    border-color: #e57373;
    color: #e57373;
}
.admin-shell .btn-admin-danger:hover {
    background: #e57373;
    color: #FFFFFF;
}
.admin-shell .btn-admin-sm {
    padding: 0.35rem 0.9rem;
    font-size: 0.65rem;
}

/* Admin forms */
.admin-shell .admin-form-group { margin-bottom: 1.5rem; }
.admin-shell .admin-form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-family: var(--a-font-sans);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--a-text-secondary);
}
.admin-shell .admin-input {
    width: 100%;
    padding: 0.7rem 0.5rem;
    border: 1px solid var(--a-border);
    border-radius: 0;
    font-size: 0.95rem;
    font-family: var(--a-font-sans);
    font-weight: 400;
    color: var(--a-text);
    background: var(--a-surface);
    transition: border-color 0.2s;
}
.admin-shell .admin-input:focus {
    outline: none;
    border-color: var(--a-accent);
}
.admin-shell select.admin-input { appearance: none; cursor: pointer; }
.admin-shell textarea.admin-input { min-height: 80px; resize: vertical; }

/* Pagination */
.admin-shell .admin-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.2rem;
    font-family: var(--a-font-sans);
}
.admin-shell .admin-pagination button {
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--a-border);
    background: transparent;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--a-font-sans);
    color: var(--a-text);
}
.admin-shell .admin-pagination button:hover {
    border-color: var(--a-accent);
    color: var(--a-accent);
}
.admin-shell .admin-pagination button.active {
    background: var(--a-accent);
    border-color: var(--a-accent);
    color: #FFFFFF;
}
.admin-shell .admin-pagination button:disabled {
    opacity: 0.4;
    cursor: default;
}

/* Filters bar */
.admin-shell .admin-filters {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.admin-shell .filter-btn {
    font-family: var(--a-font-sans);
    font-size: 0.68rem;
    font-weight: 400;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 0.45rem 1.2rem;
    border: 1px solid var(--a-border);
    background: transparent;
    color: var(--a-text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}
.admin-shell .filter-btn:hover {
    border-color: var(--a-accent);
    color: var(--a-accent);
}
.admin-shell .filter-btn.active {
    border-color: var(--a-accent);
    color: var(--a-accent);
    background: rgba(191,160,122,0.08);
}

/* Empty state */
.admin-shell .admin-empty {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--a-text-muted);
    font-family: var(--a-font-sans);
    font-weight: 400;
    font-size: 0.9rem;
}

/* Loading */
.admin-shell .admin-loading {
    text-align: center;
    padding: 3rem;
    font-family: var(--a-font-sans);
    font-size: 0.78rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--a-text-muted);
}

/* Toast notifications */
.admin-shell .admin-toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.8rem;
    font-family: var(--a-font-sans);
    font-size: 0.85rem;
    font-weight: 400;
    border-left: 3px solid var(--a-accent);
    background: var(--a-surface);
    color: var(--a-text);
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    z-index: 200;
    animation: adminToastIn 0.3s ease;
}
.admin-shell .admin-toast.success { border-left-color: #4CAF50; }
.admin-shell .admin-toast.error { border-left-color: #e57373; }
@keyframes adminToastIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ─── DASHBOARD-SPECIFIC ─── */
.admin-shell .stat-card-sub {
    font-size: 1rem;
    color: var(--a-text-muted);
    font-weight: 400;
    margin-left: 0.3rem;
}
.admin-shell .stat-card-accent { border-top-color: #4CAF50; }
.admin-shell .stat-card-highlight { border-top-color: #FF9800; }

.admin-shell .dashboard-section { margin-bottom: 2.5rem; }
.admin-shell .dashboard-section h3 {
    font-family: var(--a-font-serif);
    font-size: 1.3rem;
    font-weight: 500;
    font-style: italic;
    color: var(--a-text);
    margin-bottom: 1.2rem;
}
.admin-shell .dashboard-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.2rem;
}
.admin-shell .dashboard-section-header h3 { margin-bottom: 0; }

.admin-shell .activity-chart {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 120px;
    padding: 1rem;
    background: var(--a-surface);
    border: 1px solid var(--a-border);
    border-top: 3px solid var(--a-accent);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.admin-shell .activity-bar {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}
.admin-shell .activity-bar-fill {
    width: 100%;
    background: var(--a-accent);
    min-height: 2px;
    transition: height 0.3s ease;
    opacity: 0.8;
}
.admin-shell .activity-bar:hover .activity-bar-fill { opacity: 1; }
.admin-shell .activity-bar-label {
    font-family: var(--a-font-sans);
    font-size: 0.55rem;
    color: var(--a-text-muted);
    margin-top: 4px;
}

/* ─── TRANSLATION EDITOR COMPONENT ─── */
.admin-shell .translation-editor-component {
    background: var(--a-surface);
    border: 1px solid var(--a-border);
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1.5rem;
}
.admin-shell .section-title {
    font-family: var(--a-font-serif);
    font-size: 1.15rem;
    color: var(--a-text);
    margin: 0 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--a-border);
}
.admin-shell .admin-text-muted {
    color: var(--a-text-muted);
    font-style: italic;
}
.admin-shell .module-card {
    background: var(--a-bg);
    border: 1px solid var(--a-border);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
}
.admin-shell .module-card .translation-editor-component {
    margin-top: 0.75rem;
    border: none;
    padding: 0.75rem 0 0;
    background: transparent;
}
.admin-shell .btn-admin-danger {
    background: #dc3545;
    color: #fff;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}
.admin-shell .btn-admin-danger:hover {
    background: #c82333;
}
.admin-shell .btn-sm {
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
}

/* Media page enhancements */
.admin-shell .media-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}
.admin-shell .admin-select {
    background: var(--a-card);
    color: var(--a-text);
    border: 1px solid var(--a-border);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
}
.admin-shell .upload-section-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--a-card);
    border: 1px solid var(--a-accent);
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--a-text);
}
.admin-shell .media-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.admin-shell .media-section-tag {
    background: var(--a-accent);
    color: #fff;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    white-space: nowrap;
}
/* Media picker modal */
.admin-shell .media-picker-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.admin-shell .media-picker-modal {
    background: var(--a-card);
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 24px rgba(0,0,0,0.3);
}
.admin-shell .media-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--a-border);
}
.admin-shell .media-picker-header h3 {
    margin: 0;
    color: var(--a-text);
}
.admin-shell .media-picker-body {
    padding: 1rem 1.25rem;
    overflow-y: auto;
    flex: 1;
}
.admin-shell .media-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
}
.admin-shell .media-picker-item {
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s;
    aspect-ratio: 1;
}
.admin-shell .media-picker-item:hover {
    border-color: var(--a-accent);
}
.admin-shell .media-picker-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.admin-shell .media-picker-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--a-border);
    gap: 0.75rem;
}
.admin-shell .media-picker-upload {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.admin-shell .media-picker-url {
    flex: 1;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.admin-shell .media-picker-url input {
    flex: 1;
    background: var(--a-bg);
    color: var(--a-text);
    border: 1px solid var(--a-border);
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
}
.admin-richtext-wrapper { background: #fff; border: 1px solid #ddd; border-radius: 4px; } .ql-editor { min-height: 200px; font-family: inherit; font-size: 1rem; }
