/* =========================================================
   استایل بخش نوبت‌دهی آنلاین (فیروزه‌ای)
   ========================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Tahoma, 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%);
    min-height: 100vh;
    padding: 15px;
    color: #134e4a;
    line-height: 1.6;
}

.appointment-container {
    max-width: 700px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(15, 118, 110, 0.15);
    overflow: hidden;
    padding: 25px;
}

/* =========================================================
   هدر فیروزه‌ای
   ========================================================= */
.main-header {
    background: linear-gradient(135deg, #0f766e 0%, #14b8a6 100%);
    color: white;
    padding: 15px 20px 12px;
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.main-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 50%, rgba(255,255,255,0.08), transparent 60%);
    pointer-events: none;
}
.main-header h1 {
    font-size: 24px;
    margin: 0 0 4px 0;
    font-weight: 700;
    position: relative;
    z-index: 1;
}
.main-header .subtitle {
    font-size: 14px;
    font-weight: 400;
    opacity: 0.9;
    margin: 0 0 10px 0;
    position: relative;
    z-index: 1;
}
.main-header .back-link {
    display: inline-block;
    color: #fef3c7;
    text-decoration: none;
    margin-top: 8px;
    font-weight: 600;
    font-size: 14px;
    position: relative;
    z-index: 1;
    cursor: pointer;
}
.main-header .back-link:hover {
    text-decoration: underline;
}

/* =========================================================
   جعبه اطلاعات مهم
   ========================================================= */
.info-box {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #f59e0b;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 20px;
}
.info-box-title {
    font-size: 14px;
    font-weight: 800;
    color: #92400e;
    margin-bottom: 6px;
}
.info-box p {
    font-size: 13px;
    color: #78350f;
    line-height: 1.8;
    margin: 0;
}
.info-box strong { color: #92400e; }

/* =========================================================
   نوتیفیکیشن
   ========================================================= */
.notification {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    display: none;
    font-weight: 600;
    font-size: 13px;
}
.notification.success { display: block; background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.notification.error { display: block; background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.notification.warning { display: block; background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

/* =========================================================
   فرم‌ها
   ========================================================= */
.form-group { margin-bottom: 18px; }
.form-group > label {
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
    color: #134e4a;
    font-size: 14px;
}
.form-group > label .required { color: #dc2626; }
.form-control {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid #ccfbf1;
    border-radius: 10px;
    font-family: Tahoma;
    font-size: 14px;
    transition: all 0.3s;
    box-sizing: border-box;
    background: #f0fdfa;
    color: #134e4a;
}
.form-control:focus {
    border-color: #14b8a6;
    outline: none;
    background: white;
    box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.15);
}
.form-control::placeholder { color: #94a3b8; }
textarea.form-control { min-height: 100px; resize: vertical; line-height: 1.7; }
select.form-control { appearance: auto; cursor: pointer; }
.hint { font-size: 11px; color: #64748b; margin-top: 4px; }

/* =========================================================
   انتخاب بیمه
   ========================================================= */
.insurance-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.insurance-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 12px;
    border: 2px solid #ccfbf1;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    background: #f0fdfa;
    position: relative;
}
.insurance-option:hover { border-color: #5eead4; background: #ccfbf1; }
.insurance-option input[type="radio"] { display: none; }
.insurance-option input[type="radio"]:checked ~ .radio-custom {
    background: #14b8a6;
    border-color: #14b8a6;
}
.insurance-option input[type="radio"]:checked ~ .radio-custom::after {
    content: '';
    position: absolute;
    width: 6px; height: 6px;
    background: white;
    border-radius: 50%;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}
.insurance-option:has(input:checked) {
    border-color: #14b8a6;
    background: #ccfbf1;
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.2);
}
.radio-custom {
    width: 18px; height: 18px;
    border: 2px solid #94a3b8;
    border-radius: 50%;
    flex-shrink: 0;
    position: relative;
    transition: all 0.3s;
}
.option-text {
    display: flex;
    flex-direction: column;
    line-height: 1.4;
    min-width: 0;
    flex: 1;
}
.option-text strong { font-size: 13px; color: #134e4a; font-weight: 700; }
.option-text small { font-size: 10px; color: #64748b; margin-top: 2px; }

/* =========================================================
   انتخاب تاریخ
   ========================================================= */
.date-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border: 2px solid #ccfbf1;
    border-radius: 10px;
    background: #f0fdfa;
    cursor: pointer;
    transition: all 0.3s;
}
.date-display:hover { border-color: #14b8a6; background: #ccfbf1; }
.date-display.has-value { border-color: #14b8a6; background: #ccfbf1; }
.date-icon { font-size: 20px; margin-left: 8px; }
.date-text { flex: 1; font-size: 14px; color: #64748b; font-weight: 600; }
.date-display.has-value .date-text { color: #0f766e; font-weight: 700; }
.date-arrow { font-size: 12px; color: #14b8a6; }

/* =========================================================
   انتخاب شیفت
   ========================================================= */
.shift-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.shift-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 10px;
    border: 2px solid #ccfbf1;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    background: #f0fdfa;
    text-align: center;
    position: relative;
    min-height: 65px;
}
.shift-option:hover { border-color: #5eead4; background: #ccfbf1; }
.shift-option input[type="radio"] { display: none; }
.shift-option:has(input:checked) {
    border-color: #14b8a6;
    background: linear-gradient(135deg, #ccfbf1, #99f6e4);
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.25);
    transform: translateY(-2px);
}
.shift-text { display: flex; flex-direction: column; gap: 2px; }
.shift-text strong { font-size: 14px; color: #134e4a; font-weight: 800; }
.shift-text small { font-size: 11px; color: #64748b; }

/* =========================================================
   دکمه‌ها
   ========================================================= */
.btn-row { display: flex; gap: 10px; margin-top: 24px; flex-wrap: wrap; }
.btn {
    flex: 1;
    min-width: 150px;
    padding: 14px 20px;
    border: none;
    border-radius: 10px;
    font-family: Tahoma;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.15); }
.btn-primary {
    background: linear-gradient(135deg, #0f766e 0%, #14b8a6 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(20, 184, 166, 0.3);
}
.btn-primary:hover { background: linear-gradient(135deg, #0d5e56 0%, #0f9b8e 100%); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-secondary { background: #e2e8f0; color: #475569; }
.btn-secondary:hover { background: #cbd5e1; }
.loading-spinner {
    display: inline-block;
    width: 16px; height: 16px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================
   فوتر
   ========================================================= */
.footer-note {
    text-align: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #ccfbf1;
    font-size: 11px;
    color: #64748b;
}

/* =========================================================
   مودال تقویم
   ========================================================= */
.calendar-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    padding: 15px;
    backdrop-filter: blur(4px);
}
.calendar-modal.active { display: flex; }

.calendar-content {
    background: white;
    border-radius: 15px;
    max-width: 450px;
    width: 100%;
    padding: 18px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.3);
    animation: calendarSlide 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}
@keyframes calendarSlide {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ===== نوار بالا (فقط ضربدر) ===== */
.calendar-top-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #f0fdfa;
    min-height: 40px;
}
.calendar-close {
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 20px;
    cursor: pointer;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}
.calendar-close:hover {
    background: #b91c1c;
    transform: scale(1.1);
}

/* ===== هدر ناوبری ===== */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 2px solid #ccfbf1;
}
.calendar-title {
    font-size: 16px;
    font-weight: 800;
    color: #0f766e;
    text-align: center;
    flex: 1;
    padding: 0 10px;
}
.calendar-nav {
    background: linear-gradient(135deg, #14b8a6, #0f766e);
    color: white;
    border: none;
    border-radius: 8px;
    width: 42px;
    height: 42px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.calendar-nav:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.3);
}
.calendar-nav:disabled { opacity: 0.4; cursor: not-allowed; }

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}
.calendar-weekdays > div {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: #0f766e;
    padding: 6px 2px;
    background: #f0fdfa;
    border-radius: 6px;
}

.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    position: relative;
    user-select: none;
}
.calendar-day.empty { cursor: default; background: transparent; }
.calendar-day.available { background: #ccfbf1; color: #134e4a; }
.calendar-day.available:hover {
    background: #14b8a6;
    color: white;
    transform: scale(1.08);
    box-shadow: 0 4px 10px rgba(20, 184, 166, 0.3);
}
.calendar-day.selected {
    background: linear-gradient(135deg, #0f766e, #14b8a6);
    color: white;
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.4);
    transform: scale(1.05);
}
.calendar-day.holiday {
    background: #fee2e2;
    color: #991b1b;
    cursor: not-allowed;
    opacity: 0.7;
}
.calendar-day.holiday::after {
    content: '✕';
    position: absolute;
    top: 2px; left: 2px;
    font-size: 8px;
    color: #dc2626;
}
.calendar-day.disabled {
    background: #f1f5f9;
    color: #cbd5e1;
    cursor: not-allowed;
    opacity: 0.5;
}
.calendar-day.today { border-color: #f59e0b; font-weight: 800; }

.calendar-legend {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
    padding-top: 12px;
    border-top: 1px solid #ccfbf1;
    flex-wrap: wrap;
}
.legend-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: #64748b; }
.legend-color { width: 14px; height: 14px; border-radius: 4px; }
.legend-color.available { background: #ccfbf1; }
.legend-color.holiday { background: #fee2e2; }
.legend-color.disabled { background: #f1f5f9; }

/* =========================================================
   ریسپانسیو
   ========================================================= */
@media (max-width: 600px) {
    body { padding: 8px; }
    .appointment-container { padding: 15px; border-radius: 12px; }
    .main-header { padding: 12px 14px 10px; }
    .main-header h1 { font-size: 19px; }
    .main-header .subtitle { font-size: 12px; }
    .insurance-options, .shift-options { grid-template-columns: 1fr; }
    .btn-row { flex-direction: column; }
    .btn { min-width: 100%; }
    .calendar-content { padding: 14px; }
    .calendar-day { font-size: 12px; }
    .calendar-weekdays > div { font-size: 10px; padding: 4px 1px; }
}

@media (max-width: 360px) {
    .main-header h1 { font-size: 17px; }
    .main-header .subtitle { font-size: 11px; }
    .form-control { font-size: 13px; padding: 9px 12px; }
    .calendar-day { font-size: 11px; }
    .option-text strong { font-size: 12px; }
    .shift-text strong { font-size: 13px; }
}

/* =========================================================
   ✅ گروه‌بندی پزشکان - فقط برای حالت بدون Select2
   (با Select2 تداخل ندارد چون Select2 روی select اصلی
    کلاس select2-hidden-accessible اضافه می‌کند)
   ========================================================= */
select.form-control:not(.select2-hidden-accessible) optgroup {
    font-weight: 800;
    color: #0f766e;
    background: #f0fdfa;
    font-style: normal;
    padding: 6px 0;
}
select.form-control:not(.select2-hidden-accessible) optgroup option {
    font-weight: 500;
    color: #134e4a;
    background: white;
    padding: 6px 12px;
}

/* ===== دکمه بازگشت ===== */
.back-link {
    display: inline-block;
    margin: 9px auto 15px;
    padding: 7px 21px;
    background: linear-gradient(135deg, #d4af37, #b8860b);
    color: #ffffff;
    text-decoration: none;
    font-size: 12px;
    font-weight: bold;
    border: 1px solid #f1d675;
    border-radius: 10px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
    transition: all 0.25s ease;
    cursor: pointer;
}

.back-link:hover {
    background: linear-gradient(135deg, #e5c454, #c99a16);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.22);
}

.back-link:active {
    transform: translateY(0);
}