@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'IranNastaliq';
    src: url('../fonts/IranNastaliq.woff2') format('woff2'),
         url('../fonts/IranNastaliq.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

:root {
    --primary-color: #4a90e2;
    --secondary-color: #50e3c2;
    --background-color: #f0f4f8;
    --form-bg-color: #ffffff;
    --text-color: #333;
    --light-text-color: #666;
    --border-color: #d1d9e6;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.12);
    --border-radius: 12px;
}

body {
    font-family: 'Vazirmatn', sans-serif;
    direction: rtl;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 80px 15px 40px 15px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    box-sizing: border-box;
}

.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 25px;
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1001;
    box-sizing: border-box;
}

.header-links {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-links a {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: bold;
    font-size: 1rem;
    transition: color 0.3s;
}

.header-links a:hover {
    color: #333;
}

.header-links .separator {
    color: var(--border-color);
}

.live-clock-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 18px;
    border-radius: 50px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), inset 0 1px 2px rgba(255, 255, 255, 0.2);
    font-size: 1rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
    direction: ltr;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.live-clock-box svg {
    vertical-align: middle;
}

.live-clock-box .separator {
    font-weight: normal;
    opacity: 0.5;
}

.container {
    background-color: var(--form-bg-color);
    padding: 30px 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 550px;
    text-align: center;
    margin: 20px auto;
    box-sizing: border-box;
}

.admin-container {
    max-width: 1200px;
    text-align: right;
    box-sizing: border-box;
}

h1, h2, h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
}

h1.main-title {
    font-family: 'IranNastaliq', 'Vazirmatn', sans-serif;
    font-weight: normal;
}

h1 {
    font-size: 2rem;
}

h3 {
    color: #333;
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 10px;
}

.form-group, .form-group-inline {
    margin-bottom: 20px;
    text-align: right;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    font-size: 1rem;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="datetime-local"],
select.custom-select,
textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-sizing: border-box;
    font-family: 'Vazirmatn', sans-serif;
    background-color: #fdfdfd;
    transition: all 0.3s ease;
    font-size: 1rem;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
input[type="datetime-local"]:focus,
select.custom-select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 5px rgba(74, 144, 226, 0.5);
}

.btn {
    display: inline-block;
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    font-size: 16px;
    margin-top: 10px;
    font-weight: bold;
    background-image: linear-gradient(45deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-secondary { background-image: linear-gradient(45deg, #868e96, #ced4da); }
.btn-success { background-image: linear-gradient(45deg, #28a745, #20c997); }
.btn-danger { background-image: linear-gradient(45deg, #dc3545, #fd7e14); }

.alert {
    padding: 15px; margin-bottom: 20px; border-radius: 8px;
    list-style: none; text-align: center; border: 1px solid transparent;
}
.alert-danger { color: #721c24; background-color: #f8d7da; border-color: #f5c6cb; }
.alert-success { color: #155724; background-color: #d4edda; border-color: #c3e6cb; }
.alert-warning { color: #856404; background-color: #fff3cd; border-color: #ffeeba; }
.alert-info { color: #0c5460; background-color: #d1ecf1; border-color: #bee5eb; }

.session-selector-box {
    background-color: #e9f2fe;
    border: 2px dashed var(--primary-color);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
}

.registration-form {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.admin-section {
    border: 1px solid var(--border-color);
    padding: 25px;
    margin-bottom: 25px;
    border-radius: var(--border-radius);
    background: #fafbff;
}

fieldset {
    border: 1px solid var(--border-color);
    padding: 20px;
    margin-top: 20px;
    border-radius: 8px;
    background: #fff;
}
legend {
    font-weight: bold;
    color: var(--primary-color);
    padding: 0 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.switch { position: relative; display: inline-block; width: 50px; height: 28px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc; transition: .4s; border-radius: 28px;
}
.slider:before {
    position: absolute; content: ""; height: 20px; width: 20px; left: 4px; bottom: 4px;
    background-color: white; transition: .4s; border-radius: 50%;
}
input:checked + .slider { background-color: var(--primary-color); }
input:checked + .slider:before { transform: translateX(22px); }

.form-group-inline { display: flex; align-items: center; gap: 15px; margin-bottom: 15px; }

.question-block {
    border: 1px solid var(--border-color);
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 8px;
    overflow: hidden;
    background-color: #ffffff;
    transition: all 0.3s ease;
}

.question-block.is-disabled {
    background-color: #f1f5f9 !important;
    opacity: 0.65;
    pointer-events: none !important;
    border-color: #cbd5e1 !important;
}

.question-block.is-disabled * {
    pointer-events: none !important;
    background-color: #f1f5f9 !important;
    color: #64748b !important;
}

.question-block.is-hidden {
    display: none !important;
}

.question-block ul {
    list-style-type: none;
    padding-right: 20px;
    margin-top: 10px;
}
.question-block ul li {
    margin-bottom: 5px;
}

.option-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}
.option-input-group span {
    font-weight: bold;
}
.option-input-group input[type="text"] { flex-grow: 1; }
#timer {
    position: fixed; top: 80px; left: 20px;
    background-color: var(--primary-color); color: white;
    padding: 10px 20px; border-radius: 20px;
    font-size: 1.2rem; font-weight: bold;
    box-shadow: var(--shadow);
    z-index: 1002;
}
.hidden {
    display: none !important;
}
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
th, td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: center;
    vertical-align: middle;
}
th {
    background-color: #f2f7ff;
}

.table-responsive-matrix {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
}
.grid-table {
    min-width: 750px;
    width: 100%;
    border-collapse: collapse;
}
.grid-table th, .grid-table td {
    padding: 10px;
    font-size: 14px;
}
.grid-table input[type="text"], .grid-table select {
    min-width: 110px;
    padding: 8px;
    font-size: 13px;
}

.facial-auth-container {
    width: 100%;
    max-width: 320px;
    margin: 15px auto;
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    background-color: #000;
    box-shadow: var(--shadow);
}
#camera-stream {
    width: 100%;
    height: auto;
    display: block;
    transform: scaleX(-1);
}
#camera-canvas {
    display: none;
}
.camera-overlay-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    border: 3px dashed rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    pointer-events: none;
}
.snapshot-preview-img {
    width: 100%;
    height: auto;
    display: none;
    border-radius: 12px;
    border: 2px solid #28a745;
}

.waiting-room-card {
    text-align: center;
    padding: 30px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}
.waiting-timer {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary-color);
    margin: 20px 0;
    font-feature-settings: "ss01";
}

.consent-checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background-color: #f8fafc;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}
.consent-checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    cursor: pointer;
}
.reservation-slots-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
    margin-top: 15px;
}
.slot-pill {
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    text-align: center;
    background-color: #fff;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
}
.slot-pill:hover:not(.booked) {
    background-color: #f1f5f9;
    border-color: var(--primary-color);
}
.slot-pill.selected {
    background-color: var(--primary-color) !important;
    color: #fff !important;
    border-color: var(--primary-color) !important;
}
.slot-pill.booked {
    background-color: #f1f5f9 !important;
    color: #94a3b8 !important;
    border-color: #e2e8f0 !important;
    cursor: not-allowed;
    text-decoration: line-through;
    opacity: 0.6;
}

.multimedia-player-box {
    margin: 15px auto;
    width: 100%;
    max-width: 100%;
    border-radius: 8px;
    overflow: hidden;
    background-color: #000;
}
.multimedia-player-box video {
    width: 100%;
    display: block;
}
.multimedia-player-box audio {
    width: 100%;
    display: block;
}

.formula-readonly-input {
    background-color: #e2e8f0 !important;
    color: #334155 !important;
    font-weight: bold;
    cursor: not-allowed;
    border: 1px solid #cbd5e1;
}

.auth-nid-table-container {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 10px;
    background-color: #fff;
}
.auth-nid-table {
    width: 100%;
    border-collapse: collapse;
}
.auth-nid-table th, .auth-nid-table td {
    padding: 8px;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}
.auth-nid-table th {
    background-color: #f8fafc;
    position: sticky;
    top: 0;
}

.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #ffffff;
    margin: auto;
    padding: 30px;
    border-radius: var(--border-radius);
    width: 85%;
    max-width: 800px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    position: relative;
    border: 1px solid var(--border-color);
    animation: modal-open-anim 0.3s ease-out;
}

@keyframes modal-open-anim {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-close {
    position: absolute;
    top: 15px;
    left: 20px;
    font-size: 30px;
    font-weight: bold;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #475569;
}

/* استایل‌های اختصاصی و مدرن فیلد تصویری جدید (Image Choice) در فرم‌ها */
.image-choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.image-choice-card {
    border: 2px solid #cbd5e1;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    cursor: pointer;
    text-align: center;
    transition: all 0.25s ease;
    position: relative;
    box-shadow: 0 2px 5px rgba(0,0,0,0.04);
}

.image-choice-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.image-choice-card.selected {
    border-color: #28a745 !important;
    background-color: #f0fdf4 !important;
}

.image-choice-img-wrapper {
    width: 100%;
    height: 120px;
    overflow: hidden;
    position: relative;
    background: #f1f5f9;
}

.image-choice-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.image-choice-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(40, 167, 69, 0.15);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.image-choice-card.selected .image-choice-overlay {
    opacity: 1;
}

.tick-icon {
    background: #28a745;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.image-choice-label {
    display: block;
    padding: 10px 5px;
    font-size: 13px;
    font-weight: bold;
    color: #334155;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

@media (max-width: 768px) {
    body {
        padding: 140px 10px 40px 10px;
        background-color: #f8fafc;
    }
    
    .top-bar {
        flex-direction: column;
        align-items: center;
        padding: 10px;
        height: auto;
        gap: 8px;
    }
    
    .header-links {
        width: 100%;
        justify-content: center;
        order: 2;
    }
    
    .live-clock-box {
        width: 100%;
        order: 1;
        justify-content: center;
        padding: 6px 12px;
        border-radius: 8px;
    }
    
    .container {
        padding: 20px 15px;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        margin: 10px auto;
    }
    
    h1 {
        font-size: 1.6rem;
    }
    
    h3 {
        font-size: 1.2rem;
    }
    
    input[type="text"],
    input[type="password"],
    input[type="number"],
    input[type="url"],
    select.custom-select,
    textarea {
        padding: 10px;
        font-size: 0.95rem;
    }
    
    .btn {
        width: 100%;
        padding: 12px;
        font-size: 1rem;
        box-sizing: border-box;
    }
    
    .form-group-inline {
        align-items: flex-start;
        gap: 10px;
    }
}

/* سؤال احراز هویت چهره */
.facial-question-box { background:#f0f9ff; border:1px solid #7dd3fc; border-radius:10px; padding:16px; text-align:center; }
.facial-question-input { display:block; width:100%; box-sizing:border-box; margin:12px 0; padding:10px; border:1px dashed var(--primary-color); border-radius:8px; background:#fff; }
