﻿@import url("https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800;900&display=swap");

:root {
    --bg:#f4ece3;
    --bg-accent:#efe2d3;
    --card:#ffffff;
    --surface:#fcf7f2;
    --text:#1d150f;
    --muted:#7f6d63;
    --main:#8c5a2b;
    --main-dark:#5b3619;
    --accent:#c97b36;
    --accent-soft:#f2d1a0;
    --green:#0f9d76;
    --red:#dc4949;
    --amber:#f8a235;
    --border:#eadacf;
    --shadow:0 12px 40px rgba(46,25,15,0.12);
    --shadow-lg:0 24px 64px rgba(46,25,15,0.18);
    --radius:22px;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    direction: rtl;
    font-family: 'Cairo', Tahoma, Arial, sans-serif;
    color: var(--text);
    line-height: 1.6;
    background:
        radial-gradient(circle at 6% 12%, rgba(240,214,185,0.32), transparent 46%),
        radial-gradient(circle at 94% 10%, rgba(214,189,160,0.26), transparent 50%),
        linear-gradient(145deg, var(--bg) 0%, var(--bg-accent) 38%, #fdf9f4 100%);
    min-height: 100vh;
}

body::before {
    content: "";
    position: fixed;
    inset: 58% -35% -30% 28%;
    background: radial-gradient(circle at center, rgba(201,123,54,0.18), transparent 70%);
    z-index: -1;
    pointer-events: none;
}

h1, h2, h3, h4 {
    font-weight: 800;
    color: var(--main-dark);
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.25s ease;
}

a:hover,
a:focus-visible {
    opacity: 0.85;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0 clamp(16px, 3vw, 32px);
    height: 56px;
    background: var(--main-dark);
    color: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.18);
}

.brand {
    font-size: 18px;
    font-weight: 800;
    white-space: nowrap;
    color: #fff;
    padding-left: clamp(20px, 3vw, 40px);
    border-left: 1px solid rgba(255,255,255,0.15);
    margin-left: auto;
    line-height: 56px;
}

.brand:hover { opacity: 0.85; }

.topbar nav {
    display: flex;
    align-items: center;
    height: 100%;
    gap: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    height: 56px;
    padding: 0 clamp(14px, 2vw, 22px);
    font-weight: 600;
    font-size: 14px;
    color: rgba(255,255,255,0.75);
    border-bottom: 3px solid transparent;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.07);
}

.nav-link.active {
    color: #fff;
    border-bottom-color: var(--accent);
    background: rgba(255,255,255,0.05);
}

.nav-logout {
    display: flex;
    align-items: center;
    height: 36px;
    padding: 0 16px;
    margin-right: auto;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.7);
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    transition: background 0.2s, color 0.2s;
}

.nav-logout:hover {
    background: rgba(220,38,38,0.25);
    border-color: rgba(220,38,38,0.4);
    color: #fff;
}

.container {
    width: min(1200px, 94%);
    margin: clamp(18px, 3vw, 30px) auto;
    padding: 0 clamp(10px, 2vw, 18px);
}

.section-heading {
    margin: 0 0 20px;
    font-size: clamp(22px, 3.6vw, 30px);
    font-weight: 800;
    color: var(--main-dark);
}

.section-heading.center {
    text-align: center;
}

.section-heading.center small {
    margin-top: 10px;
}

.section-heading small {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-weight: 500;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: clamp(18px, 2.5vw, 26px);
}

.quick-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    margin-bottom: clamp(20px, 3vw, 32px);
}

.qs-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 999px;
    background: var(--card);
    border: 1px solid var(--border);
    font-size: 15px;
    font-weight: 600;
    color: var(--main-dark);
    box-shadow: 0 4px 12px rgba(46,25,15,0.06);
}

.qs-item strong {
    font-size: 20px;
    font-weight: 900;
    color: var(--main);
}

.qs-item.green strong {
    color: var(--green);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
}

.actions.center {
    justify-content: center;
}

.card {
    position: relative;
    background: var(--card);
    border-radius: var(--radius);
    padding: clamp(22px, 3vw, 28px);
    border: 1px solid rgba(255,255,255,0.65);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card.form-card {
    max-width: 520px;
    margin: 0 auto;
}

.card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, rgba(201,123,54,0.08), transparent 68%);
    pointer-events: none;
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

.card h2,
.card h3 {
    margin-top: 0;
    color: var(--main-dark);
}

.muted {
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
}

.stat {
    font-size: clamp(32px, 5vw, 44px);
    font-weight: 900;
    color: var(--main);
    margin: 12px 0 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 999px;
    background: rgba(255,255,255,0.78);
    color: var(--main-dark);
    font-size: 13px;
    font-weight: 600;
}

.table-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: clamp(14px, 2.5vw, 22px);
}

.table-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    text-decoration: none;
    border-radius: calc(var(--radius) + 4px);
    padding: clamp(20px, 3vw, 26px) 16px;
    min-height: 200px;
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.table-card::after {
    content: "";
    position: absolute;
    inset: auto -36px -50px auto;
    width: 120px;
    height: 120px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
}

.table-card:hover {
    transform: translateY(-6px) scale(1.03);
    box-shadow: var(--shadow-lg);
}

.table-card.free { background: linear-gradient(145deg, #0f9d76 0%, #34d399 100%); }
.table-card.busy { background: linear-gradient(145deg, #b45309 0%, #fbbf24 100%); }
.table-card.maintenance { background: linear-gradient(145deg, #991b1b 0%, #f87171 100%); }

.table-card.warning {
    background: linear-gradient(145deg, #c2410c 0%, #fb923c 100%) !important;
    animation: pulse-warn 1.2s ease-in-out infinite;
}

.table-card.expired {
    background: linear-gradient(145deg, #7f1d1d 0%, #dc2626 100%) !important;
    animation: pulse-expired 0.8s ease-in-out infinite;
    box-shadow: 0 0 30px rgba(220,38,38,0.5);
}

@keyframes pulse-warn {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

@keyframes pulse-expired {
    0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(220,38,38,0.4); }
    50% { transform: scale(1.05); box-shadow: 0 0 40px rgba(220,38,38,0.7); }
}

.card-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 6px;
    opacity: 0.9;
}

.card-icon svg {
    width: 100%;
    height: 100%;
    color: #fff;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.2));
}

.table-card h3 {
    margin: 4px 0 0;
    font-size: clamp(22px, 3.5vw, 30px);
    font-weight: 900;
    color: #fff;
}

.table-card .badge {
    background: rgba(255,255,255,0.22);
    color: #fff;
    margin-top: 6px;
    font-size: 11px;
    padding: 4px 10px;
}

.table-timer {
    display: block;
    margin-top: 8px;
    font-size: 17px;
    font-weight: 800;
    color: rgba(255,255,255,0.95);
    font-variant-numeric: tabular-nums;
}
.btn {
    border: none;
    border-radius: 16px;
    padding: 13px 24px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--main);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 14px 26px rgba(92,64,51,0.24);
    min-height: 44px;
}

.btn:hover,
.btn:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 18px 32px rgba(92,64,51,0.28);
}

.btn.secondary {
    background: rgba(255,255,255,0.92);
    color: var(--main-dark);
    border: 1px solid rgba(92,64,51,0.18);
    box-shadow: 0 12px 24px rgba(92,64,51,0.16);
}

.btn.green { background: var(--green); box-shadow: 0 14px 26px rgba(15,157,118,0.24); }
.btn.red { background: var(--red); box-shadow: 0 14px 26px rgba(220,73,73,0.24); }
.btn.amber { background: var(--amber); box-shadow: 0 14px 26px rgba(248,162,53,0.24); }
.btn.light {
    background: rgba(255,255,255,0.85);
    color: var(--main-dark);
    border: 1px solid rgba(92,64,51,0.18);
    box-shadow: 0 12px 22px rgba(0,0,0,0.08);
}

.btn.wide {
    min-width: 200px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
}

.form {
    display: grid;
    gap: 18px;
}

.form label {
    font-weight: 700;
    color: var(--main-dark);
    margin-bottom: 6px;
}

.input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 14px 16px;
    background: var(--surface);
    font-size: 16px;
    font-family: 'Cairo', Tahoma, Arial, sans-serif;
    transition: border 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--main);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(140,90,43,0.16);
}

.row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

.booking-summary {
    text-align: center;
    padding: 14px 20px;
    border-radius: 14px;
    background: var(--bg-accent);
    font-size: 17px;
    font-weight: 600;
    color: var(--main-dark);
    margin: 4px 0 10px;
}

.booking-summary strong {
    font-size: 24px;
    font-weight: 900;
    color: var(--main);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border-radius: calc(var(--radius) + 6px);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.data-table thead {
    background: var(--surface);
}

.data-table th,
.data-table td {
    padding: 16px 20px;
    text-align: right;
    border-bottom: 1px solid rgba(234,218,207,0.7);
    font-size: 15px;
}

.data-table th {
    color: var(--main-dark);
    font-weight: 700;
}

.data-table tbody tr:hover {
    background: rgba(242,225,205,0.18);
}

.alert {
    padding: 16px 22px;
    border-radius: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid transparent;
}

.alert.success {
    background: rgba(15,157,118,0.12);
    border-color: rgba(15,157,118,0.25);
    color: #046c4a;
}

.alert.error {
    background: rgba(220,73,73,0.12);
    border-color: rgba(220,73,73,0.26);
    color: #8f1f1f;
}
.login-box {
    max-width: 440px;
    margin: 90px auto;
    padding: 48px;
    border-radius: calc(var(--radius) + 6px);
    background: var(--card);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255,255,255,0.68);
}

.total-box {
    background: rgba(242,225,205,0.24);
    border: 1px solid rgba(201,123,54,0.28);
    border-radius: calc(var(--radius) + 4px);
    padding: 22px;
}

.big-total {
    font-size: 34px;
    font-weight: 900;
    color: var(--main-dark);
    margin-top: 12px;
}

.receipt {
    background: var(--card);
    border: 2px dashed rgba(140,90,43,0.35);
    padding: 34px;
    max-width: 480px;
    margin: 0 auto;
    border-radius: calc(var(--radius) + 8px);
    box-shadow: var(--shadow);
}

.footer {
    text-align: center;
    color: var(--muted);
    padding: 34px;
    margin-top: 60px;
    font-size: 14px;
}

@media (max-width: 900px) {
    .topbar {
        flex-wrap: wrap;
        height: auto;
        padding: 0 12px;
    }

    .brand {
        border-left: none;
        padding-left: 0;
        margin-left: 0;
        padding: 10px 0;
        width: 100%;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }

    .topbar nav {
        width: 100%;
        overflow-x: auto;
        padding: 6px 0;
    }

    .nav-link { height: 40px; font-size: 13px; }

    .nav-logout {
        margin-right: 0;
        margin-bottom: 8px;
    }

    .actions {
        justify-content: flex-start;
    }

    .card,
    .table-card {
        padding: 20px;
    }

    .login-box {
        margin: 70px 16px;
        padding: 40px 28px;
    }
}

@media (max-width: 520px) {
    .nav-link {
        padding: 0 12px;
        font-size: 12px;
    }

    .actions {
        gap: 10px;
    }

    .btn {
        width: 100%;
    }
}

@media print {
    .topbar,
    .footer,
    .actions,
    .hide-print {
        display: none !important;
    }

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

    .receipt {
        border: 0;
        max-width: 100%;
        padding: 0;
        box-shadow: none;
    }
}
