/* 
 * Files.apmiandrs.com - Modern Dark Slate Stylesheet
 * Hand-crafted comprehensive responsive system bypassing CDN dependencies.
 */

/* ==================== CSS VARIABLES (Dynamic Theme Palette) ==================== */
:root {
    --brand-indigo: #6366f1;     /* Primary accent colors */
    --brand-indigo-hover: #4f46e5;
    --brand-emerald: #10b981;    /* Success / Active statuses */
    --brand-rose: #f43f5e;       /* Danger / Banned states */
    --brand-amber: #f59e0b;      /* Warnings / Expiration caps */
    
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --border-radius-xl: 1rem;
    --border-radius-lg: 0.75rem;
    --border-radius-md: 0.5rem;
    
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);

    /* Default (Dark theme fallback) values */
    --bg-primary: #030712;       /* slate-950 background */
    --bg-secondary: #0b0f19;     /* Slate dark card panels */
    --bg-tertiary: #111827;      /* Slate-900 border and panel layers */
    --bg-accent: rgba(99, 102, 241, 0.1); /* Indigo glow accent */
    
    --border-color: #1e293b;     /* Slate-800 dividers */
    --border-hover: #334155;     /* Slate-700 active outlines */
    
    --text-primary: #f8fafc;     /* Slate-50 */
    --text-secondary: #94a3b8;   /* Slate-400 */
    --text-muted: #64748b;       /* Slate-500 */
    --title-gradient: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);

    --panel-bg: rgba(11, 15, 25, 0.6);
    --glow-opacity: 0.8;
    --input-bg: rgba(3, 7, 18, 0.4);
    --input-bg-focus: rgba(3, 7, 18, 0.7);
    --th-bg: rgba(3, 7, 18, 0.4);
    --tr-hover: rgba(30, 41, 59, 0.15);
    --dropzone-bg: rgba(11, 15, 25, 0.4);
    --header-bg: rgba(3, 7, 18, 0.85);
}

/* Light Theme Variables */
:root[data-theme="light"] {
    --bg-primary: #f8fafc;       /* Slate-50 soft off-white */
    --bg-secondary: #ffffff;     /* Pure white */
    --bg-tertiary: #f1f5f9;      /* Slate-100 */
    --bg-accent: rgba(99, 102, 241, 0.05); /* Soft Indigo */
    
    --border-color: #cbd5e1;     /* Slate-300 high contrast */
    --border-hover: #94a3b8;     /* Slate-400 */
    
    --text-primary: #0f172a;     /* Slate-900 deep charcoal */
    --text-secondary: #475569;   /* Muted darker gray */
    --text-muted: #64748b;       /* Slate-500 */
    --title-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);

    --panel-bg: #ffffff;
    --glow-opacity: 0;
    --input-bg: #f8fafc;
    --input-bg-focus: #ffffff;
    --th-bg: #f1f5f9;
    --tr-hover: #f1f5f9;
    --dropzone-bg: #ffffff;
    --header-bg: rgba(255, 255, 255, 0.85);
    --shadow-xl: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
}

/* Dark Theme Variables */
:root[data-theme="dark"] {
    --bg-primary: #030712;       /* slate-950 background */
    --bg-secondary: #0b0f19;     /* Slate dark card panels */
    --bg-tertiary: #111827;      /* Slate-900 border and panel layers */
    --bg-accent: rgba(99, 102, 241, 0.1); /* Indigo glow accent */
    
    --border-color: #1e293b;     /* Slate-800 dividers */
    --border-hover: #334155;     /* Slate-700 active outlines */
    
    --text-primary: #f1f5f9;     /* Light gray/white for dark mode */
    --text-secondary: #94a3b8;   /* Muted gray */
    --text-muted: #64748b;       /* Slate-500 */
    --title-gradient: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);

    --panel-bg: rgba(11, 15, 25, 0.6);
    --glow-opacity: 0.8;
    --input-bg: rgba(3, 7, 18, 0.4);
    --input-bg-focus: rgba(3, 7, 18, 0.7);
    --th-bg: rgba(3, 7, 18, 0.4);
    --tr-hover: rgba(30, 41, 59, 0.15);
    --dropzone-bg: rgba(11, 15, 25, 0.4);
    --header-bg: rgba(3, 7, 18, 0.85);
}

/* prefers-color-scheme automatic selector */
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --bg-primary: #f8fafc;       /* Slate-50 */
        --bg-secondary: #ffffff;     /* Solid white */
        --bg-tertiary: #f1f5f9;      /* Slate-100 */
        --bg-accent: rgba(99, 102, 241, 0.05); /* Soft Indigo */
        
        --border-color: #cbd5e1;     /* Slate-300 */
        --border-hover: #94a3b8;     /* Slate-400 */
        
        --text-primary: #0f172a;     /* Slate-900 */
        --text-secondary: #475569;   /* Muted darker gray */
        --text-muted: #64748b;       /* Slate-500 */
        --title-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);

        --panel-bg: #ffffff;
        --glow-opacity: 0;
        --input-bg: #f8fafc;
        --input-bg-focus: #ffffff;
        --th-bg: #f1f5f9;
        --tr-hover: #f1f5f9;
        --dropzone-bg: #ffffff;
        --header-bg: rgba(255, 255, 255, 0.85);
        --shadow-xl: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
        --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    }
}

/* ==================== BASE RESET ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-sans);
    transition: background-color 0.2s, border-color 0.2s, opacity 0.2s;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    line-height: 1.5;
    -webkit-font-rendering: antialiased;
}

/* ==================== OFFLINE TAILWIND UTILITY FALLBACKS ==================== */
.mx-auto { margin-left: auto; margin-right: auto; }
.max-w-7xl { max-width: 80rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
@media (min-width: 640px) {
    .sm\:px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
}
@media (min-width: 1024px) {
    .lg\:px-8 { padding-left: 2rem; padding-right: 2rem; }
}
.flex { display: flex; }
.flex-col { flex-direction: column; }
.h-16 { height: 4rem; }
.h-10 { height: 2.5rem; }
.h-full { height: 100%; }
.w-10 { width: 2.5rem; }
.w-px { width: 1px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 0.5rem; }
.gap-2\.5 { gap: 0.625rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.group { position: relative; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-md { border-radius: var(--border-radius-md); }
.bg-gradient-to-tr { background: linear-gradient(135deg, var(--brand-indigo), #818cf8); }
.text-white { color: #ffffff !important; }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.2); }
.shadow-brand-500\/20 { box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.2), 0 4px 6px -4px rgba(99, 102, 241, 0.1); }
.transition-all { transition: all 0.3s ease; }
.duration-300 { transition-duration: 300ms; }
.text-xl { font-size: 1.25rem; }
.font-bold { font-weight: 700; }
.tracking-tight { letter-spacing: -0.025em; }
.text-brand-500 { color: var(--brand-indigo); }
.text-brand-400 { color: #818cf8; }
.text-emerald-400 { color: var(--brand-emerald); }
.h-5 { height: 1.25rem; }
.bg-slate-800 { background-color: #1e293b; }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-slate-400 { color: #94a3b8; }
.text-slate-300 { color: #cbd5e1; }
.text-slate-200 { color: #e2e8f0; }
.text-slate-500 { color: #64748b; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-mono { font-family: monospace; }
.bg-slate-900 { background-color: #0f172a; }
.bg-slate-950 { background-color: #030712; }
.px-2\.5 { padding-left: 0.625rem; padding-right: 0.625rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.border { border: 1px solid var(--border-color); }
.border-slate-800 { border-color: #1e293b; }
.border-slate-900 { border-color: #0f172a; }
.border-b { border-bottom: 1px solid var(--border-color); }
.border-t { border-top: 1px solid var(--border-color); }
.mt-auto { margin-top: auto; }
.text-center { text-align: center; }
.fixed { position: fixed; }
.bottom-5 { bottom: 1.25rem; }
.right-5 { right: 1.25rem; }
.z-50 { z-index: 50; }
.pointer-events-none { pointer-events: none; }

/* Selection state styling */
html, body {
    height: 100%;
}
::selection {
    background-color: #6366f1 !important;
    color: #ffffff !important;
}

/* Hover scales and typography */
.hover\:text-white:hover { color: #ffffff !important; }
.hover\:text-rose-400:hover { color: var(--brand-rose) !important; }
.hover\:text-indigo-400:hover { color: #818cf8 !important; }
.group:hover .group-hover\:scale-105 { transform: scale(1.05); }
.group:hover .group-hover\:text-indigo-400 { color: #818cf8 !important; }


/* ==================== GLOBAL LAYOUT STRUCTURE ==================== */
.max-width-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

header {
    background-color: var(--header-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 40;
    height: 4rem;
    display: flex;
    align-items: center;
}

header .header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
}

.brand-icon {
    height: 2.5rem;
    width: 2.5rem;
    background: linear-gradient(135deg, var(--brand-indigo), #818cf8);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.15rem;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.25);
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.brand-name span {
    color: var(--brand-indigo);
}

nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

nav a {
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

nav a:hover {
    color: var(--text-primary);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--border-radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
    background-color: var(--brand-indigo);
    color: white;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
}

.btn-primary:hover {
    background-color: var(--brand-indigo-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--border-color);
    border-color: var(--border-hover);
}

.btn-danger {
    background-color: rgba(244, 63, 94, 0.1);
    border-color: rgba(244, 63, 94, 0.2);
    color: var(--brand-rose);
}

.btn-danger:hover {
    background-color: var(--brand-rose);
    color: white;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 6px;
}

/* ==================== INTERACTIVE CARDS & GLASS PANEL ==================== */
.glass-panel {
    background-color: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-xl);
}

.glow-card {
    position: relative;
    overflow: hidden;
}

.glow-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    border: 1px solid transparent;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), transparent 45%) border-box;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: var(--glow-opacity);
}

/* ==================== FORMS AND INPUTS ==================== */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.form-group label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 0.875rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    pointer-events: none;
}

.form-control {
    width: 100%;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    outline: none;
}

.input-wrapper .form-control {
    padding-left: 2.5rem;
}

.form-control:focus {
    border-color: var(--brand-indigo);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
    background-color: var(--input-bg-focus);
}

/* Checkbox alignment helper */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.checkbox-group input[type="checkbox"] {
    height: 1.15rem;
    width: 1.15rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    accent-color: var(--brand-indigo);
    cursor: pointer;
}

/* ==================== TABLES ==================== */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    color: var(--text-primary) !important;
}

th {
    background-color: var(--th-bg);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1rem 1.5rem;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-color);
}

.file-size, .upload-date, td.file-size, td.upload-date {
    color: var(--text-secondary) !important;
}

tr:hover td {
    background-color: var(--tr-hover);
}

/* ==================== STATUS BADGES ==================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.675rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-public {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--brand-emerald);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-private {
    background-color: rgba(100, 116, 139, 0.1);
    color: var(--text-secondary);
    border: 1px solid rgba(100, 116, 139, 0.15);
}

.badge-locked {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--brand-amber);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-burn {
    background-color: rgba(244, 63, 94, 0.1);
    color: var(--brand-rose);
    border: 1px solid rgba(244, 63, 94, 0.2);
}

/* ==================== TOAST SYSTEM ==================== */
.toast-container, #toast-container {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    left: auto !important;
    z-index: 9999 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    pointer-events: none !important;
    width: 100% !important;
    max-width: 360px !important;
}

.toast {
    pointer-events: auto !important;
    display: flex !important;
    align-items: start !important;
    width: 100% !important;
    padding: 1rem !important;
    border-radius: var(--border-radius-lg) !important;
    background-color: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: var(--shadow-lg) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
}

.toast-success {
    border-color: rgba(16, 185, 129, 0.25) !important;
}
.toast-error {
    border-color: rgba(244, 63, 94, 0.25) !important;
}
.toast-warning {
    border-color: rgba(245, 158, 11, 0.25) !important;
}
.toast-info {
    border-color: rgba(99, 102, 241, 0.25) !important;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOut {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.95); }
}

.toast-slide-in {
    animation: slideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.toast-fade-out {
    animation: fadeOut 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ==================== MASSIVE DROPZONE STYLING ==================== */
.dropzone-container {
    margin-bottom: 2rem;
}

.dropzone {
    background: var(--dropzone-bg) !important;
    border: 2px dashed var(--brand-indigo) !important;
    border-radius: var(--border-radius-xl) !important;
    padding: 3rem 2rem !important;
    text-align: center;
    color: var(--text-primary) !important;
    cursor: pointer;
    transition: all 0.3s ease !important;
}

.dropzone:hover {
    background: rgba(99, 102, 241, 0.04) !important;
    border-color: #818cf8 !important;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
}

.dz-message {
    margin: 0 !important;
}

.dz-message i {
    font-size: 2.5rem;
    color: var(--brand-indigo);
    margin-bottom: 1rem;
}

.dz-message span.dz-main-text {
    display: block;
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.dz-message span.dz-sub-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ==================== SINGLE-PAGE TABS LAYOUT (Admin / Dash) ==================== */
.layout-with-sidebar {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
}

@media (min-width: 768px) {
    .layout-with-sidebar {
        flex-direction: row;
    }
    
    .sidebar {
        width: 16rem;
        flex-shrink: 0;
    }
}

.sidebar-panel {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-xl);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tab-btn {
    width: 100%;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--border-radius-md);
    cursor: pointer;
}

.tab-btn:hover {
    color: var(--text-primary);
    background-color: rgba(30, 41, 59, 0.4);
}

.tab-btn.active {
    color: var(--brand-indigo);
    background-color: var(--bg-accent);
    border-color: rgba(99, 102, 241, 0.15);
}

/* Grid wrappers */
.stats-grid {
    display: grid;
    grid-template-cols: 1fr;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

@media (min-width: 640px) {
    .stats-grid {
        grid-template-cols: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .stats-grid {
        grid-template-cols: repeat(4, 1fr);
    }
}

.stat-card {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-card-info p.stat-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.stat-card-info p.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: 0.5rem;
    color: white;
}

.stat-card-icon {
    height: 3rem;
    width: 3rem;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

.icon-blue { background-color: rgba(59, 130, 246, 0.1); color: #60a5fa; }
.icon-emerald { background-color: rgba(16, 185, 129, 0.1); color: var(--brand-emerald); }
.icon-indigo { background-color: rgba(99, 102, 241, 0.1); color: #818cf8; }
.icon-amber { background-color: rgba(245, 158, 11, 0.1); color: var(--brand-amber); }

/* ==================== CENTERED CARD CONTAINER (Login / Share Info) ==================== */
.centered-container {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
}

.centered-card {
    width: 100%;
    max-width: 460px;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.centered-card-icon {
    height: 3.5rem;
    width: 3.5rem;
    border-radius: 1.15rem;
    background: linear-gradient(135deg, var(--brand-indigo), #818cf8);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.35rem;
    margin-bottom: 1.5rem;
}

.centered-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.5rem;
}

.centered-card p.card-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.centered-card p.card-subtitle a {
    color: var(--brand-indigo);
    text-decoration: none;
    font-weight: 600;
}

/* ==================== DYNAMIC MODALS ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(3, 7, 18, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 1.5rem;
}

.modal-panel {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-xl);
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 700;
}

.modal-body {
    padding: 1.5rem;
    max-height: 480px;
    overflow-y: auto;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background-color: rgba(3, 7, 18, 0.2);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* ==================== GENERAL UTILITY ==================== */
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-center { text-align: center; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.p-6 { padding: 1.5rem; }
.flex-column { display: flex; flex-direction: column; }
.flex-row { display: flex; flex-direction: row; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }

/* ==================== RTL OVERRIDES (Arabic Layout Reversal) ==================== */
html[dir="rtl"] {
    --font-sans: 'Tajawal', 'Inter', system-ui, -apple-system, sans-serif;
}

html[dir="rtl"] body {
    text-align: right;
}

/* Force elements text alignment */
html[dir="rtl"] th,
html[dir="rtl"] td,
html[dir="rtl"] .form-group,
html[dir="rtl"] .modal-body,
html[dir="rtl"] .stat-card-info,
html[dir="rtl"] .centered-card,
html[dir="rtl"] input,
html[dir="rtl"] select,
html[dir="rtl"] textarea,
html[dir="rtl"] .form-control {
    text-align: right !important;
}

/* Swapping input search icon positions */
html[dir="rtl"] .input-wrapper i {
    left: auto;
    right: 0.875rem;
}

html[dir="rtl"] .input-wrapper .form-control {
    padding-left: 1rem;
    padding-right: 2.5rem;
}

/* Swapping checkbox margins */
html[dir="rtl"] .checkbox-group label {
    margin-right: 0.5rem;
    margin-left: 0;
}

/* Swapping sidebars alignment */
@media (min-width: 768px) {
    html[dir="rtl"] .layout-with-sidebar {
        flex-direction: row-reverse !important;
    }
}

html[dir="rtl"] .tab-btn {
    text-align: right !important;
    flex-direction: row;
}

/* Swapping right-aligned table cells and headers in RTL */
html[dir="rtl"] th[style*="text-align: right"],
html[dir="rtl"] td[style*="text-align: right"],
html[dir="rtl"] th[style*="text-align:right"],
html[dir="rtl"] td[style*="text-align:right"] {
    text-align: left !important;
}

html[dir="rtl"] th[style*="text-align: left"],
html[dir="rtl"] td[style*="text-align: left"],
html[dir="rtl"] th[style*="text-align:left"],
html[dir="rtl"] td[style*="text-align:left"] {
    text-align: right !important;
}

/* Swapping inline margins on icons and SVG elements in RTL */
html[dir="rtl"] i[style*="margin-right"],
html[dir="rtl"] svg[style*="margin-right"] {
    margin-left: 0.5rem !important;
    margin-right: 0 !important;
}
html[dir="rtl"] i[style*="margin-left"],
html[dir="rtl"] svg[style*="margin-left"] {
    margin-right: 0.5rem !important;
    margin-left: 0 !important;
}

/* Swap standard Tailwind spacer classes in RTL */
html[dir="rtl"] .mr-0\.5 { margin-left: 0.125rem !important; margin-right: 0 !important; }
html[dir="rtl"] .mr-1 { margin-left: 0.25rem !important; margin-right: 0 !important; }
html[dir="rtl"] .mr-1\.5 { margin-left: 0.375rem !important; margin-right: 0 !important; }
html[dir="rtl"] .mr-2 { margin-left: 0.5rem !important; margin-right: 0 !important; }
html[dir="rtl"] .mr-2\.5 { margin-left: 0.625rem !important; margin-right: 0 !important; }
html[dir="rtl"] .mr-3 { margin-left: 0.75rem !important; margin-right: 0 !important; }
html[dir="rtl"] .mr-4 { margin-left: 1rem !important; margin-right: 0 !important; }
html[dir="rtl"] .mr-5 { margin-left: 1.25rem !important; margin-right: 0 !important; }
html[dir="rtl"] .mr-6 { margin-left: 1.5rem !important; margin-right: 0 !important; }
html[dir="rtl"] .mr-8 { margin-left: 2rem !important; margin-right: 0 !important; }
html[dir="rtl"] .mr-10 { margin-left: 2.5rem !important; margin-right: 0 !important; }
html[dir="rtl"] .mr-12 { margin-left: 3rem !important; margin-right: 0 !important; }

html[dir="rtl"] .ml-0\.5 { margin-right: 0.125rem !important; margin-left: 0 !important; }
html[dir="rtl"] .ml-1 { margin-right: 0.25rem !important; margin-left: 0 !important; }
html[dir="rtl"] .ml-1\.5 { margin-right: 0.375rem !important; margin-left: 0 !important; }
html[dir="rtl"] .ml-2 { margin-right: 0.5rem !important; margin-left: 0 !important; }
html[dir="rtl"] .ml-2\.5 { margin-right: 0.625rem !important; margin-left: 0 !important; }
html[dir="rtl"] .ml-3 { margin-right: 0.75rem !important; margin-left: 0 !important; }
html[dir="rtl"] .ml-4 { margin-right: 1rem !important; margin-left: 0 !important; }
html[dir="rtl"] .ml-5 { margin-right: 1.25rem !important; margin-left: 0 !important; }
html[dir="rtl"] .ml-6 { margin-right: 1.5rem !important; margin-left: 0 !important; }
html[dir="rtl"] .ml-8 { margin-right: 2rem !important; margin-left: 0 !important; }
html[dir="rtl"] .ml-10 { margin-right: 2.5rem !important; margin-left: 0 !important; }
html[dir="rtl"] .ml-12 { margin-right: 3rem !important; margin-left: 0 !important; }

/* Swapping Toasts positions */
html[dir="rtl"] #toast-container {
    right: auto;
    left: 1.5rem;
}

@keyframes slideInLeft {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

html[dir="rtl"] .toast-slide-in {
    animation: slideInLeft 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

html[dir="rtl"] .modal-header button {
    order: -1;
}

/* ==================== README MARKDOWN VIEW STYLING ==================== */
.readme-markdown-view {
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.readme-markdown-view h1,
.readme-markdown-view h2,
.readme-markdown-view h3,
.readme-markdown-view h4 {
    color: white;
    font-weight: 700;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
    text-align: inherit;
}

.readme-markdown-view h1 { font-size: 1.25rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.35rem; }
.readme-markdown-view h2 { font-size: 1.1rem; }
.readme-markdown-view h3 { font-size: 0.95rem; }

.readme-markdown-view p {
    margin-bottom: 0.85rem;
    text-align: inherit;
}

.readme-markdown-view ul,
.readme-markdown-view ol {
    margin-bottom: 0.85rem;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}

.readme-markdown-view li {
    margin-bottom: 0.25rem;
}

.readme-markdown-view code {
    font-family: monospace;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    color: #e2e8f0;
    font-size: 0.8rem;
}

.readme-markdown-view pre {
    background-color: #030712; /* Slate-950 background */
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 1rem;
    overflow-x: auto;
    margin-bottom: 0.85rem;
}

.readme-markdown-view pre code {
    background-color: transparent;
    border: none;
    padding: 0;
    border-radius: 0;
    color: #cbd5e1;
    font-size: 0.8rem;
}

.readme-markdown-view blockquote {
    border-left: 4px solid var(--brand-indigo);
    background-color: rgba(99, 102, 241, 0.05);
    padding: 0.5rem 1rem;
    border-radius: 0 var(--border-radius-md) var(--border-radius-md) 0;
    margin-bottom: 0.85rem;
    color: #94a3b8;
}

html[dir="rtl"] .readme-markdown-view blockquote {
    border-left: none;
    border-right: 4px solid var(--brand-indigo);
    border-radius: var(--border-radius-md) 0 0 var(--border-radius-md);
}

.readme-markdown-view table {
    width: 100%;
    margin-bottom: 0.85rem;
    border-collapse: collapse;
}

.readme-markdown-view th,
.readme-markdown-view td {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    font-size: 0.8rem;
}

.readme-markdown-view th {
    background-color: rgba(3, 7, 18, 0.4);
    font-weight: 700;
}

.readme-markdown-view img {
    max-width: 100%;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 0.85rem;
}

/* ==================== NAVBAR LAYOUT & RTL ALIGNMENT FIXES ==================== */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    height: 4rem; /* matches dynamic header height */
    width: 100%;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo {
    text-decoration: none !important;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: bold;
}

.logo span {
    text-decoration: none !important;
}

.logo:hover, .logo:active, .logo:focus {
    text-decoration: none !important;
    color: inherit;
}

/* Prevent link wraps or overlaps in navbar actions */
.nav-link, .nav-actions a, .nav-actions span {
    white-space: nowrap !important;
    text-decoration: none !important;
}

/* ==================== FOOTER THEME OVERRIDES ==================== */
footer {
    background-color: var(--bg-secondary) !important;
    border-top: 1px solid var(--border-color) !important;
}

/* ==================== LIGHT THEME HARDCODED MAPPINGS ==================== */
:root[data-theme="light"] .bg-slate-950,
:root[data-theme="light"].bg-slate-950 {
    background-color: var(--bg-primary) !important;
}
:root[data-theme="light"] .bg-slate-900 {
    background-color: var(--bg-secondary) !important;
}
:root[data-theme="light"] .bg-slate-800 {
    background-color: var(--bg-tertiary) !important;
}
:root[data-theme="light"] .border-slate-800,
:root[data-theme="light"] .border-slate-900 {
    border-color: var(--border-color) !important;
}
:root[data-theme="light"] .text-slate-100,
:root[data-theme="light"] .text-slate-200,
:root[data-theme="light"].text-slate-100 {
    color: var(--text-primary) !important;
}
:root[data-theme="light"] .text-slate-300 {
    color: var(--text-secondary) !important;
}
:root[data-theme="light"] .text-slate-400 {
    color: var(--text-muted) !important;
}
:root[data-theme="light"] .text-white {
    color: var(--text-primary) !important;
}
:root[data-theme="light"] .logo.group .text-white {
    color: var(--text-primary) !important;
}
:root[data-theme="light"] .btn-primary {
    color: #ffffff !important; /* Keep primary buttons text white! */
}
:root[data-theme="light"] .btn-primary i {
    color: #ffffff !important;
}
:root[data-theme="light"] .badge-private {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-secondary) !important;
    border-color: var(--border-color) !important;
}
:root[data-theme="light"] .stat-card-info p.stat-value {
    color: var(--text-primary) !important;
}
:root[data-theme="light"] .centered-card h2 {
    color: var(--text-primary) !important;
}

/* ==================== CHIP/TAG INPUT COMPONENT ==================== */
.tag-input-container {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    align-items: center !important;
    min-height: 44px !important;
    padding: 6px 12px !important;
    height: auto !important;
    cursor: text !important;
}

.tag-input-container input {
    border: none !important;
    outline: none !important;
    background: transparent !important;
    color: var(--text-primary) !important;
    flex: 1 !important;
    min-width: 120px !important;
    padding: 0 !important;
    margin: 0 !important;
}

.tag-input-container:focus-within {
    border-color: var(--brand-indigo) !important;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15) !important;
    background-color: var(--input-bg-focus) !important;
}

.tag {
    display: inline-flex !important;
    align-items: center !important;
    background-color: var(--brand-indigo) !important;
    color: #ffffff !important;
    padding: 4px 10px !important;
    border-radius: 6px !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    gap: 6px !important;
    user-select: none !important;
}

.tag-remove {
    border: none !important;
    background: transparent !important;
    color: rgba(255, 255, 255, 0.75) !important;
    cursor: pointer !important;
    font-size: 0.75rem !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: color 0.15s ease !important;
}

.tag-remove:hover {
    color: #ffffff !important;
}

/* ==================== GLOBAL HEADING ACCENTS ==================== */
h1, .main-title {
    background: var(--title-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--text-primary);
}

h2, h3, h4, h5, h6 {
    color: var(--text-primary);
}




