/* Full Saudi Green National Theme */
:root {
    --primary-color: #165E3A; /* Official Saudi Green */
    --secondary-color: #ffffff; /* Flag White */
    --accent-color: #2d8a57;
    --text-color: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.7);
    --bg-color: #165E3A;
    --card-bg: rgba(255, 255, 255, 0.1);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

body {
    background: var(--bg-color) !important;
    color: var(--secondary-color) !important;
    margin: 0;
    padding: 0;
    font-family: 'Cairo', sans-serif;
}

/* Miniature National Flag Header */
.mini-flag-header {
    background: #165E3A; /* Solid Saudi Green */
    padding: 0.8rem 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.mini-grid {
    display: flex;
    justify-content: center;
    gap: 0.8rem; /* Reduced gap for more columns */
    margin-bottom: 0.8rem;
}

.mini-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    min-width: 90px; /* Reduced width for 6 columns */
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.mini-column.today-highlight {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.mini-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: white;
}

.mini-stat i { 
    width: 14px; 
    height: 14px; 
    opacity: 0.7;
    margin-bottom: 2px;
}

.mini-stat strong { 
    font-size: 1.1rem; 
    font-weight: 900;
}

.mini-stat span {
    font-size: 0.65rem;
    font-weight: 600;
    opacity: 0.8;
}

.mini-nav-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    width: 100%;
    justify-content: center;
}

.mini-nav-btn.active {
    background: white;
    color: #165E3A;
}

/* Premium Smart Action Bar */
.smart-action-bar {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    padding: 0.4rem 1.2rem;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    gap: 0.8rem;
}

.premium-btn {
    background: transparent;
    border: none;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    padding: 0.4rem 0.8rem;
    border-radius: 30px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 700;
    font-size: 0.75rem;
}

.premium-btn i { width: 18px; height: 18px; }

.premium-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.premium-btn.delete {
    background: rgba(255, 77, 77, 0.2);
    color: #ffcccc;
    border: 1px solid rgba(255, 77, 77, 0.3);
}

.premium-btn.delete:hover {
    background: #ff4d4d;
    color: white;
}

.v-divider-mini {
    width: 1px;
    height: 15px;
    background: rgba(255, 255, 255, 0.2);
}

.premium-toggle {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    color: white;
    font-weight: 700;
    font-size: 0.75rem;
}

.premium-toggle input { display: none; }

.toggle-box {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.premium-toggle input:checked + .toggle-box {
    background: #ffffff;
    border-color: #ffffff;
    color: #165E3A;
}

.toggle-box i { width: 12px; height: 12px; }

.premium-search-box {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.15);
    padding: 0.3rem 1rem;
    border-radius: 50px;
    gap: 0.6rem;
    width: 140px; /* Compact width for toolbar */
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-right: 0.5rem;
}

.premium-search-box:focus-within {
    width: 220px;
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

.premium-search-box i { color: white; opacity: 0.6; width: 14px; }

.premium-search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: white;
    width: 100%;
    font-size: 0.75rem;
    font-weight: 600;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
    font-size: 13px;
    transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    user-select: none;
}

html, body {
    margin: 0 !important;
    padding: 0 !important;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    height: 100%;
}

.app-container {
    display: flex;
    min-height: 100vh;
    margin: 0 !important;
    padding: 0 !important;
}

/* Floating Draggable Sidebar */
.sidebar {
    width: 250px;
    background: linear-gradient(180deg, var(--primary-color) 0%, #0d3d25 100%);
    color: white;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 50px;
    right: 30px;
    height: auto;
    max-height: 80vh;
    border-radius: 30px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    cursor: grab;
    user-select: none;
    border: 2px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
}

.sidebar:active {
    cursor: grabbing;
}

.sidebar.collapsed {
    transform: scale(0.5);
    opacity: 0.5;
    pointer-events: none;
}

.sidebar-toggle {
    display: none; /* Draggable replaces collapsible for now */
}

.logo {
    margin-bottom: 2rem;
    pointer-events: none;
}
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.6rem;
    font-weight: 800;
    color: white;
    margin-bottom: 4rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 1.5rem;
}

.logo i {
    width: 36px;
    height: 36px;
}

nav {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

nav a {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    padding: 1rem 1.2rem;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.7);
    border-radius: 15px;
    transition: all 0.4s ease;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    user-select: none;
}

nav a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateX(-5px);
}

nav a.active {
    background: white;
    color: var(--primary-color) !important;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

nav a i {
    width: 22px;
    height: 22px;
}

body {
    animation: fadeInPage 0.5s ease-out;
}

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

/* Main Content */
.main-content {
    flex: 1;
    padding: 0 !important;
    margin: 0 !important;
    background: var(--bg-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.mini-select-all {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
}

.mini-select-all input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: white;
}

.mini-select-all span {
    font-size: 0.75rem;
    font-weight: 700;
}

.action-btn-minimal.danger {
    color: #ff6b6b;
}

.action-btn-minimal.danger:hover {
    color: #ff4d4d;
    background: rgba(255, 107, 107, 0.1);
    border-radius: 10px;
}

/* Dark Mode Overrides for National Theme */
[data-theme="dark"] {
    --bg-color: #0b2e1c; /* Deep Dark Emerald */
    --card-bg: rgba(0, 0, 0, 0.3);
    --text-muted: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] .national-grid-header {
    background: rgba(0, 0, 0, 0.4);
}

.main-content {
    padding: 0;
}

/* National Grid Header */
.national-grid-header {
    background: rgba(0, 0, 0, 0.2);
    padding: 2rem 4rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(20px);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 2rem;
}

.grid-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 3rem;
}

.toolbar-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
    padding: 1rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    min-width: 180px;
}

.toolbar-column:hover {
    background: rgba(255, 255, 255, 0.1);
}

.ribbon-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.9rem;
}

.ribbon-item strong {
    font-size: 1.2rem;
    font-weight: 900;
}

.nav-btn-minimal {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.6rem 1.5rem;
    border-radius: 30px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    justify-content: center;
}

.nav-btn-minimal.active {
    background: white;
    color: var(--primary-color);
}

.header-footer-row {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.actions-group {
    display: flex;
    gap: 1.5rem;
}

.action-btn-minimal {
    background: transparent;
    border: none;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    cursor: pointer;
    opacity: 0.8;
}

.action-btn-minimal:hover {
    opacity: 1;
}

.capsule-search-minimal {
    background: rgba(255, 255, 255, 0.15);
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 350px;
}

.capsule-search-minimal input {
    background: transparent;
    border: none;
    outline: none;
    color: white;
    width: 100%;
}

.capsule-search-minimal input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.compact-search-container {
    width: 400px;
}

.capsule-search {
    background: white;
    border-radius: 12px;
    padding: 0.6rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: var(--shadow-sm);
}

.capsule-search input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 0.9rem;
    color: var(--text-color);
}

.hero-search {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 0.8rem 1.5rem;
    border-radius: 18px;
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 500px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.hero-search input {
    border: none;
    outline: none;
    width: 100%;
    background: transparent;
    color: white;
    font-size: 0.95rem;
}

.hero-search input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.hero-actions {
    display: flex;
    gap: 1rem;
}

.btn-hero-primary, .btn-hero-secondary {
    padding: 0.8rem 1.8rem;
    border-radius: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: all 0.3s ease;
    border: none;
}

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

.btn-hero-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.btn-hero-primary:hover, .btn-hero-secondary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.hero-main-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    z-index: 10;
}

.hero-text h1 {
    font-size: 2.8rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
}

.hero-text p {
    font-size: 1.2rem;
    opacity: 0.85;
}

.hero-stats-mini {
    background: rgba(255, 255, 255, 0.1);
    padding: 1.8rem 2.5rem;
    border-radius: 28px;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
}

.stats-ribbon {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    background: transparent;
    padding: 0.5rem 0;
    border: none;
    width: 100%;
}

.hero-footer-badges {
    display: flex;
    gap: 1.5rem;
    z-index: 10;
}

.hero-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.6rem 1.2rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* Sections Spacing */
.stats-grid, .files-section {
    padding-left: 4rem;
    padding-right: 4rem;
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

.stat-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
}

.stat-info h3 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
    letter-spacing: 0.5px;
}

.stat-info p {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--text-color);
    line-height: 1;
}

.stat-icon {
    width: 60px;
    height: 60px;
    padding: 15px;
    background: var(--bg-color);
    border-radius: 20px;
    color: var(--primary-color);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.stat-icon.green { color: #27ae60; background: rgba(39, 174, 96, 0.1); }
.stat-icon.blue { color: #2980b9; background: rgba(41, 128, 185, 0.1); }

/* White Content Area with Black Lines */
.archive-body {
    background: white;
    padding: 2rem 4rem;
    min-height: 60vh;
    color: #000000;
}

.files-section {
    margin-bottom: 4rem;
    background: transparent;
    padding: 0;
    box-shadow: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding-bottom: 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section-header h2 {
    font-size: 1.4rem;
    font-weight: 800;
    color: #000000; /* Black Header */
    position: relative;
    padding-right: 1.5rem;
}

.section-header h2::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 25px;
    background: #165E3A; /* Saudi Green accent line */
    border-radius: 10px;
}

.view-all-btn {
    background: white;
    border: 2px solid #000000;
    color: #000000; /* Black View All */
    padding: 0.5rem 1.2rem;
    border-radius: 10px;
    font-weight: 800;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: all 0.3s ease;
}

.view-all-btn:hover {
    background: #000000;
    color: white;
}

.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.bulk-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.select-all-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-muted);
}

.btn-danger-outline {
    background: transparent;
    color: #e74c3c;
    border: 1px solid #e74c3c;
    padding: 0.4rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.btn-danger-outline:hover {
    background: #e74c3c;
    color: white;
}

/* File Squares/Boxes */
.file-card {
    width: 150px;
    height: 160px;
    background: #fdfdfd; /* Light card bg */
    border: 2px solid #000000; /* Distinct Black Box Border */
    border-radius: 15px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    transition: all 0.3s ease;
    box-shadow: 4px 4px 0px rgba(0,0,0,0.1); /* "Square" aesthetic */
}

.file-card:hover {
    transform: translate(-2px, -2px);
    box-shadow: 8px 8px 0px rgba(0,0,0,0.15);
}

.file-checkbox {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 16px;
    height: 16px;
    accent-color: #165E3A;
    cursor: pointer;
    z-index: 20;
}

.file-badge {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    background: #000000;
    color: white;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 900;
}

/* Dark Mode Fixes */
[data-theme="dark"] .archive-body {
    background: #0b2e1c; /* Deep Emerald */
    color: white;
}

[data-theme="dark"] .files-section {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .section-header h2 {
    color: white;
}

[data-theme="dark"] .file-card {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 4px 4px 0px rgba(0,0,0,0.3);
}

[data-theme="dark"] .view-all-btn {
    background: transparent;
    border-color: white;
    color: white;
}

[data-theme="dark"] .view-all-btn:hover {
    background: white;
    color: #165E3A;
}

.file-info span {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
}

.file-subject {
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 0.5rem;
    background: rgba(26, 94, 58, 0.05);
    padding: 2px 10px;
    border-radius: 8px;
    display: inline-block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-actions {
    position: absolute;
    top: 15px;
    left: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
}

.file-card:hover .file-actions {
    opacity: 1;
    transform: translateX(0);
}

.action-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: none;
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
}

.action-btn:hover { color: var(--primary-color); }
.action-btn.delete:hover { color: #e74c3c; }

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active { display: flex; }

.modal-content {
    background: var(--card-bg);
    color: var(--text-color);
    padding: 2rem;
    border-radius: 20px;
    width: 400px;
}

.preview-modal-content {
    width: 80%;
    height: 90%;
    max-width: 1000px;
}

#previewFrame {
    width: 100%;
    height: calc(100% - 60px);
    border-radius: 10px;
    border: none;
    background: white;
}

.qr-container {
    text-align: center;
    padding: 1rem;
}

.qr-container img {
    max-width: 200px;
    border-radius: 10px;
    margin-bottom: 1rem;
}

.form-group {
    margin: 1.5rem 0;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 10px;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.btn-secondary {
    background: #f1f2f6;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    cursor: pointer;
}
