/* =========================================================
   Vazirmatn
   ========================================================= */

@font-face {
    font-family: 'Vazirmatn';
    src: url('/fonts/Vazirmatn-RD-Thin.ttf') format('truetype');
    font-weight: 100;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('/fonts/Vazirmatn-RD-ExtraLight.ttf') format('truetype');
    font-weight: 200;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('/fonts/Vazirmatn-RD-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('/fonts/Vazirmatn-RD-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('/fonts/Vazirmatn-RD-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('/fonts/Vazirmatn-RD-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('/fonts/Vazirmatn-RD-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('/fonts/Vazirmatn-RD-ExtraBold.ttf') format('truetype');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('/fonts/VAZIRMATN-RD-BLACK.TTF') format('truetype');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}


/* =========================================================
   Base
   ========================================================= */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
    --info: #0891b2;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 22px;
    --shadow-sm: 0 4px 14px rgba(15, 23, 42, .06);
    --shadow-md: 0 10px 30px rgba(15, 23, 42, .10);
    --shadow-lg: 0 20px 60px rgba(15, 23, 42, .16);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
}


html,
body {
    width: 100%;
    min-height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    font-family: 'Vazirmatn', sans-serif;
    direction: rtl;
    background: #f4f7fb;
    color: var(--text);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}


*,
*::before,
*::after {
    box-sizing: border-box;
}


button,
input,
textarea,
select {
    font-family: 'Vazirmatn', sans-serif;
}


button,
a,
input,
select,
textarea {
    -webkit-tap-highlight-color: transparent;
}


button {
    touch-action: manipulation;
}


:focus {
    outline: none;
}


::selection {
    background: rgba(37, 99, 235, .18);
}


/* =========================================================
   Typography
   ========================================================= */

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
}


a,
.btn-link {
    color: #006bb7;
}


/* =========================================================
   Blazor Validation
   ========================================================= */

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}


.invalid {
    outline: 1px solid var(--danger);
}


.validation-message {
    color: var(--danger);
    font-size: 12px;
    margin-top: 6px;
    display: block;
}


/* =========================================================
   Blazor Error UI
   ========================================================= */

#blazor-error-ui {
    background: #fff7cc;
    bottom: 0;
    left: 0;
    box-shadow: 0 -1px 8px rgba(0, 0, 0, .15);
    display: none;
    padding: 12px calc(20px + var(--safe-right)) calc(12px + var(--safe-bottom)) calc(20px + var(--safe-left));
    position: fixed;
    width: 100%;
    z-index: 100000;
}


    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: calc(12px + var(--safe-right));
        top: 8px;
    }


/* =========================================================
   iOS Safe Area
   ========================================================= */

.status-bar-safe-area {
    display: none;
}


@supports (-webkit-touch-callout: none) {

    .status-bar-safe-area {
        display: block;
        position: sticky;
        top: 0;
        width: 100%;
        height: var(--safe-top);
        z-index: 1;
    }
}


/* =========================================================
   GLOBAL LOADING
   ========================================================= */

.global-loading-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    width: 100dvw;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: calc(24px + var(--safe-top)) calc(24px + var(--safe-right)) calc(24px + var(--safe-bottom)) calc(24px + var(--safe-left));
    background: rgba(15, 23, 42, .42);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 20000;
    animation: loadingOverlayIn .18s ease-out;
}


.global-loading-box {
    width: min(320px, calc(100vw - 40px));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 28px 24px;
    border-radius: 24px;
    background: rgba(255, 255, 255, .96);
    border: 1px solid rgba(255, 255, 255, .7);
    box-shadow: 0 25px 70px rgba(0, 0, 0, .20);
    text-align: center;
}


.loading-spinner {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 4px solid #e2e8f0;
    border-top-color: var(--primary);
    animation: loadingSpin .8s linear infinite;
}


.loading-text {
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.8;
    text-align: center;
}


@keyframes loadingSpin {

    to {
        transform: rotate(360deg);
    }
}


@keyframes loadingOverlayIn {

    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}


/* =========================================================
   TOAST
   ========================================================= */

.toast-container {
    position: fixed;
    top: calc(20px + var(--safe-top));
    right: calc(20px + var(--safe-right));
    width: min(420px, calc(100vw - 40px));
    z-index: 30000;
    pointer-events: none;
    direction: rtl;
}


.custom-toast {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-height: 72px;
    padding: 15px 17px;
    border-radius: 18px;
    background: rgba(255, 255, 255, .96);
    border: 1px solid rgba(255, 255, 255, .7);
    box-shadow: 0 15px 45px rgba(15, 23, 42, .18);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    overflow: hidden;
    animation: toastIn .28s cubic-bezier(.2, .8, .2, 1);
    pointer-events: auto;
}


    .custom-toast::before {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        right: 0;
        width: 5px;
        background: var(--primary);
    }


.toast-content {
    flex: 1;
    min-width: 0;
    padding-right: 4px;
}


.toast-title {
    margin-bottom: 3px;
    color: var(--text);
    font-size: 14px;
    font-weight: 800;
    line-height: 1.5;
}


.toast-message {
    color: #475569;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.7;
    overflow-wrap: anywhere;
}


.toast-close {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #64748b;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, transform .15s ease;
}


    .toast-close:hover {
        background: #f1f5f9;
        color: #0f172a;
    }


    .toast-close:active {
        transform: scale(.92);
    }


/* Toast Types */

.toast-success::before {
    background: var(--success);
}


.toast-error::before {
    background: var(--danger);
}


.toast-warning::before {
    background: var(--warning);
}


.toast-info::before {
    background: var(--info);
}


.toast-success {
    background: linear-gradient( 135deg, rgba(240, 253, 244, .98), rgba(255, 255, 255, .97) );
}


.toast-error {
    background: linear-gradient( 135deg, rgba(254, 242, 242, .98), rgba(255, 255, 255, .97) );
}


.toast-warning {
    background: linear-gradient( 135deg, rgba(255, 251, 235, .98), rgba(255, 255, 255, .97) );
}


.toast-info {
    background: linear-gradient( 135deg, rgba(240, 249, 255, .98), rgba(255, 255, 255, .97) );
}


@keyframes toastIn {

    from {
        opacity: 0;
        transform: translate3d(25px, -10px, 0) scale(.96);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}


/* =========================================================
   Appointment Booking
   ========================================================= */

.booking-layout {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr) 320px;
    gap: 15px;
    width: 100%;
    padding: 15px;
}


/* =========================================================
   Glass Card
   ========================================================= */

.glass-card {
    background: rgba(255, 255, 255, .92);
    border-radius: 18px;
    padding: 15px;
    border: 1px solid rgba(226, 232, 240, .8);
    box-shadow: var(--shadow-sm);
    transition: transform .2s ease, box-shadow .2s ease;
}


@media (hover: hover) {

    .glass-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
    }
}


/* =========================================================
   Inputs
   ========================================================= */

.inp {
    width: 100%;
    min-height: 48px;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 0 15px;
    background: #f6f8fb;
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--text);
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}


    .inp:focus {
        background: white;
        border-color: rgba(37, 99, 235, .35);
        box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
    }


/* =========================================================
   Buttons
   ========================================================= */

.booking-btn-primary,
.booking-btn-success,
.booking-btn-danger,
.booking-btn-warning {
    border: none;
    color: white;
    cursor: pointer;
    font-weight: 600;
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
    touch-action: manipulation;
}


.booking-btn-primary {
    width: 100%;
    min-height: 48px;
    border-radius: 12px;
    background: var(--primary);
}


.booking-btn-success,
.booking-btn-danger,
.booking-btn-warning {
    width: 40%;
    min-height: 40px;
    border-radius: 12px;
    text-align: center;
}


.booking-btn-success {
    background: var(--success);
}


.booking-btn-danger {
    background: var(--danger);
}


.booking-btn-warning {
    background: var(--warning);
}


@media (hover: hover) {

    .booking-btn-primary:hover,
    .booking-btn-success:hover,
    .booking-btn-danger:hover,
    .booking-btn-warning:hover {
        filter: brightness(.96);
        box-shadow: 0 6px 18px rgba(15, 23, 42, .12);
    }
}


.booking-btn-primary:active,
.booking-btn-success:active,
.booking-btn-danger:active,
.booking-btn-warning:active {
    transform: scale(.98);
}


/* =========================================================
   Patient
   ========================================================= */

.patient-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 15px;
    padding: 15px;
    border-radius: 12px;
    background: #f7fafc;
}


/* =========================================================
   Services
   ========================================================= */

.service-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 14px;
    cursor: pointer;
    background: white;
    border: 1px solid #edf2f7;
    transition: transform .18s ease, border-color .18s ease, background .18s ease;
}


@media (hover: hover) {

    .service-card:hover {
        transform: translateY(-2px);
        border-color: var(--primary);
    }
}


.service-card.selected {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}


/* =========================================================
   Calendar
   ========================================================= */

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 10px;
}


    .calendar-header button {
        width: 40px;
        height: 40px;
        flex: 0 0 auto;
        border: none;
        border-radius: 50%;
        background: #f1f5f9;
        cursor: pointer;
        display: flex;
        justify-content: center;
        align-items: center;
        touch-action: manipulation;
    }


.week-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 10px;
    text-align: center;
    font-weight: 700;
}


.week-day {
    text-align: center;
}


.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
}


.calendar-empty {
    min-height: 90px;
}


.calendar-day {
    position: relative;
    min-height: 90px;
    background: white;
    border-radius: 16px;
    padding: 10px;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .04);
}


    .calendar-day.today {
        border: 3px solid var(--primary);
    }


        .calendar-day.today::after {
            content: 'امروز';
            position: absolute;
            top: 5px;
            left: 5px;
            background: var(--primary);
            color: white;
            padding: 2px 6px;
            border-radius: 6px;
            font-size: 10px;
        }


    .calendar-day.selected {
        background: var(--primary);
        color: white;
    }


@media (hover: hover) {

    .calendar-day:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-sm);
    }
}


.appointment-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}


.capacity-number {
    font-size: 24px;
    font-weight: 700;
}


/* =========================================================
   Capacity
   ========================================================= */

.color-guide {
    width: 170px;
    min-height: 25px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    padding: 5px;
    font-size: 12px;
}


.capacity-high {
    border-right: 6px solid #16a34a;
    background: #16a34a;
}


.capacity-medium {
    border-right: 6px solid #ffc107;
    background: #ffc107;
}


.capacity-min {
    border-right: 6px solid #ff8300;
    background: #ff8300;
}


.capacity-full {
    border-right: 6px solid #583a1a;
    background: #583a1a;
}


.capacity-low {
    border-right: 6px solid #dc2626;
    background: #dc2626;
}


.capacity-badge {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 12px;
}


/* =========================================================
   Time Grid
   ========================================================= */

.time-grid {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 10px;
    margin-top: 15px;
}


.time-btn {
    min-height: 55px;
    border: 1px dashed #e1e1e1;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: transform .18s ease, background .18s ease;
    text-align: center;
    touch-action: manipulation;
}


    .time-btn.selected {
        background: var(--primary);
        color: white;
        border: none;
    }


@media (hover: hover) {

    .time-btn:hover {
        transform: translateY(-2px);
    }
}


/* =========================================================
   Reservation
   ========================================================= */

.day-reservation {
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 10px;
    background: #f8fafc;
    border-right: 4px solid var(--primary);
}


.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #edf2f7;
}


/* =========================================================
   Modal
   ========================================================= */

.modal-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    width: 100dvw;
    height: 100dvh;
    background: rgba(15, 23, 42, .50);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: calc(20px + var(--safe-top)) calc(20px + var(--safe-right)) calc(20px + var(--safe-bottom)) calc(20px + var(--safe-left));
    z-index: 10000;
    overflow-y: auto;
}


.modal-box {
    width: min(500px, 100%);
    max-height: calc(100dvh - 40px - var(--safe-top) - var(--safe-bottom));
    overflow-y: auto;
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: var(--shadow-lg);
}


/* =========================================================
   Modal Validation
   ========================================================= */

.modal-validation-error {
    margin-top: 5px;
    color: var(--danger);
    font-size: 13px;
    font-weight: 500;
}


.modal-validation-message {
    color: var(--danger);
    font-size: 13px;
    margin-top: 0;
    margin-bottom: 10px;
}


.modal-validation-summary-errors {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 15px;
}


.modal-input-validation-error {
    border: 1px solid var(--danger) !important;
}


/* =========================================================
   Timeline
   ========================================================= */

.timeline {
    margin-top: 20px;
}


.timeline-item {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}


.timeline-dot {
    width: 12px;
    height: 12px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--primary);
    margin-top: 6px;
}


.capacity-card {
    padding: 15px;
    border-radius: 15px;
    background: #eff6ff;
    margin-bottom: 15px;
}


/* =========================================================
   Scheduler
   ========================================================= */

.booking-grid {
    display: grid;
    grid-template-columns: 260px 300px minmax(0, 1fr) 280px;
    gap: 15px;
    min-height: 100dvh;
}


.scheduler {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 800px;
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}


.scheduler-row {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr);
    align-items: center;
    min-height: 60px;
    border-radius: 12px;
    cursor: pointer;
    transition: background .18s ease;
}


    .scheduler-row.free {
        background: #f8fafc;
    }


    .scheduler-row.reserved {
        background: #fee2e2;
    }


    .scheduler-row.selected {
        background: var(--primary);
        color: white;
    }


.scheduler-time {
    text-align: center;
    font-weight: 700;
}


.day-scheduler {
    position: relative;
    min-height: 2000px;
}


.time-row {
    display: grid;
    grid-template-columns: 70px minmax(0, 1fr);
    height: 40px;
}


.time-label {
    text-align: center;
    font-size: 13px;
    color: #64748b;
}


.time-line {
    border-top: 1px solid #e2e8f0;
}


.appointment-block {
    position: absolute;
    right: 80px;
    left: 10px;
    border-radius: 12px;
    padding: 10px;
    overflow: hidden;
    cursor: pointer;
}


.visit {
    background: #dbeafe;
    border-right: 5px solid var(--primary);
}


.sono {
    background: #fef3c7;
    border-right: 5px solid var(--warning);
}


.lab {
    background: #dcfce7;
    border-right: 5px solid var(--success);
}


/* =========================================================
   Server
   ========================================================= */

.server-card {
    border-radius: 20px;
    border: none;
    transition: transform .2s ease;
}


@media (hover: hover) {

    .server-card:hover {
        transform: translateY(-3px);
    }
}


.server-icon {
    font-size: 80px;
}


.server-value {
    font-size: 22px;
    font-weight: 600;
}


.server-title {
    color: #6c757d;
    font-size: 14px;
}


.server-section {
    border-radius: 15px;
    background: #f8f9fa;
    padding: 15px;
}


/* =========================================================
   Foreign National
   ========================================================= */

.foreign-national-option {
    direction: rtl;
    margin-bottom: 15px;
}


    .foreign-national-option label {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        cursor: pointer;
        user-select: none;
    }


    .foreign-national-option input[type="checkbox"] {
        width: 18px;
        height: 18px;
        cursor: pointer;
        margin: 0;
    }


/* =========================================================
   Responsive - Tablet
   ========================================================= */

@media (max-width: 1200px) {

    .booking-layout {
        grid-template-columns: 1fr;
    }

    .booking-grid {
        grid-template-columns: 1fr 1fr;
    }

    .time-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}


/* =========================================================
   Tablet - iPad / Samsung Tablet
   ========================================================= */

@media (min-width: 768px) and (max-width: 1024px) {

    .booking-layout {
        padding: 12px;
        gap: 12px;
    }

    .glass-card {
        padding: 16px;
    }

    .calendar-grid {
        gap: 8px;
    }

    .calendar-day {
        min-height: 82px;
        padding: 8px;
    }

    .time-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 8px;
    }

    .booking-grid {
        grid-template-columns: 1fr;
    }

    .toast-container {
        width: min(440px, calc(100vw - 32px));
        top: calc(16px + var(--safe-top));
        right: calc(16px + var(--safe-right));
    }
}


/* =========================================================
   Mobile - iPhone / Samsung
   ========================================================= */

@media (max-width: 767px) {

    html,
    body {
        font-size: 14px;
    }


    .booking-layout {
        display: flex;
        flex-direction: column;
        padding: 8px calc(8px + var(--safe-right)) calc(12px + var(--safe-bottom)) calc(8px + var(--safe-left));
        gap: 10px;
    }


    .glass-card {
        padding: 12px;
        margin: 0;
        border-radius: 16px;
    }


    .booking-grid {
        display: flex;
        flex-direction: column;
        min-height: auto;
        gap: 10px;
    }


    .calendar-grid {
        gap: 5px;
    }


    .calendar-empty {
        min-height: 60px;
    }


    .calendar-day {
        min-height: 64px;
        padding: 6px;
        border-radius: 12px;
        font-size: 12px;
    }


        .calendar-day.today {
            border-width: 2px;
        }


            .calendar-day.today::after {
                top: 3px;
                left: 3px;
                font-size: 8px;
                padding: 2px 4px;
            }


    .capacity-number {
        font-size: 19px;
    }


    .week-row {
        font-size: 11px;
    }


    .time-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 7px;
    }


    .time-btn {
        min-height: 48px;
        border-radius: 10px;
    }


    .color-guide {
        width: 100%;
        min-height: 30px;
    }


    .booking-btn-primary {
        min-height: 50px;
    }


    .booking-btn-success,
    .booking-btn-danger,
    .booking-btn-warning {
        width: 100%;
        min-height: 44px;
    }


    .calendar-header {
        margin-bottom: 12px;
    }


        .calendar-header button {
            width: 42px;
            height: 42px;
        }


    /* -----------------------------------------
       Modal
       ----------------------------------------- */

    .modal-overlay {
        align-items: flex-end;
        padding: 10px calc(10px + var(--safe-right)) calc(10px + var(--safe-bottom)) calc(10px + var(--safe-left));
    }


    .modal-box {
        width: 100%;
        max-height: calc(92dvh - var(--safe-top) - var(--safe-bottom));
        border-radius: 22px 22px 16px 16px;
        padding: 20px 16px calc(20px + var(--safe-bottom)) 16px;
        animation: modalMobileIn .22s ease-out;
    }


    @keyframes modalMobileIn {

        from {
            transform: translateY(30px);
            opacity: 0;
        }

        to {
            transform: translateY(0);
            opacity: 1;
        }
    }


    /* -----------------------------------------
       Toast
       ----------------------------------------- */

    .toast-container {
        top: auto;
        right: calc(10px + var(--safe-right));
        bottom: calc(12px + var(--safe-bottom));
        left: calc(10px + var(--safe-left));
        width: auto;
    }


    .custom-toast {
        width: 100%;
        min-height: 68px;
        padding: 13px 14px;
        border-radius: 17px;
    }


    .toast-title {
        font-size: 13px;
    }


    .toast-message {
        font-size: 12px;
        line-height: 1.8;
    }


    .toast-close {
        width: 34px;
        height: 34px;
    }


    /* -----------------------------------------
       Loading
       ----------------------------------------- */

    .global-loading-box {
        width: min( 290px, calc(100vw - 40px) );
        padding: 25px 20px;
        border-radius: 22px;
    }


    .loading-spinner {
        width: 44px;
        height: 44px;
    }


    .loading-text {
        font-size: 14px;
    }


    /* -----------------------------------------
       Scheduler
       ----------------------------------------- */

    .scheduler {
        max-height: 70dvh;
    }


    .scheduler-row {
        grid-template-columns: 70px minmax(0, 1fr);
        min-height: 54px;
    }


    .appointment-block {
        right: 65px;
        left: 5px;
        padding: 8px;
        border-radius: 10px;
    }
}


/* =========================================================
   Very Small Phones
   ========================================================= */

@media (max-width: 380px) {

    .calendar-day {
        min-height: 56px;
        padding: 4px;
        font-size: 11px;
    }


    .calendar-grid {
        gap: 3px;
    }


    .time-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }


    .custom-toast {
        padding: 12px;
    }
}


/* =========================================================
   Reduced Motion
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}


/* =========================================================
   LOGIN
   ========================================================= */

.login-page {
    min-height: 100vh;
    width: 100%;
    position: relative;
    overflow: hidden;
    border-radius: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    direction: rtl;
    font-family: Vazirmatn, "Segoe UI", sans-serif;
    background: linear-gradient(135deg, rgb(248, 245, 255) 0%, rgb(242, 246, 255) 45%, rgb(249, 251, 255) 100%);
}

.login-card {
    width: min(430px, 100%);
    background: rgba(255,255,255,.94);
    border: 1px solid rgba(255,255,255,.8);
    border-radius: 28px;
    padding: 38px 32px;
    box-shadow: 0 25px 70px rgba(15,23,42,.12), 0 4px 15px rgba(15,23,42,.05);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}


/* Logo */

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 18px;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 34px;
    background: linear-gradient(135deg,#ec4899,#8b5cf6);
    box-shadow: 0 12px 30px rgba(236,72,153,.25);
}

.login-logo h1 {
    margin: 0;
    font-size: 25px;
    font-weight: 800;
    color: #172033;
}

.login-logo p {
    margin: 10px 0 0;
    color: #64748b;
    font-size: 14px;
    font-weight: 400;
}


/* Fields */

.login-field {
    margin-bottom: 20px;
}

    .login-field label {
        display: block;
        margin-bottom: 8px;
        font-size: 14px;
        font-weight: 700;
        color: #334155;
    }

.phone-input-wrapper {
    height: 54px;
    display: flex;
    align-items: center;
    direction: ltr;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    transition: .2s;
}

    .phone-input-wrapper:focus-within {
        border-color: #ec4899;
        box-shadow: 0 0 0 4px rgba(236,72,153,.10);
    }

.phone-prefix {
    padding: 0 14px;
    border-right: 1px solid #e2e8f0;
    font-size: 19px;
}

.phone-input {
    flex: 1;
    height: 100%;
    border: 0 !important;
    outline: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 14px;
    direction: ltr;
    text-align: left;
    font-family: Arial,sans-serif !important;
    font-size: 16px;
    font-weight: 600 !important;
}


/* Button */

.login-button {
    width: 100%;
    height: 54px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg,#ec4899,#8b5cf6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 10px 25px rgba(236,72,153,.22);
    transition: transform .2s, box-shadow .2s;
}

    .login-button:hover:not(:disabled) {
        transform: translateY(-1px);
        box-shadow: 0 14px 30px rgba(236,72,153,.28);
    }

    .login-button:active:not(:disabled) {
        transform: scale(.98);
    }

    .login-button:disabled {
        opacity: .7;
        cursor: wait;
    }

.button-arrow {
    font-size: 20px;
}


/* Spinner */

.button-spinner {
    width: 19px;
    height: 19px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: white;
    border-radius: 50%;
    animation: login-spin .7s linear infinite;
}

@keyframes login-spin {
    to {
        transform: rotate(360deg);
    }
}


/* OTP */

.otp-section {
    text-align: center;
}

.otp-icon {
    width: 62px;
    height: 62px;
    margin: 0 auto 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ecfdf5;
    color: #16a34a;
    font-size: 28px;
    font-weight: 900;
}

.otp-section h2 {
    margin: 0 0 10px;
    font-size: 22px;
    font-weight: 800;
    color: #172033;
}

.otp-description {
    margin-bottom: 26px;
    color: #64748b;
    font-size: 14px;
    line-height: 2;
}

    .otp-description strong {
        direction: ltr;
        display: inline-block;
        color: #334155;
        font-family: Arial,sans-serif !important;
        font-weight: 700;
    }

.otp-input {
    width: 100%;
    height: 60px;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    outline: none;
    text-align: center !important;
    direction: ltr;
    letter-spacing: 10px;
    padding-left: 10px;
    font-family: Arial,sans-serif !important;
    font-size: 24px;
    font-weight: 700 !important;
}

    .otp-input:focus {
        border-color: #ec4899;
        box-shadow: 0 0 0 4px rgba(236,72,153,.10);
    }


/* Error */

.login-error {
    margin: -5px 0 18px;
    padding: 11px 13px;
    border-radius: 10px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    font-size: 13px;
    text-align: right;
}


/* Change number */

.change-number-button {
    width: 100%;
    margin-top: 14px;
    height: 45px;
    border: 0;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    font-size: 13px;
}

    .change-number-button:hover {
        color: #ec4899;
    }


/* Validation */

.login-field .validation-message {
    margin-top: 7px;
    color: #dc2626;
    font-size: 12px;
}


/* Mobile */

@media (max-width: 600px) {

    .login-page {
        padding: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right));
        align-items: center;
    }

    .login-card {
        padding: 30px 22px;
        border-radius: 24px;
    }

    .login-logo {
        margin-bottom: 27px;
    }

    .login-logo-icon {
        width: 64px;
        height: 64px;
        border-radius: 19px;
        font-size: 30px;
    }

    .login-logo h1 {
        font-size: 22px;
    }

    .login-button {
        height: 56px;
    }
}


/* iPhone / Samsung portrait */

@media (max-width: 430px) {

    .login-page {
        padding: 16px;
    }

    .login-card {
        width: 100%;
        padding: 28px 20px;
    }

    .login-logo-icon {
        width: 60px;
        height: 60px;
    }

    .login-logo h1 {
        font-size: 21px;
    }

    .phone-input-wrapper {
        height: 56px;
    }

    .otp-input {
        height: 58px;
        font-size: 22px;
    }
}


/* iPad / Samsung Tablet */

@media (min-width: 601px) and (max-width: 1100px) {

    .login-card {
        width: 440px;
    }
}


/* Landscape mobile */

@media (max-height: 600px) and (orientation: landscape) {

    .login-page {
        align-items: flex-start;
        padding-top: 20px;
        padding-bottom: 20px;
    }

    .login-card {
        padding: 22px 28px;
    }

    .login-logo {
        margin-bottom: 18px;
    }

    .login-logo-icon {
        width: 50px;
        height: 50px;
        margin-bottom: 10px;
    }
}




/* Login Style */

* {
    box-sizing: border-box;
}


.login-page {
    min-height: 100vh;
    width: 100%;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    direction: rtl;
    font-family: "Vazirmatn", "Segoe UI", sans-serif;
    background: linear-gradient( 135deg, #f8f5ff 0%, #f2f6ff 45%, #f9fbff 100% );
}


/* ========================================= */
/* Background Shapes                         */
/* ========================================= */

.background-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(2px);
    opacity: .45;
    pointer-events: none;
}


.shape-1 {
    width: 420px;
    height: 420px;
    top: -180px;
    right: -120px;
    background: radial-gradient( circle, rgba(137, 95, 255, .22), transparent 70% );
}


.shape-2 {
    width: 500px;
    height: 500px;
    bottom: -260px;
    left: -180px;
    background: radial-gradient( circle, rgba(67, 154, 255, .18), transparent 70% );
}


.shape-3 {
    width: 250px;
    height: 250px;
    top: 45%;
    left: 25%;
    background: radial-gradient( circle, rgba(220, 100, 200, .10), transparent 70% );
}


/* ========================================= */
/* Wrapper                                   */
/* ========================================= */

.login-wrapper {
    width: 100%;
    max-width: 470px;
    padding: 25px;
    position: relative;
    z-index: 2;
    animation: loginAppear .6s ease;
}


@keyframes loginAppear {

    from {
        opacity: 0;
        transform: translateY(20px) scale(.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


/* ========================================= */
/* Card                                      */
/* ========================================= */

.login-card {
    padding: 42px 40px 25px;
    border-radius: 28px;
    background: rgba(255, 255, 255, .78);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, .85);
    box-shadow: 0 25px 70px rgba(60, 45, 100, .12);
}


/* ========================================= */
/* Brand                                     */
/* ========================================= */

.brand {
    text-align: center;
    margin-bottom: 38px;
}

.brand-logo {
    width: 82px;
    height: 82px;

    margin: 0 auto 16px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 24px;

    background: rgba(255, 255, 255, .9);

    border: 1px solid rgba(255, 255, 255, .95);

    box-shadow:
        0 14px 35px rgba(70, 50, 110, .14);

    overflow: hidden;
}

.brand-logo img {
    width: 72px;
    height: 72px;

    object-fit: contain;

    display: block;
}
.brand-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    color: white;
    font-size: 28px;
    background: linear-gradient( 135deg, #8064e8, #a878e8 );
    box-shadow: 0 12px 25px rgba(128, 100, 232, .30);
}


.brand-name {
    font-size: 23px;
    font-weight: 800;
    color: #262333;
}


.brand-subtitle {
    margin-top: 6px;
    font-size: 13px;
    color: #8b8798;
}


/* ========================================= */
/* Content                                   */
/* ========================================= */

.login-content {
    animation: contentAppear .35s ease;
}


@keyframes contentAppear {

    from {
        opacity: 0;
        transform: translateX(10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}


.login-title {
    font-size: 25px;
    font-weight: 800;
    color: #282435;
    text-align: center;
}


.login-description {
    margin-top: 9px;
    margin-bottom: 30px;
    text-align: center;
    font-size: 14px;
    line-height: 1.8;
    color: #8a8795;
}


    .login-description strong {
        color: #6852bd;
        direction: ltr;
        display: inline-block;
    }


/* ========================================= */
/* Input                                     */
/* ========================================= */

.input-wrapper {
    margin-bottom: 20px;
}


    .input-wrapper label {
        display: block;
        margin-bottom: 9px;
        font-size: 13px;
        font-weight: 700;
        color: #4a4655;
    }


.input-container {
    position: relative;
}


.input-icon {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    font-size: 18px;
    color: #927de0;
    z-index: 2;
}


.login-input {
    width: 100%;
    height: 55px;
    border-radius: 15px;
    border: 1px solid #e5e1ed;
    background: rgba(255,255,255,.72);
    padding: 0 48px 0 16px;
    font-size: 16px;
    color: #302c39;
    outline: none;
    transition: .2s ease;
}


    .login-input:focus {
        border-color: #8b72df;
        background: white;
        box-shadow: 0 0 0 4px rgba(139,114,223,.10);
    }


    .login-input::placeholder {
        color: #b4afbd;
    }


/* ========================================= */
/* OTP                                       */
/* ========================================= */

.otp-icon {
    width: 58px;
    height: 58px;
    margin: 0 auto 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #6e55c8;
    font-size: 25px;
    font-weight: bold;
    background: rgba(126, 99, 222, .10);
}


.otp-input {
    width: 100%;
    height: 65px;
    border-radius: 16px;
    border: 1px solid #e2deeb;
    background: white;
    text-align: center;
    letter-spacing: 14px;
    padding-right: 14px;
    font-size: 25px;
    font-weight: 800;
    color: #49358e;
    outline: none;
    transition: .2s ease;
}


    .otp-input:focus {
        border-color: #8b72df;
        box-shadow: 0 0 0 4px rgba(139,114,223,.10);
    }


/* ========================================= */
/* Error                                     */
/* ========================================= */

.error-message {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 12px 14px;
    margin-bottom: 18px;
    border-radius: 12px;
    background: #fff1f2;
    color: #c43f52;
    font-size: 13px;
    line-height: 1.7;
}


.error-icon {
    width: 21px;
    height: 21px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: white;
    font-size: 12px;
    font-weight: bold;
    background: #df5668;
}


/* ========================================= */
/* Button                                    */
/* ========================================= */

.login-button {
    width: 100%;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    border: none;
    border-radius: 15px;
    color: white;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    background: linear-gradient( 135deg, #7458d1, #9872e5 );
    box-shadow: 0 10px 25px rgba(116,88,209,.25);
    transition: .2s ease;
}


    .login-button:hover:not(:disabled) {
        transform: translateY(-2px);
        box-shadow: 0 14px 30px rgba(116,88,209,.32);
    }


    .login-button:active:not(:disabled) {
        transform: translateY(0);
    }


    .login-button:disabled {
        opacity: .65;
        cursor: not-allowed;
    }


.button-arrow {
    font-size: 20px;
    transition: .2s ease;
}


.login-button:hover
.button-arrow {
    transform: translateX(-4px);
}


/* ========================================= */
/* Spinner                                   */
/* ========================================= */

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: white;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}


@keyframes spin {

    to {
        transform: rotate(360deg);
    }
}


/* ========================================= */
/* Change phone                              */
/* ========================================= */

.change-phone-button {
    width: 100%;
    margin-top: 15px;
    padding: 8px;
    border: none;
    background: transparent;
    color: #7564a8;
    font-size: 13px;
    cursor: pointer;
}


    .change-phone-button:hover {
        color: #5338a1;
    }


/* ========================================= */
/* Footer                                    */
/* ========================================= */

.login-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(0,0,0,.06);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 9px;
    color: #aaa6b2;
    font-size: 11px;
}


.footer-dot {
    color: #c4bfd0;
}


/* ========================================= */
/* Mobile                                    */
/* ========================================= */

@media (max-width: 520px) {

    .login-wrapper {
        padding: 15px;
    }


    .login-card {
        padding: 32px 24px 22px;
        border-radius: 23px;
    }


    .brand {
        margin-bottom: 30px;
    }


    .login-title {
        font-size: 22px;
    }


    .otp-input {
        letter-spacing: 10px;
    }
}



/* ========================================== */
/* Main Layout                                */
/* ========================================== */

.main-layout {
    min-height: 100vh;
    direction: rtl;
    background: #f7f7fa;
}


.topbar {
    height: 76px;
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255,255,255,.88);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid #eceaf0;
    position: relative;
    z-index: 100;
}


.app-title {
    display: flex;
    align-items: center;
    gap: 12px;
}


.app-logo {
    width: 43px;
    height: 43px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 13px;
    color: white;
    font-size: 20px;
    border: 1px solid #baafdb;
    box-shadow: 0 7px 18px rgba(116,88,209,.22);
}


.app-name {
    font-size: 15px;
    font-weight: 800;
    color: #302c3b;
}


.app-caption {
    margin-top: 2px;
    font-size: 11px;
    color: #9b97a4;
}


/* ========================================= */
/* User Menu                                 */
/* ========================================= */

.user-menu {
    position: relative;
}


    .user-menu summary {
        list-style: none;
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 6px 10px;
        border-radius: 14px;
        cursor: pointer;
        transition: .2s ease;
    }


        .user-menu summary::-webkit-details-marker {
            display: none;
        }


        .user-menu summary:hover {
            background: #f5f3fa;
        }


.user-avatar,
.large-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 50%;
    color: #6349b6;
    font-weight: 800;
    background: linear-gradient( 135deg, #eee8ff, #ded5ff );
}


.user-avatar {
    width: 42px;
    height: 42px;
    font-size: 15px;
}


.user-info {
    min-width: 100px;
}


.user-name {
    font-size: 13px;
    font-weight: 800;
    color: #373340;
    white-space: nowrap;
}


.user-role {
    margin-top: 2px;
    font-size: 10px;
    color: #8d8799;
}


.menu-arrow {
    margin-right: 5px;
    color: #aaa5b2;
    font-size: 15px;
}


/* ========================================= */
/* Dropdown                                  */
/* ========================================= */

.user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: 285px;
    padding: 10px;
    border-radius: 18px;
    background: white;
    border: 1px solid #ece9f1;
    box-shadow: 0 20px 45px rgba(45,35,75,.13);
    animation: dropdownAppear .18s ease;
}


@keyframes dropdownAppear {

    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


.dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
}


.large-avatar {
    width: 46px;
    height: 46px;
    font-size: 16px;
}


.dropdown-name {
    font-size: 14px;
    font-weight: 800;
    color: #302c39;
}


.dropdown-role {
    margin-top: 4px;
    font-size: 11px;
    color: #8d8798;
}


.dropdown-divider {
    height: 1px;
    margin: 7px 4px;
    background: #efedf2;
}


.user-detail {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: #686371;
    font-size: 12px;
}


.logout-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-radius: 12px;
    text-decoration: none;
    color: #d64f61;
    font-size: 13px;
    font-weight: 700;
    transition: .2s ease;
}


    .logout-button:hover {
        background: #fff1f3;
        color: #c8394e;
    }


.login-link {
    padding: 9px 18px;
    border-radius: 11px;
    color: white;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    background: linear-gradient( 135deg, #7458d1, #9872e5 );
}


.page-content {
    min-height: calc(100vh - 76px);
    padding: 25px;
}


@media (max-width: 600px) {

    .topbar {
        padding: 0 15px;
    }


    .app-caption {
        display: none;
    }


    .user-info {
        display: none;
    }


    .user-dropdown {
        left: -5px;
        width: 260px;
    }


    .page-content {
        padding: 15px;
    }
}
