/* --- 1. CONFIG --- */
:root {
    --font-main: 'Inter', system-ui, sans-serif;
    --bg-body: #f8fafc; --bg-card: #ffffff; --bg-sidebar: #0f172a;
    --text-main: #334155; --text-muted: #64748b; --text-sidebar: #cbd5e1;
    --border-color: #e2e8f0; --input-bg: #ffffff;
    --primary: #ea5b25; --danger: #ef4444; --success: #22c55e; --warning: #f59e0b;
    --radius-md: 12px; --radius-sm: 8px;
}
[data-theme="dark"] { --bg-body: #020617; --bg-card: #1e293b; --bg-sidebar: #0f172a; --text-main: #f1f5f9; --border-color: #334155; --input-bg: #0f172a; }

/* --- 2. LAYOUT --- */
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font-main); background: var(--bg-body); color: var(--text-main); min-height: 100vh; }
a { text-decoration: none; color: inherit; }
body:has(.sidebar) { display: flex; height: 100vh; overflow: hidden; }

/* --- 3. SIDEBAR --- */
.sidebar { width: 280px; background: var(--bg-sidebar); color: var(--text-sidebar); display: flex; flex-direction: column; height: 100vh; flex-shrink: 0; z-index: 1000; }
.brand { padding: 25px; font-size: 1.5rem; font-weight: 800; color: white; display: flex; align-items: center; gap: 10px; }
.brand i { color: var(--primary); }
.menu { list-style: none; padding: 0 15px; margin-top: 10px; overflow-y: auto; flex:1; }
.menu li { margin-bottom: 5px; }
.menu li a { display: flex; align-items: center; gap: 12px; padding: 12px 15px; color: var(--text-sidebar); border-radius: var(--radius-sm); margin-bottom: 5px; transition: 0.2s; }
.menu li a:hover, .menu li a.active { background: var(--primary); color: white; }
.theme-switch-wrapper { padding: 20px; border-top: 1px solid rgba(255,255,255,0.1); }
.theme-btn { width: 100%; padding: 10px; background: rgba(255,255,255,0.1); color: #ccc; border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; cursor: pointer; display: flex; justify-content: center; gap: 10px; }

/* --- 4. MAIN CONTENT --- */
.main-content { flex-grow: 1; overflow-y: auto; display: flex; flex-direction: column; background: var(--bg-body); position: relative; width: 100%; }
.header { background: var(--bg-card); padding: 15px 30px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 500; }
.container { padding: 30px; max-width: 1400px; margin: 0 auto; width: 100%; }

/* --- 5. CARDS & FORMS --- */
.card, .form-section { background: var(--bg-card); padding: 25px; border-radius: var(--radius-md); box-shadow: 0 1px 3px rgba(0,0,0,0.1); margin-bottom: 25px; }
.form-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 20px; padding-bottom: 10px; border-bottom: 1px solid var(--border-color); }
.row { display: flex; flex-wrap: wrap; margin: 0 -10px 15px; }
.col { flex: 1; padding: 0 10px; min-width: 250px; margin-bottom: 15px; }
.col-small { flex: 0 0 140px; padding: 0 10px; margin-bottom: 15px; }
label { display: block; font-size: 0.85rem; margin-bottom: 5px; font-weight: 600; color: var(--text-muted); }
input, select, textarea { width: 100%; padding: 10px; background: var(--input-bg); border: 1px solid var(--border-color); border-radius: var(--radius-sm); color: var(--text-main); }
.hidden-file-input { display: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; padding: 10px 20px; border-radius: var(--radius-sm); font-weight: 600; border: none; cursor: pointer; gap: 8px; text-decoration: none; font-size: 0.9rem; }
.btn-primary { background: var(--bg-sidebar); color: white; }
.btn-accent { background: var(--primary); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-secondary { background: var(--bg-body); color: var(--text-main); border: 1px solid var(--border-color); }
.badge { padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; color: white; }
.status-approved { background: var(--success); }
.status-pending { background: #fee2e2; color: #991b1b; }

/* --- 6. DATA TABLES (DESKTOP) --- */
.data-table-wrapper { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px 15px; text-align: left; border-bottom: 1px solid var(--border-color); }
.data-table th { background-color: var(--bg-body); font-weight: 600; color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; }
.data-table tr:hover { background-color: rgba(0,0,0,0.02); }

/* --- 7. MOBILE RESPONSIVE --- */
.mobile-toggle, .mobile-overlay { display: none; }
@media (max-width: 768px) {
    body:has(.sidebar) { display: block; height: auto; overflow: auto; }
    .sidebar { position: fixed; top: 0; left: -100%; height: 100vh; transition: 0.3s; box-shadow: 2px 0 10px rgba(0,0,0,0.5); }
    .sidebar.active { left: 0; }
    .mobile-toggle { display: block; background: none; border: none; font-size: 1.5rem; color: var(--text-main); }
    .mobile-overlay { display: none; position: fixed; top:0; left:0; width:100%; height:100%; background: rgba(0,0,0,0.5); z-index: 999; }
    .mobile-overlay.active { display: block; }
    .container { padding: 15px; }
    .row { display: block; }
    .col, .col-small { width: 100%; }
    
    .data-table thead { display: none; }
    .data-table tr { display: block; margin-bottom: 15px; border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 15px; background: var(--bg-card); }
    .data-table td { display: flex; justify-content: space-between; border: none; padding: 8px 0; text-align: right; border-bottom: 1px solid var(--border-color); }
    .data-table td:last-child { border-bottom: none; }
    .data-table td::before { content: attr(data-label); font-weight: 700; text-align: left; opacity: 0.7; }
}

/* --- 8. MODALS & CROPPER --- */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.9); display: none; justify-content: center; align-items: center; z-index: 3000 !important; backdrop-filter: blur(5px); }
.modal-content { background: var(--bg-card); padding: 20px; border-radius: var(--radius-md); width: 95%; max-width: 500px; max-height: 90vh; display: flex; flex-direction: column; z-index: 3001; }
.crop-container { flex-grow: 1; background: #000; max-height: 60vh; overflow: hidden; margin: 15px 0; border-radius: 8px; display: flex; justify-content: center; align-items: center; }
#imageToCrop { max-width: 100%; max-height: 100%; display: block; }
.modal-actions { margin-top: auto; text-align: right; padding-top: 10px; border-top: 1px solid var(--border-color); }

/* --- 9. LOGIN PAGE --- */
body.login-body {
    /* Background Image is now handled in index.php for Cache Busting */
    background-color: #0b1525;
    
    /* Global Background Settings */
    background-size: cover;       
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;

    /* Desktop Layout */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
    padding: 15px;
    position: relative;
}

/* --- LOGO STYLES --- */
.logo-container {
    text-align: center;
    margin-bottom: 20px; /* Reduced margin slightly to pull content up */
    z-index: 20;
    width: 100%;
    animation: fadeInUp 1.2s ease-out forwards;
    opacity: 0; 
    transform: translateY(20px);
}

.hindi-logo {
    height: 140px; 
    width: auto;
    max-width: 90%;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.4));
    transition: transform 0.3s ease;
}

/* --- LOGIN CARD --- */
.login-card {
    background: rgba(0, 0, 0, 0.5); 
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 30px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.6);
    z-index: 10;
    animation: fadeInUp 1.2s ease-out 0.3s forwards;
    opacity: 0;
    transform: translateY(20px);
}

/* --- INPUTS & BUTTONS --- */
.login-card label {
    color: #e2e8f0;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 6px;
    display: block;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.input-group { position: relative; margin-bottom: 20px; }

.login-card input {
    width: 100%;
    background: #ffffff;
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 12px 15px;
    color: #333;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.login-card input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(234, 91, 37, 0.3);
    transform: scale(1.02);
}

.toggle-password {
    position: absolute; right: 15px; top: 50%;
    transform: translateY(-50%); cursor: pointer;
    color: #64748b; z-index: 5;
}

.btn-login {
    width: 100%; padding: 14px;
    font-size: 1rem; font-weight: 700;
    text-transform: uppercase;
    border: none; border-radius: 8px;
    background: linear-gradient(135deg, var(--primary) 0%, #d94e1d 100%);
    color: white; cursor: pointer;
    box-shadow: 0 4px 15px rgba(234, 91, 37, 0.4);
    transition: transform 0.2s;
}
.btn-login:hover { transform: translateY(-2px); }

@keyframes fadeInUp { to { opacity: 1; transform: translateY(0); } }


/* --- MOBILE SPECIFIC SETTINGS --- */
@media (max-width: 768px) {
    body.login-body {
        /* Background Image logic is handled in index.php head */
    }

    .hindi-logo {
        height: 90px; 
        margin-bottom: 10px; /* Tighter margin for mobile */
    }

    .login-card {
        padding: 25px 20px;
        background: rgba(0, 0, 0, 0.45); /* Slight opacity tweak */
    }

    /* Prevent iOS Zoom */
    .login-card input { font-size: 16px !important; }
}

/* --- 10. PRINT --- */
@media print {
    .sidebar, .header, .mobile-toggle, .mobile-overlay, .theme-switch-wrapper, .btn, .form-section, form, .wizard-nav { display: none !important; }
    body, .main-content { margin: 0; padding: 0; width: 100%; height: auto; overflow: visible; background: white; color: black; display: block; }
    .container { padding: 0; max-width: 100%; }
    .card { border: none; box-shadow: none; padding: 0; margin: 0; }
    table { width: 100% !important; border-collapse: collapse; }
    th, td { border: 1px solid #000 !important; padding: 8px !important; color: #000 !important; }
}

/* =========================================
   11. WIZARD & ACTIONS (FIXED VISIBILITY)
   ========================================= */
/* Desktop Defaults: Show Actions, Hide Wizard */
.desktop-actions { display: block; margin-top: 20px; text-align: right; }
.wizard-nav { display: none; }

/* Mobile Overrides: Hide Actions, Show Wizard */
@media (max-width: 768px) {
    .desktop-actions { display: none; }
    
    .wizard-nav {
        display: flex;
        justify-content: space-between;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        background: var(--bg-card);
        padding: 15px;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 99;
        border-top: 1px solid var(--border-color);
    }
    
    /* Add padding so content isn't hidden behind wizard bar */
    .main-content { padding-bottom: 80px; }
}