/* ============================================================
   ماژول نوبت‌دهی (AppointmentManagement)
   بخش اول: پنل کاربر (ap-*)  |  بخش دوم: پنل ادمین (apx-*)
   رنگ‌ها هم‌سبک بقیه‌ی پنل‌ها هستند؛ برای تغییر تم فقط متغیرهای ابتدای هر بخش را عوض کنید.
   ============================================================ */

/* ---------- 0) نکته‌های مشترک ---------- */
.up-badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.ap-alert-ok {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    padding: .75rem 1rem;
    margin-bottom: 1rem;
    font-size: .92rem;
}

/* ============================================================
   1) پنل کاربر
   ============================================================ */
.ap-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

    .ap-head .up-title {
        margin: 0;
    }

/* ---------- تب‌ها ---------- */
.ap-tabs {
    display: inline-flex;
    gap: .25rem;
    background: #ede9fe;
    padding: .25rem;
    border-radius: 999px;
    margin-bottom: 1rem;
}

.ap-tab {
    border: 0;
    background: transparent;
    padding: .5rem 1.1rem;
    border-radius: 999px;
    font: inherit;
    font-size: .9rem;
    color: #6b7280;
    cursor: pointer;
    transition: background .15s, color .15s;
}

    .ap-tab.is-active {
        background: #fff;
        color: #5b21b6;
        font-weight: 700;
        box-shadow: 0 1px 4px rgba(0, 0, 0, .1);
    }

.ap-tab-count {
    display: inline-block;
    min-width: 1.4rem;
    padding: 0 .35rem;
    margin-inline-start: .3rem;
    border-radius: 999px;
    background: #ddd6fe;
    color: #5b21b6;
    font-size: .75rem;
    text-align: center;
}

/* ---------- کارت نوبت ---------- */
.ap-list {
    display: grid;
    gap: .9rem;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
}

.ap-item {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(15, 23, 42, .05);
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.ap-item-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: .75rem;
}

    .ap-item-top strong {
        display: block;
        font-size: 1rem;
    }

    .ap-item-top small {
        display: block;
        margin-top: .15rem;
        color: #6b7280;
    }

.ap-when {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: #f5f3ff;
    border-radius: 12px;
    padding: .55rem .75rem;
    font-size: .9rem;
}

    .ap-when svg {
        color: #6d28d9;
        flex: none;
    }

.ap-item-foot {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: auto;
}

.ap-hint {
    font-size: .78rem;
    color: #92400e;
}

.ap-no {
    font-size: .78rem;
    color: #6b7280;
    margin-inline-start: auto;
}

.ap-reason {
    font-size: .82rem;
    color: #991b1b;
    background: #fef2f2;
    border-radius: 10px;
    padding: .45rem .7rem;
}

/* ---------- ویزارد ---------- */
.ap-steps {
    display: flex;
    gap: .4rem;
    margin-bottom: 1.1rem;
}

.ap-step {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: .8rem;
    color: #9ca3af;
}

    .ap-step::before {
        content: "";
        display: block;
        height: 5px;
        border-radius: 99px;
        background: #e5e7eb;
        margin-bottom: .4rem;
    }

    .ap-step.is-done, .ap-step.is-current {
        color: #5b21b6;
    }

        .ap-step.is-done::before, .ap-step.is-current::before {
            background: #6d28d9;
        }

    .ap-step.is-current {
        font-weight: 700;
    }

.ap-options {
    display: grid;
    gap: .7rem;
}

.ap-option {
    display: flex;
    align-items: center;
    gap: .85rem;
    width: 100%;
    text-align: start;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    padding: .85rem 1rem;
    font: inherit;
    color: inherit;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, background .15s;
}

    .ap-option:hover {
        border-color: #c4b5fd;
    }

    .ap-option.is-selected {
        border-color: #6d28d9;
        background: #faf7ff;
        box-shadow: 0 0 0 3px rgba(109, 40, 217, .12);
    }

    .ap-option:focus-visible, .ap-slot:focus-visible, .ap-day:focus-visible {
        outline: 3px solid rgba(109, 40, 217, .45);
        outline-offset: 2px;
    }

.ap-option-body {
    flex: 1;
    min-width: 0;
}

    .ap-option-body strong {
        display: block;
    }

    .ap-option-body small {
        display: block;
        color: #6b7280;
        margin-top: .15rem;
        line-height: 1.6;
    }

.ap-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-top: .5rem;
}

.ap-chip {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .15rem .6rem;
    border-radius: 999px;
    background: #ede9fe;
    color: #5b21b6;
    font-size: .76rem;
    font-weight: 600;
}

    .ap-chip.is-plain {
        background: #f1f5f9;
        color: #334155;
    }

.ap-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #ede9fe;
    color: #5b21b6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex: none;
}

.ap-radio {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #cbd0e0;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.is-selected > .ap-radio {
    border-color: #6d28d9;
    background: #6d28d9;
}

/* ---------- انتخاب روز ---------- */
.ap-month {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .6rem;
    font-weight: 700;
}

.ap-nav {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #374151;
}

    .ap-nav:disabled {
        opacity: .4;
        cursor: not-allowed;
    }

.ap-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: .45rem;
    margin-bottom: 1.1rem;
}

.ap-day {
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 14px;
    padding: .5rem .1rem;
    text-align: center;
    font: inherit;
    cursor: pointer;
    color: #111827;
}

    .ap-day small {
        display: block;
        font-size: .68rem;
        color: #6b7280;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .ap-day b {
        display: block;
        font-size: 1.1rem;
        margin: .1rem 0;
    }

    .ap-day em {
        display: block;
        font-style: normal;
        font-size: .64rem;
        color: #059669;
    }

    .ap-day.is-selected {
        background: #6d28d9;
        border-color: #6d28d9;
    }

        .ap-day.is-selected small, .ap-day.is-selected b, .ap-day.is-selected em {
            color: #fff;
        }

    .ap-day:disabled {
        background: #f3f4f6;
        cursor: not-allowed;
    }

        .ap-day:disabled b, .ap-day:disabled em {
            color: #9ca3af;
        }

/* ---------- ساعت‌ها ---------- */
.ap-group-title {
    font-size: .85rem;
    font-weight: 700;
    color: #4b5563;
    margin: .5rem 0 .45rem;
}

.ap-slots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
    gap: .5rem;
    margin-bottom: .75rem;
}

.ap-slot {
    height: 42px;
    border-radius: 999px;
    border: 1px solid #ddd6fe;
    background: #fff;
    color: #5b21b6;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s, color .15s;
}

    .ap-slot:hover {
        background: #f5f3ff;
    }

    .ap-slot.is-selected {
        background: #6d28d9;
        border-color: #6d28d9;
        color: #fff;
        box-shadow: 0 3px 8px rgba(109, 40, 217, .3);
    }

/* ---------- خلاصه و موفقیت ---------- */
.ap-summary {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: .25rem 1rem;
    margin-bottom: 1rem;
}

.ap-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .65rem 0;
    border-bottom: 1px dashed #e5e7eb;
    font-size: .92rem;
}

    .ap-row:last-child {
        border-bottom: 0;
    }

    .ap-row span {
        color: #6b7280;
    }

.ap-success {
    text-align: center;
    padding: 1.2rem .5rem;
}

.ap-success-ico {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #dcfce7;
    color: #15803d;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto .8rem;
}

.ap-track {
    display: inline-block;
    margin: .8rem 0 1rem;
    padding: .7rem 1.6rem;
    border: 2px dashed #c4b5fd;
    border-radius: 14px;
    background: #faf7ff;
}

    .ap-track small {
        display: block;
        color: #6b7280;
    }

    .ap-track b {
        font-size: 1.7rem;
        color: #5b21b6;
        letter-spacing: 1px;
    }

.ap-actions {
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

    .ap-actions .up-btn {
        flex: 1 1 140px;
    }

.ap-empty-slots {
    text-align: center;
    color: #6b7280;
    padding: 1.2rem .5rem;
    background: #f9fafb;
    border-radius: 14px;
}

/* ============================================================
   2) پنل ادمین
   ============================================================ */
.apx-stats {
    display: flex;
    gap: .8rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.apx-stat {
    background: #fff;
    border: 1px solid var(--border, #d6e3ec);
    border-radius: 14px;
    padding: .6rem 1.1rem;
    min-width: 130px;
}

    .apx-stat b {
        display: block;
        font-size: 1.4rem;
        color: var(--adm-ink, #0b2540);
    }

    .apx-stat span {
        font-size: .8rem;
        color: var(--text-muted, #5f7a90);
    }

    .apx-stat.is-hot {
        border-color: #fcd34d;
        background: #fffbeb;
    }

        .apx-stat.is-hot b {
            color: #92400e;
        }

.apx-filters {
    display: flex;
    flex-wrap: wrap;
    gap: .8rem;
    align-items: flex-end;
    margin-bottom: 1rem;
}

    .apx-filters label {
        display: block;
        font-size: .78rem;
        color: var(--text-muted, #5f7a90);
        margin-bottom: .25rem;
    }

    .apx-filters select, .apx-filters input {
        height: 38px;
        min-width: 150px;
        border: 1px solid var(--border, #bcd3e0);
        border-radius: 10px;
        padding: 0 .7rem;
        background: #fff;
        font: inherit;
    }

.apx-tabs {
    display: flex;
    gap: .25rem;
    border-bottom: 2px solid var(--border, #d6e3ec);
    margin-bottom: 1rem;
}

.apx-tab {
    border: 0;
    background: transparent;
    padding: .55rem 1.1rem;
    font: inherit;
    color: var(--text-muted, #4f6a80);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
}

    .apx-tab.is-active {
        color: var(--adm-primary, #0e7490);
        border-color: var(--adm-primary, #0e7490);
        font-weight: 700;
    }

.apx-user small, .apx-sub small {
    display: block;
    color: var(--text-muted, #5f7a90);
    font-size: .76rem;
    margin-top: .1rem;
}

.apx-acts {
    display: flex;
    gap: .35rem;
    flex-wrap: wrap;
}

.apx-btn {
    border: 1px solid transparent;
    border-radius: 999px;
    padding: .3rem .8rem;
    font: inherit;
    font-size: .8rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

    .apx-btn:disabled {
        opacity: .55;
        cursor: not-allowed;
    }

.apx-btn-ok {
    background: #047857;
    color: #fff;
}

.apx-btn-main {
    background: var(--adm-primary, #0e7490);
    color: #fff;
}

.apx-btn-warn {
    background: #fff;
    color: #92400e;
    border-color: #fcd34d;
}

.apx-btn-danger {
    background: #fff;
    color: #b91c1c;
    border-color: #fca5a5;
}

.apx-btn-ghost {
    background: #fff;
    color: var(--adm-primary, #0e7490);
    border-color: var(--border, #bcd3e0);
}

.apx-reason {
    font-size: .74rem;
    color: #991b1b;
    margin-top: .15rem;
}

/* ---------- برنامه‌ی روز ---------- */
.apx-agenda-bar {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

    .apx-agenda-bar b {
        font-size: 1.05rem;
    }

.apx-agenda {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: .9rem;
}

.apx-col {
    background: #fff;
    border: 1px solid var(--border, #bcd3e0);
    border-radius: 14px;
    overflow: hidden;
}

.apx-col-head {
    background: #e0f4f9;
    background: color-mix(in srgb, var(--adm-primary, #0e7490) 12%, #fff);
    padding: .6rem .9rem;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    gap: .5rem;
}

.apx-ev {
    margin: .55rem;
    padding: .55rem .7rem;
    border-radius: 10px;
    border-inline-start: 4px solid;
    font-size: .84rem;
    line-height: 1.6;
}

    .apx-ev b {
        display: block;
    }

    .apx-ev.is-ok {
        background: #d1fae5;
        border-color: #047857;
    }

    .apx-ev.is-wait {
        background: #fef3c7;
        border-color: #d97706;
    }

    .apx-ev.is-done {
        background: #e2e8f0;
        border-color: #64748b;
    }

    .apx-ev.is-off {
        background: #fee2e2;
        border-color: #dc2626;
        opacity: .8;
    }

.apx-col-empty {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted, #5f7a90);
    font-size: .85rem;
}

/* ---------- برنامه‌ی هفتگی ---------- */
.apx-day-row {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: .7rem 0;
    border-bottom: 1px solid var(--border, #dbe7ef);
}

    .apx-day-row:last-child {
        border-bottom: 0;
    }

.apx-day-name {
    width: 90px;
    font-weight: 700;
    padding-top: .35rem;
    flex: none;
}

.apx-intervals {
    display: flex;
    flex-direction: column;
    gap: .45rem;
    flex: 1;
}

.apx-interval {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

    .apx-interval input[type=time] {
        height: 36px;
        border: 1px solid var(--border, #bcd3e0);
        border-radius: 8px;
        padding: 0 .5rem;
        font: inherit;
        direction: ltr;
    }

.apx-off {
    color: var(--text-muted, #8aa0b2);
    padding-top: .35rem;
}

.apx-timeoff {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .6rem;
    padding: .5rem .7rem;
    border: 1px solid #fcd34d;
    background: #fffbeb;
    border-radius: 10px;
    margin-bottom: .45rem;
    font-size: .85rem;
}

.apx-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: .45rem;
}

.apx-check {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .45rem .7rem;
    border: 1px solid var(--border, #bcd3e0);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    font-size: .88rem;
}

@media (max-width: 640px) {
    .ap-days {
        gap: .3rem;
    }

    .ap-day b {
        font-size: .98rem;
    }

    .apx-day-row {
        flex-direction: column;
        gap: .4rem;
    }

    .apx-day-name {
        width: auto;
        padding-top: 0;
    }
}
