:root {
    --primary-color: #1e40af;
    --secondary-color: #0f766e;
    --accent-color: #d97706;
    --bg-body: #f8fafc;
    --card-radius: 16px;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --surface: #ffffff;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    line-height: 1.75;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.2s ease;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.site-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: #fff;
    padding: 22px 0;
    box-shadow: 0 6px 24px rgba(15, 23, 42, 0.12);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.brand-box {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.16);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
    backdrop-filter: blur(6px);
}

.brand-titles h1,
.brand-titles .brand-heading {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    line-height: 1.35;
}

.brand-titles p {
    margin: 2px 0 0;
    font-size: 13px;
    opacity: 0.9;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    min-height: 42px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    opacity: 0.95;
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 6px 16px rgba(30, 64, 175, 0.2);
}

.btn-secondary {
    background: var(--secondary-color);
    color: #fff;
}

.btn-accent {
    background: var(--accent-color);
    color: #fff;
}

.btn-glass {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-outline {
    background: #fff;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

/* Main Content */
.site-main {
    flex: 1;
    padding: 32px 0;
}

.card {
    background: var(--surface);
    border-radius: var(--card-radius);
    border: 1px solid var(--border-color);
    padding: 28px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
    margin-bottom: 24px;
}

/* Login Grid & Features Mini Grid */
.login-grid {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 28px;
    align-items: start;
}

.features-mini-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    font-size: 13px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 7px;
    color: #1e293b;
}

.form-control {
    width: 100%;
    padding: 13px 16px;
    font-size: 15px;
    border: 1.5px solid #cbd5e1;
    border-radius: 12px;
    background: #f8fafc;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    background: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(30, 64, 175, 0.1);
}

/* Alerts */
.alert {
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
}

.alert-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

/* Hero Seat Highlight Card in Dashboard */
.next-exam-hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0f172a 100%);
    color: #fff;
    border-radius: var(--card-radius);
    padding: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
    box-shadow: 0 16px 36px rgba(30, 64, 175, 0.18);
}

.seat-giant-box {
    background: rgba(255, 255, 255, 0.14);
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-radius: 18px;
    padding: 16px 28px;
    text-align: center;
    min-width: 160px;
    backdrop-filter: blur(8px);
}

.seat-giant-box .seat-label {
    font-size: 13px;
    opacity: 0.9;
    display: block;
}

.seat-giant-box .seat-num {
    font-size: 46px;
    font-weight: 800;
    line-height: 1.1;
    color: #fde68a;
    display: block;
    margin: 4px 0;
}

/* Responsive Table / Mobile Cards */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table.esas-table {
    width: 100%;
    border-collapse: collapse;
}

table.esas-table th,
table.esas-table td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--border-color);
    text-align: right;
    font-size: 14px;
}

table.esas-table th {
    background: #f1f5f9;
    color: #334155;
    font-weight: 700;
}

.seat-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eff6ff;
    color: var(--primary-color);
    border: 1.5px solid #bfdbfe;
    font-weight: 800;
    font-size: 18px;
    padding: 4px 16px;
    border-radius: 10px;
}

/* Visual Hall Matrix Map (Fixed Mobile Scroll without Right-Edge Clipping) */
.hall-stage {
    background: #1e293b;
    color: #fff;
    text-align: center;
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 24px;
    font-weight: 700;
    font-size: 14px;
}

.hall-scroll-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    padding: 10px 4px;
}

.hall-grid {
    display: grid;
    gap: 10px;
    width: max-content;
    margin: 0 auto;
}

.hall-seat-cell {
    border: 1.5px solid #cbd5e1;
    background: #f8fafc;
    border-radius: 10px;
    padding: 10px 6px;
    text-align: center;
    font-size: 12px;
    min-width: 68px;
}

.hall-seat-cell.my-seat {
    background: var(--accent-color);
    color: #fff;
    border-color: #b45309;
    font-weight: 800;
    transform: scale(1.06);
    box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.25);
}

.hall-seat-cell.disabled-seat {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
    opacity: 0.65;
}

/* Banner Slots */
.esas-banner-slot {
    margin: 16px 0;
}

.esas-banner-img {
    width: 100%;
    height: auto;
    max-height: 150px;
    object-fit: cover;
    border-radius: var(--card-radius);
    display: block;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}

/* Footer */
.site-footer {
    background: #0f172a;
    color: #cbd5e1;
    padding: 28px 0;
    margin-top: auto;
    font-size: 13px;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

/* Tablet & Mobile Responsive Breakpoints */
@media (max-width: 860px) {
    .login-grid {
        grid-template-columns: 1fr;
    }
    .next-exam-hero {
        flex-direction: column;
        text-align: center;
        padding: 22px 18px;
    }
    .card {
        padding: 20px;
    }
}

@media (max-width: 768px) {
    /* جلوگیری از زوم ناخواسته مرورگر iOS Safari هنگام لمس فیلدهای ورودی */
    input, select, textarea, .form-control {
        font-size: 16px !important;
    }

    .site-main {
        padding: 20px 0;
    }

    /* تبدیل خودکار جدول برنامه امتحانات دانشجو به کارت‌های موبایلی خوانا (Mobile Stacked Exam Cards) */
    table.esas-table.responsive-exam-table,
    table.esas-table.responsive-exam-table tbody {
        display: block;
        width: 100%;
    }
    table.esas-table.responsive-exam-table thead {
        display: none;
    }
    table.esas-table.responsive-exam-table tbody tr {
        display: block;
        background: #ffffff;
        border: 1.5px solid #cbd5e1;
        border-radius: 14px;
        padding: 12px 14px;
        margin-bottom: 14px;
        box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
    }
    table.esas-table.responsive-exam-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        padding: 8px 4px;
        border-bottom: 1px dashed #e2e8f0;
        text-align: left;
    }
    table.esas-table.responsive-exam-table tbody td:last-child {
        border-bottom: none;
        padding-bottom: 2px;
    }
    table.esas-table.responsive-exam-table tbody td::before {
        content: attr(data-label);
        font-weight: 800;
        font-size: 12.5px;
        color: #475569;
        text-align: right;
        flex-shrink: 0;
    }
}

@media (max-width: 640px) {
    .container {
        padding: 0 14px;
    }
    .site-header {
        padding: 16px 0;
    }
    .brand-titles h1,
    .brand-titles .brand-heading {
        font-size: 16.5px;
    }
    .brand-titles p {
        font-size: 12px;
    }
    .header-actions {
        width: 100%;
        justify-content: stretch;
    }
    .header-actions > .btn,
    .header-actions > form {
        flex: 1 1 auto;
    }
    .header-actions > form > .btn {
        width: 100%;
    }
    .features-mini-grid {
        grid-template-columns: 1fr;
    }
    .card {
        padding: 16px 14px;
    }
    #homeFaqSearchInput {
        width: 100% !important;
        flex: 1 1 100%;
    }
    .footer-inner {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
}
