/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

:root {
    --bg-dark: #09090b;
    --card-bg: rgba(24, 24, 27, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.5);
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.5);
    --success: #22c55e;
    --success-glow: rgba(34, 197, 94, 0.5);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

body {
    background-color: var(--bg-dark);
    /* Subtle radial gradient background */
    background-image: radial-gradient(circle at top right, rgba(99, 102, 241, 0.15), transparent 40%),
                      radial-gradient(circle at bottom left, rgba(239, 68, 68, 0.1), transparent 40%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 2rem;
}

.container {
    width: 100%;
    max-width: 1200px;
}

/* Header Styles */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
    margin-bottom: 0.25rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 300;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Glassmorphism Panel Base */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Dashboard Stats Section */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.2);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(255,255,255,0.05);
}

.total-icon { background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(99,102,241,0.05)); border: 1px solid rgba(99,102,241,0.3); }
.occupied-icon { background: linear-gradient(135deg, rgba(239,68,68,0.2), rgba(239,68,68,0.05)); border: 1px solid rgba(239,68,68,0.3); }
.free-icon { background: linear-gradient(135deg, rgba(34,197,94,0.2), rgba(34,197,94,0.05)); border: 1px solid rgba(34,197,94,0.3); }
.earnings-icon { background: linear-gradient(135deg, rgba(234,179,8,0.2), rgba(234,179,8,0.05)); border: 1px solid rgba(234,179,8,0.3); }

.stat-info h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-bottom: 0.2rem;
}

.stat-info p {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
}

.earnings-card .stat-info p {
    background: linear-gradient(135deg, #fde047, #eab308);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Forms Section */
.forms-container {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 3rem;
}

.entry-form-container {
    flex: 1;
    min-width: 300px;
    padding: 2rem;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 2rem;
}

.neon-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.neon-dot.green { background: var(--success); box-shadow: 0 0 10px var(--success-glow); }
.neon-dot.red { background: var(--danger); box-shadow: 0 0 10px var(--danger-glow); }

.panel-header h2 {
    font-size: 1.4rem;
    font-weight: 600;
}

#entryForm, #exitForm {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    flex: 1;
    justify-content: space-between;
}

.input-group {
    position: relative;
    display: flex;
    flex-direction: column;
}

.input-group.full-width {
    width: 100%;
}

input, select {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

input::placeholder {
    color: #52525b;
}

input:focus, select:focus {
    border-color: rgba(99, 102, 241, 0.5);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
}

select option {
    background: var(--bg-dark);
    color: var(--text-main);
}

/* Buttons */
.primary-btn {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
    border: none;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--primary-glow);
    position: relative;
    overflow: hidden;
}

.primary-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0) 100%);
    transform: rotate(45deg);
    transition: all 0.3s ease;
    opacity: 0;
}

.primary-btn:hover::after {
    animation: shine 1.5s infinite;
    opacity: 1;
}

@keyframes shine {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

.danger-btn {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 4px 15px var(--danger-glow);
}
.danger-btn:hover {
    box-shadow: 0 6px 20px var(--danger-glow);
}

/* Slots Section */
.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title::before {
    content: '';
    display: block;
    width: 4px;
    height: 20px;
    background: var(--primary);
    border-radius: 2px;
}

/* Live Parking Map Section */
.map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.map-legend {
    display: flex;
    gap: 1.5rem;
    padding: 0.8rem 1.5rem;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 1px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* ============================================================
   REALISTIC PARKING LOT
============================================================ */

/* Outer lot wrapper */
.parking-lot {
    background: #0d0d10;
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 20px;
    padding: 1.25rem 1rem;
    margin-bottom: 3rem;
    position: relative;
    overflow: hidden;
}

/* Subtle asphalt texture overlay */
.parking-lot::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 80%, rgba(99,102,241,0.04) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(239,68,68,0.04) 0%, transparent 50%);
    pointer-events: none;
    border-radius: 20px;
}

/* Entrance banner */
.lot-entrance {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
    padding: 0.5rem 1rem;
    background: rgba(99,102,241,0.08);
    border: 1px solid rgba(99,102,241,0.2);
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(165,180,252,0.8);
}

.lot-entrance-arrow {
    font-size: 1rem;
    animation: bounceDown 1.5s infinite ease-in-out;
}

@keyframes bounceDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
}

/* Row container (Row A, Row B, etc.) */
.lot-row-group {
    margin-bottom: 0.5rem;
}

.lot-row-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.2);
    margin-bottom: 0.5rem;
    padding-left: 0.25rem;
}

.lot-row-slots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.6rem;
}

/* Driving lane between rows */
.lot-lane {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 0;
    margin: 0.25rem 0;
}

.lot-lane-line {
    flex: 1;
    height: 2px;
    background: repeating-linear-gradient(
        90deg,
        rgba(250,204,21,0.35) 0px,
        rgba(250,204,21,0.35) 18px,
        transparent 18px,
        transparent 36px
    );
    border-radius: 2px;
}

.lot-lane-label {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: rgba(250,204,21,0.4);
    white-space: nowrap;
    text-transform: uppercase;
}

/* Legacy .parking-map alias so JS still works */
.parking-map {
    display: contents;
}

/* ============================================================
   PARKING BAY (map-slot)
============================================================ */
.map-slot {
    background: linear-gradient(180deg, rgba(20,20,28,0.95) 0%, rgba(12,12,18,0.98) 100%);
    border-top: none;
    border-bottom: none;
    /* Painted bay lines on left & right */
    border-left: 3px solid rgba(255,255,255,0.12);
    border-right: 3px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    aspect-ratio: 2.2 / 4;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0.75rem 0.6rem 0.65rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    cursor: default;
}

/* Top kerb line */
.map-slot::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    border-radius: 8px 8px 0 0;
    background: rgba(255,255,255,0.07);
}

/* Bottom kerb line */
.map-slot::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    border-radius: 0 0 8px 8px;
    background: rgba(255,255,255,0.05);
}

.map-slot:hover {
    transform: translateY(-3px) scale(1.02);
}

/* Big watermark slot ID */
.slot-id-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -52%);
    font-size: 4.5rem;
    font-weight: 900;
    color: rgba(255,255,255,0.04);
    z-index: 0;
    pointer-events: none;
    letter-spacing: -2px;
    user-select: none;
}

/* ── Slot Top Row ── */
.slot-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1;
}

.slot-id {
    font-size: 0.85rem;
    font-weight: 800;
    color: rgba(255,255,255,0.9);
    letter-spacing: 0.5px;
}

.slot-distance {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.3);
    font-weight: 600;
    background: rgba(255,255,255,0.06);
    padding: 2px 6px;
    border-radius: 20px;
}

/* ── Center ── */
.slot-center {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1;
    flex-direction: column;
    gap: 0.3rem;
}

/* Free: big P symbol */
.slot-p-symbol {
    font-size: 3rem;
    font-weight: 900;
    color: rgba(34,197,94,0.18);
    line-height: 1;
    font-family: 'Outfit', sans-serif;
    letter-spacing: -2px;
    user-select: none;
    transition: color 0.3s ease;
}

.slot-free:hover .slot-p-symbol {
    color: rgba(34,197,94,0.35);
}

/* Occupied: vehicle emoji */
.vehicle-emoji {
    font-size: 2.8rem;
    filter: drop-shadow(0 6px 12px rgba(0,0,0,0.6));
    animation: parkIn 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: block;
}

@keyframes parkIn {
    0%   { transform: scale(0.4) translateY(30px); opacity: 0; }
    100% { transform: scale(1)   translateY(0);    opacity: 1; }
}

/* ── Bottom Info ── */
.slot-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    z-index: 1;
}

.slot-label {
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

/* Number plate style */
.vehicle-no-label {
    font-size: 0.62rem;
    font-weight: 700;
    color: #1a1a1a;
    background: linear-gradient(135deg, #fde047, #facc15);
    padding: 2px 7px;
    border-radius: 3px;
    letter-spacing: 0.5px;
    border: 1px solid rgba(0,0,0,0.2);
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
    margin-top: 1px;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.slot-timer {
    font-size: 0.62rem;
    font-family: 'Courier New', monospace;
    color: rgba(226,232,240,0.85);
    background: rgba(0,0,0,0.55);
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

/* ── FREE state ── */
.slot-free {
    border-left-color:  rgba(34,197,94,0.35);
    border-right-color: rgba(34,197,94,0.35);
    box-shadow:
        inset 0 0 30px rgba(34,197,94,0.06),
        0 0 0 1px rgba(34,197,94,0.15);
    animation: breathe-green 3s infinite alternate ease-in-out;
}
.slot-free .slot-label { color: var(--success); }

/* ── OCCUPIED state ── */
.slot-occupied {
    border-left-color:  rgba(239,68,68,0.5);
    border-right-color: rgba(239,68,68,0.5);
    background: linear-gradient(180deg, rgba(30,10,10,0.97) 0%, rgba(18,6,6,0.99) 100%);
    box-shadow:
        inset 0 0 40px rgba(239,68,68,0.12),
        0 0 0 1px rgba(239,68,68,0.25);
    animation: pulse-red 2s infinite alternate ease-in-out;
}
.slot-occupied .slot-label { color: var(--danger); }

/* ── Animations ── */
@keyframes breathe-green {
    0%   { box-shadow: inset 0 0 15px rgba(34,197,94,0.04), 0 0 0 1px rgba(34,197,94,0.1);  border-color: rgba(34,197,94,0.2); }
    100% { box-shadow: inset 0 0 35px rgba(34,197,94,0.18), 0 0 12px rgba(34,197,94,0.25); border-color: rgba(34,197,94,0.65); }
}

@keyframes pulse-red {
    0%   { box-shadow: inset 0 0 20px rgba(239,68,68,0.08), 0 0 0 1px rgba(239,68,68,0.2); border-color: rgba(239,68,68,0.3); }
    100% { box-shadow: inset 0 0 50px rgba(239,68,68,0.25), 0 0 16px rgba(239,68,68,0.4); border-color: rgba(239,68,68,0.85); }
}

.breath-anim { animation: breathe-green 3s infinite alternate ease-in-out; }
.pulse-anim  { animation: pulse-red 2s infinite alternate ease-in-out; }

/* Activity Table */
.table-container {
    overflow-x: auto;
    border-radius: 16px;
    padding: 1px; /* for the gradient border effect if wanted */
}

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

th {
    padding: 1.2rem 1.5rem;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--glass-border);
}

td {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.02);
    color: #e2e8f0;
    font-size: 0.95rem;
}

tr:last-child td {
    border-bottom: none;
}

tbody tr {
    transition: background-color 0.2s ease;
}

tbody tr:hover {
    background-color: rgba(255,255,255,0.03);
}

.action-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.action-entry { background: rgba(34,197,94,0.15); color: var(--success); }
.action-exit { background: rgba(239,68,68,0.15); color: var(--danger); }

/* Utility Classes */
.hidden {
    display: none !important;
}

#formMessage, #exitFormMessage {
    margin-top: 1.5rem;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.success-msg {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.error-msg {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 2rem;
}

/* Loader */
#loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 3rem 0;
    color: var(--text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   RESPONSIVE BASE — prevent ALL horizontal overflow
============================================================ */
html, body {
    overflow-x: hidden;
    width: 100%;
}

* {
    box-sizing: border-box;
}

/* ============================================================
   TABLET  (max 900px)
============================================================ */
@media (max-width: 900px) {
    body {
        padding: 1.25rem;
    }

    .header-content h1 {
        font-size: 1.9rem;
    }

    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .parking-map {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

/* ============================================================
   MOBILE  (max 640px)
============================================================ */
@media (max-width: 640px) {

    /* ---- Body & Container ---- */
    body {
        padding: 0.75rem;
        align-items: flex-start;
    }

    .container {
        width: 100%;
        padding: 0;
    }

    /* ---- Header ---- */
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .header-content h1 {
        font-size: 1.35rem;
        line-height: 1.3;
        letter-spacing: -0.3px;
    }

    .subtitle {
        font-size: 0.7rem;
        letter-spacing: 0.5px;
    }

    #loadSlotsBtn {
        width: 100%;
        padding: 12px;
        font-size: 0.9rem;
    }

    /* ---- Stats — 2 columns on mobile ---- */
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }

    .stat-card {
        padding: 1rem 0.85rem;
        gap: 0.75rem;
        border-radius: 14px;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        flex-shrink: 0;
    }

    .stat-info h3 {
        font-size: 0.72rem;
    }

    .stat-info p {
        font-size: 1.4rem;
    }

    /* ---- Forms — stacked, full width ---- */
    .forms-container {
        flex-direction: column;
        gap: 1rem;
        margin-bottom: 2rem;
    }

    .entry-form-container {
        min-width: unset;
        width: 100%;
        padding: 1.25rem;
        border-radius: 16px;
    }

    .panel-header {
        margin-bottom: 1.25rem;
    }

    .panel-header h2 {
        font-size: 1.1rem;
    }

    #entryForm, #exitForm {
        gap: 0.85rem;
    }

    input, select {
        padding: 13px 14px;
        font-size: 0.95rem;
        border-radius: 10px;
    }

    .primary-btn,
    .submit-btn {
        width: 100%;
        padding: 13px;
        font-size: 0.95rem;
        border-radius: 10px;
    }

    /* ---- Section Titles ---- */
    .section-title {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }

    /* ---- Parking Map ---- */
    .map-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    .map-legend {
        padding: 0.5rem 0.85rem;
        font-size: 0.75rem;
        gap: 0.85rem;
    }

    .parking-map {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.6rem;
        padding: 0.75rem;
        margin-bottom: 2rem;
        border-radius: 14px;
    }

    .map-slot {
        aspect-ratio: 3 / 4;
        padding: 0.5rem;
        border-radius: 10px;
    }

    .slot-id-bg {
        font-size: 3rem;
    }

    .slot-id {
        font-size: 0.8rem;
        padding: 2px 6px;
    }

    .slot-distance {
        font-size: 0.6rem;
        padding: 1px 4px;
    }

    .vehicle-emoji {
        font-size: 2rem;
    }

    .slot-label {
        font-size: 0.6rem;
        letter-spacing: 0.5px;
    }

    .slot-timer {
        font-size: 0.6rem;
        padding: 1px 5px;
    }

    .vehicle-no-label {
        font-size: 0.58rem;
        padding: 1px 4px;
    }

    /* ---- Realistic Parking Lot (mobile) ---- */
    .parking-lot {
        padding: 0.85rem 0.65rem;
        border-radius: 14px;
        margin-bottom: 1.5rem;
    }

    .lot-entrance {
        font-size: 0.65rem;
        letter-spacing: 1.5px;
        padding: 0.4rem 0.75rem;
        margin-bottom: 0.75rem;
    }

    .lot-row-label {
        font-size: 0.6rem;
        margin-bottom: 0.4rem;
    }

    .lot-row-slots {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.45rem;
    }

    .map-slot {
        aspect-ratio: 2 / 4;
        padding: 0.5rem 0.4rem 0.5rem;
        border-radius: 6px;
        border-left-width: 2px;
        border-right-width: 2px;
    }

    .slot-id-bg {
        font-size: 2.8rem;
    }

    .slot-id {
        font-size: 0.72rem;
    }

    .slot-distance {
        font-size: 0.55rem;
        padding: 1px 4px;
    }

    .slot-p-symbol {
        font-size: 2.2rem;
    }

    .vehicle-emoji {
        font-size: 1.8rem;
    }

    .slot-label {
        font-size: 0.52rem;
        letter-spacing: 1px;
    }

    .slot-timer {
        font-size: 0.52rem;
        padding: 1px 5px;
    }

    .vehicle-no-label {
        font-size: 0.5rem;
        padding: 1px 4px;
        border-radius: 2px;
    }

    .lot-lane {
        padding: 0.3rem 0;
        gap: 0.5rem;
    }

    .lot-lane-label {
        font-size: 0.55rem;
        letter-spacing: 1.5px;
    }


    .activity-section {
        margin-bottom: 2rem;
    }

    /* Hide the standard table on mobile */
    .table-container {
        overflow-x: hidden;
        border-radius: 14px;
        padding: 0;
    }

    table {
        display: none; /* Hide table on mobile */
    }

    /* Card list injected by mobile-cards div */
    .mobile-activity-cards {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.75rem;
    }

    .mobile-activity-card {
        background: rgba(255,255,255,0.03);
        border: 1px solid var(--glass-border);
        border-radius: 12px;
        padding: 1rem;
        display: flex;
        flex-direction: column;
        gap: 0.6rem;
    }

    .mobile-card-top {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .mobile-card-vehicle {
        font-size: 1rem;
        font-weight: 700;
        color: var(--text-main);
    }

    .mobile-card-row {
        display: flex;
        justify-content: space-between;
        font-size: 0.82rem;
        color: var(--text-muted);
    }

    .mobile-card-row span:last-child {
        color: var(--text-main);
        font-weight: 500;
    }

    .mobile-card-actions {
        display: flex;
        justify-content: flex-end;
        margin-top: 0.25rem;
    }

    .pay-row-btn {
        padding: 8px 16px;
        font-size: 0.82rem;
        border-radius: 8px;
    }

    /* ---- Payment Modal ---- */
    .payment-modal-overlay {
        padding: 0.75rem;
        align-items: flex-end; /* slides up from bottom on mobile */
    }

    .payment-modal-card {
        max-width: 100%;
        padding: 1.5rem 1.25rem;
        border-radius: 20px 20px 16px 16px;
        gap: 1.2rem;
    }

    .payment-modal-header h2 {
        font-size: 1.2rem;
    }

    .bill-row {
        padding: 0.75rem 1rem;
    }

    .bill-label {
        font-size: 0.82rem;
    }

    .bill-value {
        font-size: 0.88rem;
    }

    .bill-total-amount {
        font-size: 1.25rem;
    }

    .pay-now-btn {
        padding: 14px;
        font-size: 1rem;
    }
}

/* ============================================================
   SMALL PHONES (max 380px)
============================================================ */
@media (max-width: 380px) {
    .header-content h1 {
        font-size: 1.15rem;
    }

    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.6rem;
    }

    .stat-info p {
        font-size: 1.2rem;
    }

    .stat-info h3 {
        font-size: 0.65rem;
    }

    .lot-row-slots {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.4rem;
    }

    .vehicle-emoji {
        font-size: 1.5rem;
    }

    .slot-p-symbol {
        font-size: 1.8rem;
    }
}


/* ============================================================
   PAYMENT MODAL STYLES
   Glassmorphism overlay + card with bill summary
============================================================ */

.payment-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeInOverlay 0.25s ease;
}

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

.payment-modal-overlay.hidden {
    display: none;
}

.payment-modal-card {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem 2rem;
    border-radius: 24px;
    animation: slideUpCard 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@keyframes slideUpCard {
    from { transform: translateY(60px) scale(0.95); opacity: 0; }
    to   { transform: translateY(0)     scale(1);    opacity: 1; }
}

.payment-modal-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.payment-icon {
    font-size: 2rem;
}

.payment-modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Bill Summary Rows */
.payment-bill-summary {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    overflow: hidden;
}

.bill-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--glass-border);
}

.bill-row:last-child {
    border-bottom: none;
}

.bill-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.bill-value {
    font-size: 0.95rem;
    color: var(--text-main);
    font-weight: 600;
}

.bill-total-row {
    background: rgba(99, 102, 241, 0.08);
}

.bill-total-amount {
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fde047, #eab308);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Action Buttons */
.payment-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.pay-now-btn {
    width: 100%;
    font-size: 1.1rem;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.4);
}

.pay-now-btn:hover {
    background: linear-gradient(135deg, #16a34a, #15803d);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(34, 197, 94, 0.5);
}

.cancel-pay-btn {
    width: 100%;
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    font-family: 'Outfit', sans-serif;
    transition: all 0.3s ease;
}

.cancel-pay-btn:hover {
    border-color: rgba(239, 68, 68, 0.5);
    color: var(--danger);
}

/* Pay button loading spinner */
.pay-spinner {
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Payment Status Message */
.payment-status-msg {
    text-align: center;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    animation: fadeInOverlay 0.3s ease;
}

.payment-status-msg.success-msg {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: var(--success);
}

.payment-status-msg.error-msg {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: var(--danger);
}

/* Payment Success Celebration Animation */
@keyframes successPop {
    0%   { transform: scale(0.8); opacity: 0; }
    60%  { transform: scale(1.1); }
    100% { transform: scale(1);   opacity: 1; }
}

.payment-success-anim {
    animation: successPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* ============================================================
   PAY & EXIT BUTTON (inside activity table rows)
============================================================ */
.pay-row-btn {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.25s ease;
    box-shadow: 0 2px 10px rgba(34, 197, 94, 0.35);
    letter-spacing: 0.3px;
}

.pay-row-btn:hover {
    background: linear-gradient(135deg, #16a34a, #15803d);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.5);
}

.pay-row-btn:disabled {
    background: rgba(255,255,255,0.08);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Desktop: hide mobile cards */
.mobile-activity-cards {
    display: none;
}


/* Tablet & Mobile Screens (Max Width: 768px) */
@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
        gap: 1.5rem;
    }

    .header-content h1 {
        font-size: 2rem;
    }

    .forms-container {
        flex-direction: column;
        gap: 1.5rem;
    }

    .entry-form-container {
        padding: 1.5rem;
    }

    .dashboard-stats {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 1rem;
    }

    .slot-card {
        padding: 1.5rem;
    }

    /* Enable horizontal scroll on the table container on smaller screens */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        display: block;
    }

    table {
        min-width: 600px; /* Ensure table forces a scrollbar if the screen is too small */
    }
}

/* Small Mobile Screens (Max Width: 480px) */
@media (max-width: 480px) {
    .header-content h1 {
        font-size: 1.6rem;
    }

    .dashboard-stats {
        /* Stack vertically on very small screens */
        grid-template-columns: 1fr;
    }

    .slots-grid {
        /* Force slots to stack completely to prevent horizontal scrolling */
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stat-card {
        padding: 1.2rem;
    }

    .primary-btn {
        width: 100%;
        text-align: center;
        padding: 12px 20px;
    }

    .section-title {
        font-size: 1.3rem;
    }
}

/* ============================================================
   PAYMENT MODAL STYLES
   Glassmorphism overlay + card with bill summary
============================================================ */

.payment-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeInOverlay 0.25s ease;
}

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

.payment-modal-overlay.hidden {
    display: none;
}

.payment-modal-card {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem 2rem;
    border-radius: 24px;
    animation: slideUpCard 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@keyframes slideUpCard {
    from { transform: translateY(60px) scale(0.95); opacity: 0; }
    to   { transform: translateY(0)     scale(1);    opacity: 1; }
}

.payment-modal-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.payment-icon {
    font-size: 2rem;
}

.payment-modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Bill Summary Rows */
.payment-bill-summary {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    overflow: hidden;
}

.bill-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--glass-border);
}

.bill-row:last-child {
    border-bottom: none;
}

.bill-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.bill-value {
    font-size: 0.95rem;
    color: var(--text-main);
    font-weight: 600;
}

.bill-total-row {
    background: rgba(99, 102, 241, 0.08);
}

.bill-total-amount {
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fde047, #eab308);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Action Buttons */
.payment-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.pay-now-btn {
    width: 100%;
    font-size: 1.1rem;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.4);
}

.pay-now-btn:hover {
    background: linear-gradient(135deg, #16a34a, #15803d);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(34, 197, 94, 0.5);
}

.cancel-pay-btn {
    width: 100%;
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    font-family: 'Outfit', sans-serif;
    transition: all 0.3s ease;
}

.cancel-pay-btn:hover {
    border-color: rgba(239, 68, 68, 0.5);
    color: var(--danger);
}

/* Pay button loading spinner */
.pay-spinner {
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Payment Status Message */
.payment-status-msg {
    text-align: center;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    animation: fadeInOverlay 0.3s ease;
}

.payment-status-msg.success-msg {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: var(--success);
}

.payment-status-msg.error-msg {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: var(--danger);
}

/* Payment Success Celebration Animation */
@keyframes successPop {
    0%   { transform: scale(0.8); opacity: 0; }
    60%  { transform: scale(1.1); }
    100% { transform: scale(1);   opacity: 1; }
}

.payment-success-anim {
    animation: successPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Mobile tweaks for payment modal */
@media (max-width: 480px) {
    .payment-modal-card {
        padding: 1.75rem 1.25rem;
    }
    .bill-total-amount {
        font-size: 1.2rem;
    }
}

/* ============================================================
   PAY & EXIT BUTTON (inside activity table rows)
============================================================ */
.pay-row-btn {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.25s ease;
    box-shadow: 0 2px 10px rgba(34, 197, 94, 0.35);
    letter-spacing: 0.3px;
}

.pay-row-btn:hover {
    background: linear-gradient(135deg, #16a34a, #15803d);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.5);
}

.pay-row-btn:disabled {
    background: rgba(255,255,255,0.08);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
