/* Sleek Light Theme Custom Styles */
:root {
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #f1f5f9 100%);
    --card-bg: rgba(255, 255, 255, 0.75);
    --card-border: rgba(0, 0, 0, 0.08);
    --accent-primary: #4f46e5; /* Indigo 600 */
    --accent-hover: #4338ca; /* Indigo 700 */
    --accent-success: #059669; /* Emerald 600 */
    --text-primary: #0f172a; /* Slate 900 */
    --text-secondary: #475569; /* Slate 600 */
}

body {
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar Enhancements */
.navbar {
    background-color: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--card-border);
}

.navbar-brand {
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, #4f46e5, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-link {
    font-weight: 500;
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: var(--accent-primary) !important;
}

/* Main Container Layout */
main {
    flex: 1 0 auto;
}

/* Glassmorphic Cards */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* Stat card footer alignment */
    display: flex;
    flex-direction: column;
}

.glass-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 35px rgba(99, 102, 241, 0.12);
}

/* Smooth live-update transitions on stat numbers */
#stat-system-load,
#stat-active-sessions,
#stat-total-users,
#stat-db-size {
    transition: opacity 0.3s ease;
}

#stat-load-bar {
    transition: width 0.8s ease, background-color 0.4s ease;
}

/* Custom Django Form Control Overrides */
.form-container p {
    margin-bottom: 1.25rem;
}

.form-container label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-container input[type="text"],
.form-container input[type="password"],
.form-container input[type="email"],
.form-container select,
.form-container textarea {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.8);
    background-clip: padding-box;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out, background-color 0.2s ease-in-out;
}

.form-container input[type="text"]:focus,
.form-container input[type="password"]:focus,
.form-container input[type="email"]:focus,
.form-container select:focus,
.form-container textarea:focus {
    color: var(--text-primary);
    background-color: #fff;
    border-color: var(--accent-primary);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Form Helper Text and Errors */
.form-container .helptext {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.775rem;
    color: var(--text-secondary);
}

.form-container ul.errorlist {
    list-style: none;
    padding-left: 0;
    margin-bottom: 1rem;
    border-radius: 6px;
    background-color: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 0.5rem 1rem;
}

.form-container ul.errorlist li {
    font-size: 0.875rem;
    color: #dc2626;
}

/* Custom Buttons */
.btn-primary-custom {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    transition: all 0.2s ease-in-out;
}

.btn-primary-custom:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
    transform: translateY(-1px);
}

/* Dashboard Component Styles */
.stat-card {
    border-left: 4px solid var(--accent-primary);
}

.stat-card-success {
    border-left: 4px solid var(--accent-success);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
}

/* Table Custom Theme */
.table-custom {
    background: transparent;
    color: var(--text-primary);
}

.table-custom th {
    background-color: rgba(241, 245, 249, 0.75);
    color: var(--text-secondary);
    border-bottom: 2px solid var(--card-border);
}

.table-custom td {
    border-bottom: 1px solid var(--card-border);
    vertical-align: middle;
}

/* Custom Tab Highlight Theme */
.nav-tabs {
    border-bottom: 1px solid var(--card-border) !important;
}

.nav-tabs .nav-link {
    border: none !important;
    color: var(--text-secondary) !important;
    background: transparent !important;
    padding: 0.75rem 1rem !important;
    margin-right: 0.5rem;
    border-bottom: 2px solid transparent !important;
    transition: all 0.2s ease !important;
}

.nav-tabs .nav-link:hover {
    color: var(--accent-primary) !important;
    border-bottom-color: rgba(99, 102, 241, 0.3) !important;
}

.nav-tabs .nav-link.active {
    color: var(--accent-primary) !important;
    font-weight: 700 !important;
    border-bottom: 2px solid var(--accent-primary) !important;
}

/* Footer Styling */
footer {
    background-color: rgba(255, 255, 255, 0.8);
    border-top: 1px solid var(--card-border);
    padding: 1.5rem 0;
}

/* ════════════════════════════════════════════════════════════════
   MOBILE-FIRST RESPONSIVE ADDITIONS
   ════════════════════════════════════════════════════════════════ */

/* Body without navbar — no top padding wasted */
body.no-nav {
    padding-top: 0 !important;
}

/* Safe-area inset for notched phones (iPhone, etc.) */
@supports (padding: env(safe-area-inset-bottom)) {
    .rv-nav {
        padding-bottom: calc(1.4rem + env(safe-area-inset-bottom));
    }
}

/* Minimum tap/touch target everywhere */
button, a.btn, input[type="submit"] {
    min-height: 44px;
}

/* Make tables scroll horizontally on small screens */
.table-responsive {
    -webkit-overflow-scrolling: touch;
}

/* Admin stat cards — single column on phones */
@media (max-width: 575px) {
    .stat-card,
    .stat-card-success {
        margin-bottom: .5rem;
    }
    /* Gallery admin grid — 2 per row on phone */
    #gallery-grid .col-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    /* Reason-viewer nav — stretch buttons full width */
    .rv-nav {
        gap: .5rem;
        padding-left: .75rem;
        padding-right: .75rem;
    }
    .rv-btn { min-width: 80px; padding: .6rem 1rem; font-size: .85rem; }
}

/* Navbar brand text — always show on any size */
@media (max-width: 360px) {
    .navbar-brand span { display: inline !important; }
}

/* Gallery hero/reasons hero — reduce padding on phones */
/* Full‑page hero background */
.hero-section {
    min-height: 100vh !important;
    height: 100vh !important;
    background-attachment: fixed;
    background-size: cover;
}

@media (max-width: 575px) {
    .gallery-hero,
    .reasons-hero {
        padding: 2.5rem 0 2rem;
    }
    /* Hero section in home.html */
    .hero-section {
        padding: 3.5rem 0 3rem;
        min-height: 100vh !important;
        height: 100vh !important;
    }
}

/* Prevent long words breaking layout on small screens */
.rv-title, .rv-body, .hero-headline, h1, h2, h3 {
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Gallery masonry — adjust columns on very small screens */
@media (max-width: 400px) {
    .gallery-grid { columns: 1 !important; }
}

/* Auth page — full-width card on phone */
@media (max-width: 575px) {
    .auth-card, .card.glass-card {
        border-radius: 12px !important;
        margin: .5rem;
    }
}

/* Administration stats row — ensure equal heights on all sizes */
@media (max-width: 575px) {
    .stat-number { font-size: 2rem !important; }
}

/* Smooth scrolling site-wide */
html { scroll-behavior: smooth; }

/* iOS overscroll bounce colour */
html, body { background-color: #f8fafc; }
