/* Clinic Booking – Frontend CSS v7
 * کادر اصلی: بدون استایل کلی — سازگار با المنتور
 * فونت: inherit از سایت
 */

/* ── Wrapper: بدون استایل کلی (المنتور) ─────── */
.cb-wrapper {
    font-family: inherit;
    direction: rtl;
    position: relative;
    box-sizing: border-box;
    width: 100%;
    overflow-x: hidden;
}
.cb-wrapper *,
.cb-wrapper *::before,
.cb-wrapper *::after {
    box-sizing: border-box;
}

/* ── Header: یک سطری با فونت واکنشگرا ────────── */
.cb-header {
    background: linear-gradient(135deg, #1565c0, #1976d2);
    color: #fff;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 52px;
    border-radius: 10px 10px 0 0;
    flex-wrap: nowrap;
    overflow: hidden;
}
/* نام کلینیک — یک سطر، کوچک‌شو اگر جا نبود */
.cb-header h2 {
    margin: 0;
    font-family: inherit;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    /* font-size واکنشگرا: حداقل ۱۳px، حداکثر ۲۰px */
    font-size: clamp(13px, 2.8vw, 20px);
    line-height: 1.2;
}
/* مرحله‌شمار کنار نام کلینیک */
.cb-steps-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    flex-wrap: nowrap;
}
.cb-step-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    opacity: 0.55;
    white-space: nowrap;
    transition: opacity 0.2s;
}
.cb-step-item.active  { opacity: 1; font-weight: 700; }
.cb-step-item.done    { opacity: 0.8; }
.cb-step-num {
    width: 20px; height: 20px;
    background: rgba(255,255,255,0.18);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 11px;
    flex-shrink: 0;
}
.cb-step-item.active .cb-step-num { background: #fff; color: #1565c0; }
.cb-step-item.done .cb-step-num   { background: rgba(255,255,255,0.5); }
.cb-step-sep { opacity: 0.3; font-size: 14px; }

/* ── Step Content ─────────────────────────────── */
.cb-step {
    padding: 22px 20px;
    width: 100%;
}
.cb-step h3 {
    margin: 0 0 18px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    color: inherit;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

/* ── Form Elements ────────────────────────────── */
.cb-form-group { margin-bottom: 16px; }
.cb-form-group > label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
}
.req { color: #e53e3e; }

.cb-input, .cb-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dde2ee;
    border-radius: 7px;
    font-family: inherit;
    font-size: 14px;
    direction: rtl;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
    color: inherit;
}
.cb-input:focus, .cb-select:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 3px rgba(25,118,210,0.10);
}
.cb-input.cb-input-error { border-color: #e53e3e; }
.cb-error { color: #e53e3e; font-size: 12px; margin-top: 3px; display: block; }

/* Radio cards */
.cb-radio-group { display: flex; gap: 8px; }
.cb-radio-card {
    flex: 1;
    border: 1px solid #dde2ee;
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.2s;
}
.cb-radio-card:hover { border-color: #1976d2; }
.cb-radio-card input[type="radio"] { accent-color: #1976d2; }

/* ── Buttons ──────────────────────────────────── */
.cb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 22px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}
.cb-btn-primary {
    background: #1976d2;
    color: #fff;
}
.cb-btn-primary:hover { background: #1356a5; }
.cb-btn-outline {
    background: transparent;
    border: 1px solid #dde2ee;
    color: #555;
}
.cb-btn-outline:hover { border-color: #1976d2; color: #1976d2; }
.cb-btn-block { width: 100%; }
.cb-btn-large { padding: 13px 28px; font-size: 15px; }
.cb-btn-sm    { padding: 7px 14px; font-size: 12px; }

/* ── انتخاب تاریخ: گرید واکنشگرا ─────────────── */
.cb-dates-list {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 8px !important;
    margin-bottom: 10px !important;
    width: 100% !important;
    list-style: none !important;
    padding: 0 !important;
}
/* دکمه تاریخ — specificity بالا با والد + !important */
#cb-booking-wrapper .cb-date-btn,
.cb-wrapper .cb-date-btn {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
    padding: 10px 6px !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 7px !important;
    background: #f9f9f9 !important;
    background-image: none !important;
    cursor: pointer !important;
    font-family: inherit !important;
    transition: all 0.2s !important;
    width: 100% !important;
    min-width: 0 !important;
    text-align: center !important;
    text-decoration: none !important;
    box-shadow: none !important;
    letter-spacing: normal !important;
    line-height: 1.4 !important;
    margin: 0 !important;
}
#cb-booking-wrapper .cb-date-btn .cb-btn-day,
.cb-wrapper .cb-date-btn .cb-btn-day {
    font-size: 11px !important;
    font-weight: 400 !important;
    color: #555 !important;
    white-space: nowrap !important;
    display: block !important;
    text-align: center !important;
    background: none !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
}
#cb-booking-wrapper .cb-date-btn .cb-btn-date,
.cb-wrapper .cb-date-btn .cb-btn-date {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #111 !important;
    direction: ltr !important;
    letter-spacing: 0.3px !important;
    display: block !important;
    text-align: center !important;
    background: none !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
}
#cb-booking-wrapper .cb-date-btn:hover,
.cb-wrapper .cb-date-btn:hover {
    border-color: #1976d2 !important;
    background: #e8f0fe !important;
    background-image: none !important;
    box-shadow: none !important;
}
#cb-booking-wrapper .cb-date-btn:hover .cb-btn-day,
#cb-booking-wrapper .cb-date-btn:hover .cb-btn-date,
.cb-wrapper .cb-date-btn:hover .cb-btn-day,
.cb-wrapper .cb-date-btn:hover .cb-btn-date {
    color: #1565c0 !important;
}
#cb-booking-wrapper .cb-date-btn.selected,
.cb-wrapper .cb-date-btn.selected {
    border-color: #1976d2 !important;
    background: #e3effe !important;
    background-image: none !important;
    box-shadow: 0 0 0 2px rgba(25,118,210,0.2) !important;
}
#cb-booking-wrapper .cb-date-btn.selected .cb-btn-day,
#cb-booking-wrapper .cb-date-btn.selected .cb-btn-date,
.cb-wrapper .cb-date-btn.selected .cb-btn-day,
.cb-wrapper .cb-date-btn.selected .cb-btn-date {
    color: #1565c0 !important;
    font-weight: 700 !important;
}
.cb-no-dates { color: #999; font-size: 13px; margin: 6px 0; }

/* دکمه «بیشتر» */
#cb-show-more-dates {
    margin-top: 6px;
    width: 100%;
    justify-content: center;
    color: #1976d2;
    border-color: #1976d2;
    font-size: 12px;
    padding: 7px 14px;
}
#cb-show-more-dates:hover { background: #e8f0fe; }

/* Loading */
.cb-loading-dates {
    color: #888;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-family: inherit;
}
.cb-nid-spinner {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid #dde2ee;
    border-top-color: #1976d2;
    border-radius: 50%;
    animation: cb-spin 0.7s linear infinite;
    vertical-align: middle;
    flex-shrink: 0;
}

/* ── انتخاب ساعت: گرید ۳ ستونه واکنشگرا ──────── */
.cb-times-grid {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 8px !important;
    margin-bottom: 20px !important;
    width: 100% !important;
    padding: 0 !important;
    list-style: none !important;
}
/* دکمه ساعت — specificity بالا */
#cb-booking-wrapper .cb-time-btn,
.cb-wrapper .cb-time-btn {
    padding: 12px 8px !important;
    border-radius: 7px !important;
    border: 1px solid #e0e0e0 !important;
    background: #f9f9f9 !important;
    background-image: none !important;
    font-family: inherit !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #111 !important;
    cursor: pointer !important;
    text-align: center !important;
    width: 100% !important;
    min-width: 0 !important;
    transition: all 0.2s !important;
    display: block !important;
    box-shadow: none !important;
    text-decoration: none !important;
    letter-spacing: normal !important;
    line-height: 1.5 !important;
    margin: 0 !important;
}
#cb-booking-wrapper .cb-time-btn.available:hover,
.cb-wrapper .cb-time-btn.available:hover {
    border-color: #1976d2 !important;
    background: #e8f0fe !important;
    background-image: none !important;
    color: #1565c0 !important;
    box-shadow: none !important;
}
#cb-booking-wrapper .cb-time-btn.available.selected,
.cb-wrapper .cb-time-btn.available.selected {
    border-color: #1976d2 !important;
    background: #e3effe !important;
    background-image: none !important;
    color: #1565c0 !important;
    font-weight: 700 !important;
    box-shadow: 0 0 0 2px rgba(25,118,210,0.2) !important;
}
#cb-booking-wrapper .cb-time-btn.reserved,
.cb-wrapper .cb-time-btn.reserved {
    background: #f5f5f5 !important;
    background-image: none !important;
    border-color: #e8e8e8 !important;
    color: #bbb !important;
    cursor: not-allowed !important;
    text-decoration: line-through !important;
    opacity: 0.6 !important;
    box-shadow: none !important;
}

/* برچسب تاریخ انتخاب‌شده در مرحله ۳ */
.cb-date-label {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f0f7ff;
    padding: 9px 14px;
    border-radius: 7px;
    margin-bottom: 14px;
    font-weight: 600;
    font-size: 14px;
    color: #1565c0;
    font-family: inherit;
}
.cb-visit-type-badge {
    background: #e3f2fd;
    color: #1976d2;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

/* ── کد ملی: وضعیت ────────────────────────────── */
#cb-autofill-msg {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    margin-top: 5px;
    padding: 6px 10px;
    border-radius: 6px;
    font-family: inherit;
}
#cb-autofill-msg.loading {
    color: #1976d2;
    background: #e8f0fe;
    border: 1px solid #c5d8f6;
}
#cb-autofill-msg.success {
    color: #276749;
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
}

/* ── رسید نوبت ────────────────────────────────── */
.cb-receipt { animation: cb-fadein 0.4s ease; }
@keyframes cb-fadein {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.cb-receipt-body { padding: 20px; }
.cb-receipt-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 0;
    border-bottom: 1px solid #f0f0f0;
    font-family: inherit;
}
.cb-receipt-row:last-child { border-bottom: none; }
.cb-receipt-lbl { color: #718096; font-size: 13px; }
.cb-receipt-val { color: #111; font-weight: 700; font-size: 14px; }
.cb-receipt-footer {
    background: #fffde7;
    padding: 16px 20px;
    border-top: 1px dashed #ffe082;
    text-align: center;
}
.cb-screenshot-msg {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #e65100;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
}

/* ── Loader ───────────────────────────────────── */
.cb-loader {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.cb-spinner {
    width: 40px; height: 40px;
    border: 4px solid #dde2ee;
    border-top-color: #1976d2;
    border-radius: 50%;
    animation: cb-spin 0.8s linear infinite;
}
@keyframes cb-spin { to { transform: rotate(360deg); } }

/* ── Responsive ───────────────────────────────── */
@media (max-width: 600px) {
    .cb-header { padding: 12px 14px; border-radius: 8px 8px 0 0; }
    .cb-header h2 { font-size: clamp(12px, 3.5vw, 18px); }
    .cb-step-item span:not(.cb-step-num) { display: none; }
    .cb-steps-nav { gap: 3px; }

    .cb-step { padding: 16px 14px; }
    .cb-step h3 { font-size: 14px; margin-bottom: 14px; }

    /* تاریخ: 2 ستون در موبایل */
    .cb-dates-list { grid-template-columns: repeat(2, 1fr) !important; gap: 6px !important; }
    #cb-booking-wrapper .cb-date-btn .cb-btn-day,
    .cb-wrapper .cb-date-btn .cb-btn-day  { font-size: 10px !important; }
    #cb-booking-wrapper .cb-date-btn .cb-btn-date,
    .cb-wrapper .cb-date-btn .cb-btn-date { font-size: 12px !important; }

    /* ساعت: 3 ستون کوچک */
    .cb-times-grid { grid-template-columns: repeat(4, 1fr) !important; gap: 6px !important; }
    #cb-booking-wrapper .cb-time-btn,
    .cb-wrapper .cb-time-btn { font-size: 12px !important; padding: 10px 4px !important; }

    .cb-receipt-body { padding: 14px; }
    .cb-receipt-footer { padding: 12px 14px; }
}

/* ── فیلد آپلود مدارک ─────────────────────────── */
.cb-file-drop {
    border: 2px dashed #dde2ee;
    border-radius: 8px;
    padding: 18px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafbff;
    position: relative;
}
.cb-file-drop:hover,
.cb-file-drop.cb-drag-over {
    border-color: #1976d2;
    background: #e8f0fe;
}
.cb-file-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    pointer-events: none;
}
.cb-file-icon {
    font-size: 26px;
    line-height: 1;
}
.cb-file-text {
    font-size: 13px;
    font-weight: 600;
    color: #444;
}
.cb-file-hint {
    font-size: 11px;
    color: #888;
}
.cb-file-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 4px 0;
}
.cb-file-name {
    font-size: 13px;
    font-weight: 600;
    color: #276749;
    word-break: break-all;
}
.cb-file-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: #e53e3e;
    font-size: 16px;
    padding: 0 4px;
    line-height: 1;
    font-family: inherit;
    flex-shrink: 0;
}
.cb-file-remove:hover { opacity: 0.7; }

/* ══════════════════════════════════════════════
   تقویم شمسی — Inline
   ══════════════════════════════════════════════ */
#cb-booking-wrapper .cb-jalcal {
    width: 100% !important;
    background: #fff !important;
    border: 1px solid #e0e8f4 !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07) !important;
    max-width: 360px !important;
    margin: 0 auto !important;
}
#cb-booking-wrapper .cb-jalcal-header {
    background: #1976d2 !important;
    padding: 10px 14px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 6px !important;
}
#cb-booking-wrapper .cb-jalcal-title {
    flex: 1 !important;
    text-align: center !important;
    color: #fff !important;
    font-weight: 700 !important;
    font-size: 14px !important;
    font-family: inherit !important;
}
#cb-booking-wrapper .cb-jalcal-nav {
    background: rgba(255,255,255,0.18) !important;
    border: none !important;
    color: #fff !important;
    width: 28px !important; height: 28px !important;
    border-radius: 50% !important;
    font-size: 17px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.15s !important;
    flex-shrink: 0 !important;
    font-family: inherit !important;
    padding: 0 !important;
    line-height: 1 !important;
}
#cb-booking-wrapper .cb-jalcal-nav:hover:not([disabled]) {
    background: rgba(255,255,255,0.35) !important;
}
#cb-booking-wrapper .cb-jalcal-weekdays {
    display: grid !important;
    grid-template-columns: repeat(7,1fr) !important;
    background: #f0f7ff !important;
    padding: 4px 8px !important;
}
#cb-booking-wrapper .cb-jalcal-weekdays span {
    text-align: center !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    color: #1976d2 !important;
    padding: 3px 0 !important;
    font-family: inherit !important;
}
#cb-booking-wrapper .cb-jalcal-grid {
    display: grid !important;
    grid-template-columns: repeat(7,1fr) !important;
    gap: 3px !important;
    padding: 8px !important;
}
#cb-booking-wrapper .cb-jalcal-empty { display: block !important; }
#cb-booking-wrapper .cb-jalcal-day {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    aspect-ratio: 1 !important;
    border-radius: 50% !important;
    border: 1px solid transparent !important;
    font-size: 12px !important;
    font-family: inherit !important;
    cursor: default !important;
    transition: all 0.12s !important;
    padding: 0 !important;
    min-height: 30px !important;
    line-height: 1 !important;
}
#cb-booking-wrapper .cb-jcal-available:hover:not([disabled]) {
    background: #1976d2 !important;
    color: #fff !important;
    transform: scale(1.1) !important;
}
#cb-booking-wrapper .cb-jalcal-legend {
    display: flex !important;
    gap: 10px !important;
    padding: 6px 10px !important;
    border-top: 1px solid #f0f0f0 !important;
    font-size: 11px !important;
    color: #666 !important;
    flex-wrap: wrap !important;
    font-family: inherit !important;
}
#cb-booking-wrapper .cb-jalcal-legend span {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
}
