/* ========================================
   GLOBAL STYLES
========================================= */

:root {
    --primary: #8f596c;
    --primary-dark: #714354;
    --primary-light: #ead8df;

    --background: #f7f2f1;
    --surface: #ffffff;
    --surface-soft: #fdf9f7;

    --text-dark: #382c30;
    --text-medium: #74676c;
    --text-light: #9d9095;

    --border: #eadfe2;

    --success: #5f8b71;
    --success-light: #e3f0e8;

    --warning: #a87535;
    --warning-light: #f7ecd9;

    --danger: #b4565b;
    --danger-light: #f7e3e4;

    --shadow:
        0 12px 35px rgba(89, 58, 69, 0.12);

    --small-shadow:
        0 5px 18px rgba(89, 58, 69, 0.08);

    --radius-large: 26px;
    --radius-medium: 18px;
    --radius-small: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    min-width: 320px;
    min-height: 100svh;

    color: var(--text-dark);
    background-color: var(--background);

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    line-height: 1.5;
}

body.modal-open {
    overflow: hidden;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    border: none;
    cursor: pointer;
}

input,
select,
textarea {
    width: 100%;
}

textarea {
    resize: vertical;
}

[hidden] {
    display: none !important;
}

/* ========================================
   ADMIN LOGIN
========================================= */

.admin-login-screen {
    display: grid;
    place-items: center;

    min-height: 100svh;
    padding: 24px 16px;

    background:
        radial-gradient(
            circle at top left,
            rgba(234, 216, 223, 0.95),
            transparent 38%
        ),
        var(--background);
}

.login-card {
    width: 100%;
    max-width: 430px;
    padding: 32px 22px;

    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-large);

    box-shadow: var(--shadow);
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 11px;

    margin-bottom: 34px;
}

.login-card > .eyebrow,
.login-card > h1,
.login-description {
    text-align: center;
}

.login-card h1 {
    margin-bottom: 10px;

    font-family: Georgia, "Times New Roman", serif;
    font-size: 2.4rem;
    font-weight: 500;
}

.login-description {
    max-width: 330px;
    margin: 0 auto 27px;

    color: var(--text-medium);

    font-size: 0.9rem;
}

.login-message {
    min-height: 22px;
    margin-bottom: 10px;

    color: var(--danger);

    font-size: 0.82rem;
    font-weight: 600;
    text-align: center;
}

.login-card .primary-button {
    width: 100%;
}

.admin-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logout-button {
    padding: 7px 11px;

    color: var(--danger);
    background-color: var(--surface);

    border: 1px solid var(--danger-light);
    border-radius: 999px;

    font-size: 0.72rem;
    font-weight: 700;
}

.logout-button:hover {
    background-color: var(--danger-light);
}

/* ========================================
   ADMIN APP
========================================= */

.admin-app {
    min-height: 100svh;
}

.admin-header {
    position: sticky;
    top: 0;
    z-index: 20;

    display: flex;
    align-items: center;
    justify-content: space-between;

    min-height: 74px;
    padding: 13px 18px;

    background-color: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--border);

    backdrop-filter: blur(12px);
}

.admin-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;

    color: var(--text-dark);

    text-decoration: none;
}

.logo-icon {
    display: grid;
    place-items: center;

    width: 44px;
    height: 44px;

    color: var(--surface);
    background:
        linear-gradient(
            145deg,
            #ae788c,
            var(--primary-dark)
        );

    border-radius: 50%;

    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.4rem;
    font-style: italic;

    box-shadow:
        0 5px 14px rgba(113, 67, 84, 0.25);
}

.logo-text {
    display: flex;
    flex-direction: column;

    line-height: 1.1;
}

.logo-text strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.25rem;
    font-weight: 500;
}

.logo-text small {
    margin-top: 3px;

    color: var(--text-medium);

    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.admin-badge {
    padding: 7px 12px;

    color: var(--primary-dark);
    background-color: var(--primary-light);

    border-radius: 999px;

    font-size: 0.75rem;
    font-weight: 700;
}


/* ========================================
   MAIN CONTENT
========================================= */

.admin-main {
    width: 100%;
    max-width: 1050px;
    margin-inline: auto;
    padding: 28px 16px 50px;
}

.dashboard-heading {
    display: flex;
    flex-direction: column;
    gap: 20px;

    margin-bottom: 28px;
}

.eyebrow {
    margin-bottom: 7px;

    color: var(--primary);

    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.17em;
    text-transform: uppercase;
}

.dashboard-heading h1 {
    margin-bottom: 7px;

    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 9vw, 2.8rem);
    font-weight: 500;
    line-height: 1.08;
}

.dashboard-heading > div > p:last-child {
    color: var(--text-medium);
}


/* ========================================
   BUTTONS
========================================= */

.primary-button {
    min-height: 50px;
    padding: 13px 20px;

    color: var(--surface);
    background-color: var(--primary);

    border-radius: 999px;

    font-weight: 700;

    box-shadow:
        0 8px 20px rgba(143, 89, 108, 0.23);

    transition:
        background-color 0.2s ease,
        transform 0.2s ease;
}

.primary-button:hover {
    background-color: var(--primary-dark);

    transform: translateY(-1px);
}


/* ========================================
   DATE NAVIGATION
========================================= */

.date-navigation {
    display: grid;
    grid-template-columns: 46px 1fr 46px;
    align-items: center;
    gap: 12px;

    padding: 18px;

    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-large);

    box-shadow: var(--small-shadow);
}

.date-arrow-button {
    display: grid;
    place-items: center;

    width: 46px;
    height: 46px;

    color: var(--primary-dark);
    background-color: var(--primary-light);

    border-radius: 50%;

    font-size: 1.25rem;
}

.date-arrow-button:hover {
    color: var(--surface);
    background-color: var(--primary);
}

.selected-date {
    display: flex;
    flex-direction: column;

    text-align: center;
}

.selected-date span {
    margin-bottom: 2px;

    color: var(--primary);

    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.selected-date strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.15rem;
    font-weight: 500;
}

.date-actions {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;

    margin: 13px 0 24px;
}

.today-button {
    min-height: 44px;
    padding: 10px 18px;

    color: var(--primary-dark);
    background-color: var(--surface);

    border: 1px solid var(--border);
    border-radius: 999px;

    font-weight: 700;
}

.today-button:hover {
    background-color: var(--primary-light);
}

.date-picker-label {
    display: flex;
    flex-direction: column;
    gap: 5px;

    color: var(--text-medium);

    font-size: 0.72rem;
    font-weight: 600;
}

.date-picker-label input {
    min-height: 44px;
    padding: 8px 10px;

    color: var(--text-dark);
    background-color: var(--surface);

    border: 1px solid var(--border);
    border-radius: var(--radius-small);

    outline: none;
}

.date-picker-label input:focus {
    border-color: var(--primary);

    box-shadow:
        0 0 0 3px rgba(143, 89, 108, 0.1);
}


/* ========================================
   DAILY STATISTICS
========================================= */

.daily-statistics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 9px;

    margin-bottom: 30px;
}

.statistic-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;

    min-width: 0;
    padding: 14px 7px;

    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-medium);

    text-align: center;

    box-shadow: var(--small-shadow);
}

.statistic-icon {
    display: grid;
    place-items: center;

    width: 38px;
    height: 38px;

    color: var(--primary-dark);
    background-color: var(--primary-light);

    border-radius: 50%;

    font-size: 0.72rem;
    font-weight: 800;
}

.statistic-card div {
    display: flex;
    flex-direction: column;
}

.statistic-card strong {
    overflow: hidden;

    font-size: 1.1rem;
    text-overflow: ellipsis;
}

.statistic-card div span {
    color: var(--text-medium);

    font-size: 0.7rem;
}


/* ========================================
   APPOINTMENT CONTROLS
========================================= */

.appointment-controls {
    margin-bottom: 18px;
}

.appointment-controls h2 {
    margin-bottom: 13px;

    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.6rem;
    font-weight: 500;
}

.status-filters {
    display: flex;
    gap: 8px;

    padding-bottom: 4px;

    overflow-x: auto;
    scrollbar-width: none;
}

.status-filters::-webkit-scrollbar {
    display: none;
}

.filter-button {
    flex-shrink: 0;

    padding: 9px 15px;

    color: var(--text-medium);
    background-color: var(--surface);

    border: 1px solid var(--border);
    border-radius: 999px;

    font-size: 0.8rem;
    font-weight: 700;
}

.filter-button:hover {
    border-color: var(--primary);
}

.filter-button.active {
    color: var(--surface);
    background-color: var(--primary);
    border-color: var(--primary);
}


/* ========================================
   APPOINTMENT LIST
========================================= */

.appointments-list {
    display: grid;
    gap: 13px;
}

.appointment-card {
    padding: 18px;

    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-medium);

    box-shadow: var(--small-shadow);
}

.appointment-card.cancelled {
    opacity: 0.68;
}

.appointment-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;

    margin-bottom: 16px;
}

.appointment-time {
    display: flex;
    flex-direction: column;
}

.appointment-time strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.55rem;
    font-weight: 500;
    line-height: 1;
}

.appointment-time span {
    margin-top: 5px;

    color: var(--text-medium);

    font-size: 0.74rem;
}

.status-badge {
    padding: 6px 10px;

    border-radius: 999px;

    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
}

.status-badge.confirmed {
    color: var(--warning);
    background-color: var(--warning-light);
}

.status-badge.completed {
    color: var(--success);
    background-color: var(--success-light);
}

.status-badge.cancelled {
    color: var(--danger);
    background-color: var(--danger-light);
}

.appointment-customer {
    margin-bottom: 13px;
}

.appointment-customer h3 {
    margin-bottom: 3px;

    font-size: 1.05rem;
}

.appointment-customer a {
    color: var(--primary);

    font-size: 0.85rem;
    text-decoration: none;
}

.appointment-customer a:hover {
    text-decoration: underline;
}

.appointment-service {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;

    padding: 12px;

    background-color: var(--surface-soft);
    border-radius: var(--radius-small);
}

.appointment-service div {
    display: flex;
    flex-direction: column;
}

.appointment-service span {
    color: var(--text-medium);

    font-size: 0.74rem;
}

.appointment-service strong {
    font-size: 0.9rem;
}

.appointment-note {
    margin-top: 13px;
    padding: 11px 12px;

    color: var(--text-medium);
    background-color: #faf4e9;

    border-radius: var(--radius-small);

    font-size: 0.82rem;
}

.appointment-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;

    margin-top: 15px;
}

.action-button {
    min-height: 43px;
    padding: 9px 12px;

    background-color: transparent;

    border: 1px solid var(--border);
    border-radius: var(--radius-small);

    font-size: 0.78rem;
    font-weight: 700;
}

.complete-button {
    color: var(--success);
    border-color: var(--success);
}

.complete-button:hover {
    background-color: var(--success-light);
}

.cancel-button {
    color: var(--danger);
    border-color: var(--danger);
}

.cancel-button:hover {
    background-color: var(--danger-light);
}


/* ========================================
   EMPTY STATE
========================================= */

.empty-state {
    padding: 45px 20px;

    background-color: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius-large);

    text-align: center;
}

.empty-state > span {
    display: block;

    margin-bottom: 14px;

    font-size: 2.8rem;
}

.empty-state h2 {
    margin-bottom: 6px;

    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.4rem;
    font-weight: 500;
}

.empty-state p {
    color: var(--text-medium);

    font-size: 0.88rem;
}


/* ========================================
   MODAL
========================================= */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;

    display: flex;
    align-items: flex-end;
    justify-content: center;

    padding-top: 30px;

    background-color: rgba(42, 31, 35, 0.55);

    backdrop-filter: blur(4px);
}

.modal {
    width: 100%;
    max-height: calc(100svh - 30px);
    padding: 24px 18px 30px;

    background-color: var(--surface);

    border-radius:
        var(--radius-large)
        var(--radius-large)
        0
        0;

    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;

    margin-bottom: 23px;
}

.modal-header h2 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.7rem;
    font-weight: 500;
}

.close-modal-button {
    display: grid;
    place-items: center;

    width: 40px;
    min-width: 40px;
    height: 40px;

    color: var(--text-medium);
    background-color: var(--background);

    border-radius: 50%;

    font-size: 1.6rem;
    line-height: 1;
}

.close-modal-button:hover {
    color: var(--surface);
    background-color: var(--primary);
}


/* ========================================
   FORMS
========================================= */

.form-field {
    margin-bottom: 18px;
}

.form-field label {
    display: block;

    margin-bottom: 7px;

    font-size: 0.86rem;
    font-weight: 700;
}

.form-field label span {
    color: var(--text-light);

    font-size: 0.73rem;
    font-weight: 500;
}

.form-field input,
.form-field select,
.form-field textarea {
    min-height: 49px;
    padding: 12px 13px;

    color: var(--text-dark);
    background-color: var(--surface);

    border: 1px solid var(--border);
    border-radius: var(--radius-small);

    outline: none;
}

.form-field textarea {
    min-height: 90px;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    border-color: var(--primary);

    box-shadow:
        0 0 0 4px rgba(143, 89, 108, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-message {
    min-height: 22px;
    margin-bottom: 10px;

    color: var(--danger);

    font-size: 0.82rem;
    font-weight: 600;
}

.modal .primary-button {
    width: 100%;
}

/* ========================================
   VIEW SWITCHER
========================================= */

.view-switcher {
    display: grid;
    grid-template-columns: 1fr 1fr;

    margin-bottom: 22px;
    padding: 4px;

    background-color: var(--primary-light);
    border-radius: 999px;
}

.view-button {
    min-height: 42px;
    padding: 9px 16px;

    color: var(--text-medium);
    background-color: transparent;

    border-radius: 999px;

    font-size: 0.85rem;
    font-weight: 700;

    transition:
        color 0.2s ease,
        background-color 0.2s ease,
        box-shadow 0.2s ease;
}

.view-button.active {
    color: var(--primary-dark);
    background-color: var(--surface);

    box-shadow:
        0 4px 14px rgba(89, 58, 69, 0.12);
}


/* ========================================
   MONTH VIEW
========================================= */

.month-navigation {
    display: grid;
    grid-template-columns: 46px 1fr 46px;
    align-items: center;
    gap: 12px;

    margin-bottom: 18px;
    padding: 18px;

    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-large);

    box-shadow: var(--small-shadow);
}

.selected-month {
    text-align: center;
}

.selected-month span {
    display: block;

    margin-bottom: 2px;

    color: var(--primary);

    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.selected-month h2 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.3rem;
    font-weight: 500;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);

    margin-bottom: 7px;
}

.calendar-weekdays span {
    color: var(--text-medium);

    font-size: 0.66rem;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
}

.month-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-empty-day {
    min-width: 0;
    min-height: 68px;
}

.calendar-day {
    display: flex;
    flex-direction: column;
    align-items: center;

    min-width: 0;
    min-height: 68px;
    padding: 7px 3px;

    color: var(--text-dark);
    background-color: var(--surface);

    border: 1px solid var(--border);
    border-radius: 10px;

    text-align: center;

    transition:
        border-color 0.2s ease,
        transform 0.2s ease,
        background-color 0.2s ease;
}

.calendar-day:hover {
    border-color: var(--primary);

    transform: translateY(-1px);
}

.calendar-day.has-appointments {
    background-color: var(--primary-light);
    border-color: rgba(143, 89, 108, 0.3);
}

.calendar-day.today {
    border: 2px solid var(--primary);
}

.calendar-day.closed {
    color: var(--text-light);
    background-color: #f0ebec;
}

.calendar-day-number {
    font-size: 0.82rem;
    font-weight: 800;
}

.calendar-appointment-count {
    display: block;

    margin-top: auto;

    color: var(--primary-dark);

    font-size: 0.56rem;
    font-weight: 700;
    line-height: 1.15;
}

.calendar-day.closed
.calendar-appointment-count {
    color: var(--text-light);
}

.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;

    margin-top: 18px;

    color: var(--text-medium);

    font-size: 0.75rem;
}

.calendar-legend span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.calendar-legend i {
    display: inline-block;

    width: 14px;
    height: 14px;

    border-radius: 4px;
}

.legend-today {
    background-color: var(--surface);
    border: 2px solid var(--primary);
}

.legend-booked {
    background-color: var(--primary-light);
    border: 1px solid rgba(143, 89, 108, 0.3);
}

/* ========================================
   DESKTOP
========================================= */

@media (min-width: 700px) {
    .admin-header {
        padding-inline: 32px;
    }

    .admin-main {
        padding: 40px 30px 70px;
    }

    .dashboard-heading {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .dashboard-heading .primary-button {
        width: auto;
        min-width: 165px;
    }

    .daily-statistics {
        gap: 16px;
    }

    .statistic-card {
        flex-direction: row;

        padding: 19px;

        text-align: left;
    }

    .statistic-icon {
        width: 44px;
        min-width: 44px;
        height: 44px;
    }

    .statistic-card strong {
        font-size: 1.3rem;
    }

    .statistic-card div span {
        font-size: 0.78rem;
    }

    .appointments-list {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .modal-overlay {
        align-items: center;

        padding: 30px;
    }

    .modal {
        max-width: 570px;
        max-height: calc(100svh - 60px);
        padding: 30px;

        border-radius: var(--radius-large);
    }
}