/* Museum Archive UI Styling */
:root {
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --primary-gradient: linear-gradient(135deg, #0ea5e9 0%, #1d4ed8 100%);
    --secondary: #475569;
    --accent: #0284c7;
    --bg-main: #f0f4f8;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-glass: rgba(255, 255, 255, 0.72);
    --bg-glass-card: rgba(255, 255, 255, 0.82);
    --glass-blur: blur(12px);
    --glass-border: 1px solid rgba(255, 255, 255, 0.65);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.08);
    --border-color: #e2e8f0;
    --text-dark: #0f172a;
    --text-muted: #64748b;
    --sidebar-bg: rgba(15, 23, 42, 0.92);
    --sidebar-text: #94a3b8;
    --sidebar-active: #0284c7;
    --status-collection: #dbeafe;
    --status-collection-txt: #0369a1;
    --status-exhibit: #dcfce7;
    --status-exhibit-txt: #166534;
    --status-loan: #fef3c7;
    --status-loan-txt: #92400e;
    --status-conservation: #fce7f3;
    --status-conservation-txt: #9d174d;
}

/* Theme 1: Heritage Arch (Oceanic Azure & Deep Indigo) */
body.theme-official {
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --primary-gradient: linear-gradient(135deg, #0284c7 0%, #1e3a8a 100%);
    --sidebar-bg: rgba(15, 23, 42, 0.94);
    --sidebar-active: #0ea5e9;
    --bg-main: #f1f5f9;
}

/* Theme 2: Neoclassical Columns (Sapphire Glow & Frosted Aqua) */
body.theme-museum {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-gradient: linear-gradient(135deg, #38bdf8 0%, #1e40af 100%);
    --sidebar-bg: rgba(11, 23, 48, 0.94);
    --sidebar-active: #38bdf8;
    --bg-main: #eff6ff;
}

/* Theme 3: Roman Colosseum (Mediterranean Cobalt & Marine Cyan) */
body.theme-colosseum {
    --primary: #0f766e;
    --primary-hover: #115e59;
    --primary-gradient: linear-gradient(135deg, #06b6d4 0%, #0f766e 100%);
    --sidebar-bg: rgba(13, 27, 30, 0.95);
    --sidebar-active: #14b8a6;
    --bg-main: #f0fdfa;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-main);
    background-image: radial-gradient(at 0% 0%, rgba(14, 165, 233, 0.08) 0px, transparent 50%),
                      radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.08) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-dark);
    line-height: 1.5;
}

#app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header with Frosted Glassmorphism */
#main-header {
    background: var(--primary-gradient);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    color: white;
    padding: 0.65rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-icon {
    font-size: 1.8rem;
    color: #fbbf24;
}

.brand-text h1 {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
}

.brand-text .subtext {
    font-size: 0.75rem;
    color: #93c5fd;
}

.header-actions {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

/* Layout */
#main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar Task Panel */
#task-panel {
    width: 270px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    height: 100%;
    border-right: 1px solid rgba(255,255,255,0.05);
    overflow: hidden;
}

#task-panel-scrollable-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0;
}

#task-panel-scrollable-body::-webkit-scrollbar {
    width: 6px;
}

#task-panel-scrollable-body::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
}

.panel-section {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.panel-section h3 {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.task-menu {
    list-style: none;
}

.task-menu li {
    padding: 0.55rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.15s ease;
    margin-bottom: 0.2rem;
}

.task-menu li:hover {
    background-color: rgba(255,255,255,0.05);
    color: #f8fafc;
}

.task-menu li.active {
    background-color: var(--sidebar-active);
    color: white;
    font-weight: 600;
}

.panel-section .form-group {
    margin-bottom: 0.6rem;
}

.panel-section label {
    display: block;
    font-size: 0.72rem;
    color: #94a3b8;
    margin-bottom: 0.2rem;
}

.panel-section select {
    width: 100%;
    background-color: #0f172a;
    border: 1px solid #334155;
    color: #f8fafc;
    padding: 0.35rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* Fixed Quick Function Launcher Footer */
#sidebar-fixed-launcher {
    flex-shrink: 0;
    background: #0f172a;
    border-top: 1px solid rgba(59, 130, 246, 0.3);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.25);
    padding: 0.85rem 1rem;
    z-index: 10;
}

#sidebar-fixed-launcher .launcher-header {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #93c5fd;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

#sidebar-fixed-launcher select {
    width: 100%;
    background: #1e293b;
    color: #f8fafc;
    border: 1px solid #3b82f6;
    border-radius: 6px;
    padding: 0.45rem 0.6rem;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
}

#sidebar-fixed-launcher select:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.3);
}

/* Main Content Area */
#content-area {
    flex: 1;
    background-color: var(--bg-main);
    overflow-y: auto;
    padding: 1.5rem;
}

.tab-view {
    display: none;
    flex-direction: column;
    gap: 1.25rem;
}

.tab-view.active {
    display: flex;
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toolbar-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-glass-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    padding: 0.85rem 1.15rem;
    border-radius: 10px;
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.search-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    max-width: 550px;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    padding: 0.55rem 0.75rem 0.55rem 2.25rem;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.search-box input:focus {
    background: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.view-stats-summary {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Tables with Glass Container */
.table-responsive {
    background: var(--bg-glass-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: 10px;
    border: var(--glass-border);
    overflow-x: auto;
    box-shadow: var(--glass-shadow);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

.data-table th {
    background-color: #f1f5f9;
    color: var(--secondary);
    font-weight: 600;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background-color: #f8fafc;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.45rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-collection { background-color: var(--status-collection); color: var(--status-collection-txt); }
.badge-exhibit { background-color: var(--status-exhibit); color: var(--status-exhibit-txt); }
.badge-loan { background-color: var(--status-loan); color: var(--status-loan-txt); }
.badge-conservation { background-color: var(--status-conservation); color: var(--status-conservation-txt); }
.badge-success { background-color: #dcfce7; color: #166534; }
.badge-warning { background-color: #fef3c7; color: #92400e; }
.badge-danger { background-color: #fee2e2; color: #991b1b; }
.badge-default { background-color: #f1f5f9; color: #475569; }

/* Buttons */
.btn {
    padding: 0.45rem 0.85rem;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: background-color 0.15s ease;
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.78rem;
}

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

.btn-secondary { background-color: var(--secondary); color: white; }
.btn-secondary:hover { background-color: #334155; }

.btn-warning { background-color: #f59e0b; color: #0f172a; font-weight: 600; }
.btn-warning:hover { background-color: #d97706; color: #fff; }

.btn-outline { background-color: #ffffff; border: 1px solid #cbd5e1; color: #334155; font-weight: 500; }
.btn-outline:hover { background-color: #f1f5f9; border-color: #94a3b8; color: #0f172a; }

header .btn-outline { background-color: transparent; border: 1px solid rgba(255,255,255,0.3); color: white; }
header .btn-outline:hover { background-color: rgba(255,255,255,0.1); }

.btn-action {
    padding: 0.25rem 0.45rem;
    border-radius: 4px;
    background-color: #f1f5f9;
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}
.btn-action:hover { background-color: #e2e8f0; }

/* Cards & Layouts */
.two-column-layout {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.25rem;
}

.card {
    background: var(--bg-glass-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: 12px;
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    overflow: hidden;
}

.card-header {
    padding: 0.85rem 1.15rem;
    background: rgba(241, 245, 249, 0.6);
    backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid rgba(226, 232, 240, 0.7);
    font-weight: 600;
    font-size: 0.9rem;
}

.card-body {
    padding: 1.15rem;
}

.list-group {
    list-style: none;
}

.list-group-item {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.list-group-item:last-child {
    border-bottom: none;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.stat-card {
    background-color: var(--bg-card);
    padding: 1.15rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.border-left-primary { border-left: 4px solid var(--primary); }
.border-left-success { border-left: 4px solid #16a34a; }
.border-left-warning { border-left: 4px solid var(--accent); }
.border-left-info { border-left: 4px solid #0284c7; }
.border-left-purple { border-left: 4px solid #7c3aed; }

.stat-title {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

/* Virtual Exhibits Grid */
.exhibits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

.exhibit-card {
    background: #fff;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
}

.exhibit-banner {
    padding: 1.25rem;
    color: white;
}

.exhibit-banner h3 {
    font-size: 1.15rem;
    margin-bottom: 0.25rem;
}

.exhibit-banner span {
    font-size: 0.8rem;
    opacity: 0.9;
}

.exhibit-body {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.exhibit-desc {
    font-size: 0.85rem;
    color: #475569;
    margin-bottom: 1rem;
}

.exhibit-items-list {
    list-style: none;
    border-top: 1px solid #e2e8f0;
    padding-top: 0.5rem;
    margin-bottom: 1rem;
}

.exhibit-items-list li {
    font-size: 0.8rem;
    padding: 0.25rem 0;
    color: #1e293b;
}

/* Modals with Glass Backdrop */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: 14px;
    border: var(--glass-border);
    width: 90%;
    max-width: 580px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-lg {
    max-width: 820px;
}

.modal-header {
    padding: 1rem 1.35rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(248, 250, 252, 0.85);
    backdrop-filter: var(--glass-blur);
}

.modal-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 1.25rem;
}

.modal-footer {
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
}

/* Modal Tabs */
.modal-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.25rem;
    overflow-x: auto;
}

.tab-link {
    padding: 0.45rem 0.85rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
}

.tab-link.active {
    border-bottom-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

/* Forms */
.form-group {
    margin-bottom: 0.85rem;
}

.form-row {
    display: flex;
    gap: 0.85rem;
}

.col-md-4 { flex: 1; }
.col-md-6 { flex: 1; }

label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: 0.3rem;
}

input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: inherit;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

/* =========================================================================
   MOBILE & TABLET RESPONSIVE SUITE (Standard Desktop displays unaffected)
   ========================================================================= */

#mobile-menu-toggle-btn {
    display: none;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    font-size: 1.15rem;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

#mobile-menu-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

#mobile-sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1040;
}

/* Tablets and Smaller Screens (<= 992px) */
@media (max-width: 992px) {
    #mobile-menu-toggle-btn {
        display: inline-flex;
    }

    #main-header {
        padding: 0.5rem 1rem !important;
        flex-wrap: wrap;
        gap: 8px;
    }

    .brand img {
        height: 52px !important;
        width: 52px !important;
    }

    .brand-text h1 {
        font-size: 1.25rem !important;
    }

    .header-actions {
        flex-wrap: wrap;
        gap: 6px !important;
    }

    .user-switcher-container {
        padding: 0 8px !important;
        height: 38px !important;
    }

    /* Off-Canvas Slide-Out Navigation Drawer */
    #task-panel {
        position: fixed;
        top: 0;
        left: -320px;
        width: 300px;
        max-width: 85vw;
        height: 100vh;
        z-index: 1050;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.35);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex !important;
    }

    #task-panel.mobile-open {
        transform: translateX(320px);
    }

    #mobile-sidebar-backdrop.mobile-open {
        display: block;
    }

    #mobile-sidebar-header {
        display: flex !important;
    }

    /* Content Area full width */
    #content-area {
        padding: 12px !important;
        width: 100% !important;
    }

    /* Form Rows Stack on Smaller Screens */
    .form-row {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    .col-md-4, .col-md-6 {
        flex: 1 1 100% !important;
        width: 100% !important;
    }

    /* Floating Action Buttons reposition for thumb reach */
    #floating-help-btn {
        bottom: 16px !important;
        right: 16px !important;
        width: 46px !important;
        height: 46px !important;
        font-size: 1.2rem !important;
    }

    #floating-settings-btn {
        bottom: 70px !important;
        right: 16px !important;
        width: 46px !important;
        height: 46px !important;
        font-size: 1.15rem !important;
    }
}

/* Smartphones (<= 600px) */
@media (max-width: 600px) {
    .brand-text .subtext {
        display: none !important;
    }

    .brand img {
        height: 42px !important;
        width: 42px !important;
    }

    #active-user-role {
        display: none !important;
    }

    #btn-toggle-stash span:not(#stash-badge-count) {
        display: none !important;
    }

    #public-portal-toggle-btn span {
        display: none !important;
    }

    /* Toolbar bar flex stacking */
    .toolbar-bar {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .toolbar-bar .search-box {
        width: 100% !important;
        min-width: 100% !important;
    }

    .toolbar-bar > div:last-child {
        width: 100% !important;
        justify-content: space-between !important;
    }

    /* Modal Full-Screen on Small Mobile */
    .modal-content {
        width: 96vw !important;
        max-width: 96vw !important;
        max-height: 92vh !important;
        margin: 4vh auto !important;
        padding: 14px !important;
    }

    .modal-tabs {
        overflow-x: auto !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Tables horizontal scroll container */
    .table-responsive {
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 12px;
    }
}
