/* --- 1. GLOBAL VARIABLES & RESET --- */
:root {
    --primary: #2563eb;       
    --seat-free: #28a745;     /* Green */
    --seat-active: #ffc107;   /* Yellow */
    --seat-expired: #dc3545;  /* Red */
    --dark: #212529;
    --white: #ffffff;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

* { box-sizing: border-box; }

body {
    /* Fast System Fonts */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    
    /* ✅ NEW: Radial Gradient Background */
    background: rgb(238,174,202);
    background: radial-gradient(circle, rgba(238,174,202,1) 0%, rgba(148,187,233,1) 100%);
    
    margin: 0;
    padding: 0;
    padding-bottom: 80px;
    color: #333;
    min-height: 100vh;
}

.container { max-width: 1200px; margin: 0 auto; padding: 20px; }

/* --- 2. HEADER --- */
header {
    text-align: center;
    padding: 15px;
    
    /* ✅ NEW: Header Gradient */
    background: rgb(34,193,195);
    background: linear-gradient(0deg, rgba(34,193,195,1) 0%, rgba(253,187,45,1) 100%);
    
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 3px solid rgba(0,0,0,0.1);
}

.app-logo { max-height: 75px; display: block; margin: 0 auto 10px; }
h1 { margin: 0; font-size: 24px; color: #fff; text-shadow: 1px 1px 3px rgba(0,0,0,0.3); font-weight: 700; }

/* --- 3. DASHBOARD HEAD (MENU FIX) --- */
.dash-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 25px;
    gap: 15px;
    
    /* ✅ FIX: Menu Z-Index Issue */
    position: relative;
    z-index: 50; 
}

/* --- 4. SEAT CARD (SEAT VIEW) --- */
.seat-card {
    /* ✅ NEW: Seat View Gradient */
    background: rgb(0,0,0);
    background: linear-gradient(0deg, rgba(0,0,0,1) 0%, rgba(148,187,233,1) 100%);
    
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 25px;
    border: 1px solid rgba(255,255,255,0.2);
    color: white; /* Text white taki dark bg pe dikhe */
    
    /* ✅ FIX: Lower z-index so menu stays on top */
    position: relative;
    z-index: 1;
}

/* Inputs inside Dark Seat Card need to be visible */
.seat-card input, .seat-card select {
    background: rgba(255, 255, 255, 0.9);
    color: #000;
    border: none;
}
.seat-card h3, .seat-card h4 {
    color: #fff !important;
    text-shadow: 1px 1px 2px black;
}
.seat-card .legend span {
    color: #000; /* Legend text black inside pills */
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

/* --- 5. BUS GRID & SEATS --- */
.bus-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.seat-box {
    border-radius: 10px;
    padding: 15px 5px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s;
    font-size: 13px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    color: #fff; /* Default text white */
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.2);
}
.seat-box:hover { transform: scale(1.08); z-index: 10; }
.seat-box b { font-size: 18px; display: block; margin-bottom: 5px; }

/* ✅ SEAT COLOR LOGIC (UNCHANGED) */
.seat-free { background-color: var(--seat-free) !important; color: white !important; }
.seat-active { background-color: var(--seat-active) !important; color: black !important; text-shadow: none; }
.seat-expired { background-color: var(--seat-expired) !important; color: white !important; }

/* --- 6. BUTTONS --- */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    color: #fff;
    margin: 5px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    box-shadow: 0 3px 6px rgba(0,0,0,0.2);
    transition: 0.3s;
}
.btn:hover { transform: translateY(-2px); opacity: 0.9; }

.btn-op { background: #007bff; }
.btn-stu { background: #6c757d; }
.btn-reg { background: #28a745; }
.btn-adm { background: #dc3545; }
.btn-act { background: #17a2b8; padding: 6px 12px; font-size: 12px; border-radius: 5px; }
.btn-del { background: #dc3545; padding: 6px 12px; font-size: 12px; border-radius: 5px; }

/* --- 7. FORMS --- */
.form-box {
    max-width: 450px;
    margin: 40px auto;
    padding: 30px;
    background: linear-gradient(0deg, rgba(34, 193, 195, 1) 0%, rgba(253, 187, 45, 1) 100%);
    border-radius: 15px;
    display: none;
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
    animation: slideUp 0.4s ease;
}
input, select, textarea {
    width: 100%; padding: 12px; margin: 8px 0; border: 1px solid #ccc;
    border-radius: 6px; font-size: 14px;
}

/* --- 8. MATRIX TABLE (FIXED BORDER & COLORS) --- */
.matrix-tbl {
    width: 100%;
    border-collapse: collapse; /* Lines joined */
    font-size: 13px;
    margin-top: 10px;
    background: #fff;
    color: #000;
}

/* ✅ Border Logic Added */
.matrix-tbl th, .matrix-tbl td {
    border: 1px solid #000; /* Black Border */
    padding: 8px;
    text-align: center;
}

.matrix-tbl th { background: #343a40; color: #fff; }

/* ✅ Matrix Colors */
.bg-red { background-color: #f8d7da !important; font-weight: bold; color: #721c24; }
.bg-yel { background-color: #fff3cd !important; font-weight: bold; color: #856404; }
.bg-grn { background-color: #d4edda !important; font-weight: bold; color: #155724; cursor: pointer; }

/* --- 9. MODALS --- */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgb(143 73 73 / 60%);
    backdrop-filter: blur(4px);
    overflow-y: auto;
    padding: 20px 0;
}
.modal-content {
    background-color:#2a2b9bbf;
    margin: 20px auto;
    padding: 25px;
    border-radius: 12px;
    width: 95%;
    max-width: 600px;
    position: relative;
    color: #333;
}

/* --- 10. UTILS & FOOTER --- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hidden { display: none !important; }
.legend span { display: inline-block; margin-right: 10px; padding: 4px 8px; border-radius: 4px; font-weight: bold; background: white; }

.app-footer {
    position: fixed; bottom: 0; left: 0; width: 100%; z-index: 9999;
    display: flex; flex-direction: column; box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
}
.footer-marquee { width: 100%; background: #212529; color: #fff; font-size: 13px; padding: 6px 0; }
.footer-copyright { width: 100%; background: #000; color: #ccc; padding: 8px; font-size: 12px; text-align: center; }
.footer-copyright p { margin: 0; }

@keyframes slideUp { from { transform: translateY(50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Print & Mobile */
@media print { .btn, button, .no-print, header, .app-footer, .dash-head { display: none !important; } body { background: #fff; } .modal-content { box-shadow: none; border: none; width: 100%; margin: 0; } }
@media (max-width: 768px) { .dash-head { flex-direction: column; align-items: stretch; } .btn { width: 100%; margin: 5px 0; } .bus-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); } .form-grid { grid-template-columns: 1fr; } }