/* ============================================================
   base.css - общие стили для всего приложения MedSlots
   ============================================================ */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, sans-serif;
}

body {
    background-color: #ffffff;
    padding: 10px;
}

/* ── Layout ─────────────────────────────────────────────── */
.app-container {
    display: flex;
    gap: 10px;
    width: 100%;
    min-height: calc(100vh - 20px);
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
    width: 340px;
    flex-shrink: 0;
    background-color: #8ea8e8;
    border-radius: 32px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
}

.avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background-color: #e0e9ff;
    display: grid;
    place-items: center;
    font-size: 18px;
    font-weight: 500;
    flex-shrink: 0;
}

.user-name {
    font-size: 20px;
    font-weight: 600;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.nav-button {
    width: fit-content;
    padding: 14px 20px;
    border: none;
    border-radius: 24px;
    background-color: #c2d1f3;
    font-size: 18px;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.15s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    text-decoration: none;
    display: inline-block;
    color: inherit;
}

.nav-button.active {
    background-color: #e0e9ff;
}

.nav-button:hover {
    background-color: #d1dff7;
    transform: translateY(-1px);
}

.nav-button.active:hover {
    background-color: #e0e9ff;
    transform: none;
}

.sidebar-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    gap: 10px;
}

/* ── Main content ────────────────────────────────────────── */
.main-content {
    flex-grow: 1;
    background-color: #d8d8d8;
    border-radius: 4px;
    padding: 60px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ── Toast notification ──────────────────────────────────── */
.notification {
    position: fixed;
    top: 30px;
    right: 30px;
    padding: 16px 26px;
    border-radius: 12px;
    font-size: 18px;
    color: white;
    background: #28a745;
    display: none;
    z-index: 1000;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: opacity 0.3s ease;
}

.notification.error {
    background: #dc3545;
}

/* ── Calendar ────────────────────────────────────────────── */
.calendar {
    width: 100%;
    max-width: 700px;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    margin-bottom: 40px;
}

.calendar-nav {
    width: 40px;
    height: 40px;
    border: none;
    background-color: white;
    font-size: 24px;
    cursor: pointer;
    display: grid;
    place-items: center;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.calendar-nav:hover {
    background-color: #f0f0f0;
}

.calendar-month {
    font-size: 52px;
    font-weight: 500;
    min-width: 320px;
    text-align: center;
}

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

.calendar-day-name {
    text-align: center;
    font-size: 48px;
    font-weight: 500;
    margin-bottom: 8px;
}

.calendar-day {
    aspect-ratio: 1;
    background-color: white;
    display: grid;
    place-items: center;
    font-size: 48px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.15s;
}

.calendar-day:hover {
    background-color: #e8ecf5;
}

.calendar-day.today {
    background-color: #c2d1f3;
    font-weight: 700;
}

.calendar-day.has-slots {
    border-bottom: 4px solid #8ea8e8;
}

.calendar-day.empty {
    background-color: transparent;
    cursor: default;
}

.calendar-day.empty:hover {
    background-color: transparent;
}

/* ── Staff cards (personnel page) ───────────────────────── */
.staff-grid {
    width: 100%;
    max-width: 980px;
    display: grid;
    grid-template-columns: repeat(2, minmax(300px, 1fr));
    gap: 24px 32px;
    align-items: start;
}

.staff-card {
    background: #f5f5f5;
    border-radius: 32px;
    padding: 22px 28px;
    min-height: 170px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.staff-card-inner {
    display: flex;
    align-items: flex-start;
    gap: 18px;
}

.staff-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background-color: #c2d1f3;
    display: grid;
    place-items: center;
    font-size: 24px;
    font-weight: 600;
    flex-shrink: 0;
}

.staff-name {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 18px;
}

.staff-role {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 8px;
}

.staff-status {
    font-size: 18px;
}

.staff-status.busy { color: #ff1f1f; }
.staff-status.free { color: #1dbb12; }

/* ── KPI layout ──────────────────────────────────────────── */
.kpi-layout {
    width: 100%;
    max-width: 1040px;
    display: grid;
    grid-template-columns: repeat(2, minmax(320px, 1fr));
    gap: 30px 24px;
}

.kpi-card {
    background-color: #f4f4f4;
    border-radius: 34px;
    min-height: 230px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px 36px;
    color: #000;
}

.kpi-card p {
    font-size: 40px;
    line-height: 1.35;
    font-weight: 500;
}

.kpi-card.center {
    grid-column: 1 / -1;
    max-width: 500px;
    justify-self: center;
}

/* ── Form card (add worker / add patient) ───────────────── */
.form-card {
    width: 100%;
    max-width: 700px;
    background: #f3f3f3;
    border-radius: 38px;
    padding: 36px 40px 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.form-card h1 {
    font-size: 50px;
    font-weight: 400;
    line-height: 1.1;
    margin-bottom: 34px;
    color: #000;
    text-align: center;
}

.form-fields {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.form-input {
    width: 100%;
    height: 60px;
    border: none;
    outline: none;
    border-radius: 26px;
    background: #e9ebf0;
    padding: 0 24px;
    font-size: 28px;
    font-weight: 400;
    color: #333;
    transition: background-color 0.2s;
}

.form-input::placeholder {
    color: #8b8f98;
}

.form-input:focus {
    background: #dde0e8;
}

.form-select-wrap {
    width: 100%;
    position: relative;
}

.form-select {
    width: 100%;
    height: 60px;
    border: none;
    outline: none;
    border-radius: 26px;
    background: #e9ebf0;
    padding: 0 70px 0 24px;
    font-size: 28px;
    font-weight: 400;
    color: #333;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.form-select option[value=""] { color: #8b8f98; }

.select-arrow {
    position: absolute;
    right: 24px;
    top: 50%;
    width: 14px;
    height: 14px;
    border-right: 2px solid #555;
    border-bottom: 2px solid #555;
    transform: translateY(-70%) rotate(45deg);
    pointer-events: none;
}

.form-submit {
    margin-top: 20px;
    min-width: 300px;
    height: 80px;
    border: none;
    border-radius: 26px;
    background: #1ee000;
    color: #fff;
    font-size: 40px;
    font-weight: 400;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.15s;
}

.form-submit:hover {
    background: #17c700;
    transform: translateY(-1px);
}

/* ── Slot detail overlay ─────────────────────────────────── */
.slot-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 500;
}

.slot-overlay.open {
    display: flex;
}

.slot-panel {
    background: #fff;
    border-radius: 28px;
    padding: 36px 44px;
    max-width: 540px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

.slot-panel h2 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 24px;
}

.slot-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 60vh;
    overflow-y: auto;
}

.slot-item {
    background: #f4f4f4;
    border-radius: 16px;
    padding: 14px 20px;
    font-size: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.slot-item .slot-time { font-weight: 600; font-size: 20px; }
.slot-item .slot-status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
}
.slot-item .slot-status-badge.scheduled { background: #dff0d8; color: #3a8a3a; }
.slot-item .slot-status-badge.completed  { background: #d9edf7; color: #2a6496; }
.slot-item .slot-status-badge.cancelled  { background: #f2dede; color: #a94442; }

.slot-close-btn {
    margin-top: 24px;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 16px;
    background: #8ea8e8;
    font-size: 20px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.slot-close-btn:hover { background: #6f90d8; }

/* ── Auth pages ──────────────────────────────────────────── */
body.auth-page {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #cbd3de;
    padding: 20px;
}

.login-card {
    background-color: #ffffff;
    padding: 50px 70px 60px;
    border-radius: 20px;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.login-card h1 {
    margin: 0 0 40px 0;
    font-size: 34px;
    font-weight: 400;
    color: #000;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-input {
    width: 100%;
    padding: 16px 20px;
    border: none;
    border-radius: 12px;
    background-color: #f4f5f9;
    font-size: 20px;
    color: #333;
    outline: none;
    transition: background-color 0.2s;
    box-sizing: border-box;
}

.login-input:focus { background-color: #e8eaef; }
.login-input::placeholder { color: #9397a0; }

.login-btn {
    margin-top: 15px;
    background-color: #124bd8;
    color: #ffffff;
    border: none;
    border-radius: 14px;
    padding: 14px 45px;
    font-size: 22px;
    cursor: pointer;
    align-self: center;
    transition: background-color 0.2s, transform 0.15s;
}

.login-btn:hover {
    background-color: #0e3eb8;
    transform: translateY(-1px);
}

/* 2FA card */
.twofa-card {
    background: white;
    width: 100%;
    max-width: 600px;
    padding: 40px 50px 60px;
    border-radius: 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.twofa-card h1 {
    text-align: center;
    font-size: 60px;
    font-weight: normal;
}

.twofa-input {
    width: 100%;
    height: 70px;
    border-radius: 20px;
    border: none;
    background-color: #f6f8fc;
    padding: 0 25px;
    font-size: 24px;
    outline: none;
    transition: all 0.2s ease;
    color: #333;
}

.twofa-input::placeholder { color: #949aa6; }
.twofa-input:focus { box-shadow: 0 0 0 2px #1552d6; }

.twofa-error {
    color: #d62828;
    font-size: 22px;
    margin-top: 8px;
    display: none;
}

.twofa-btn {
    margin-top: 10px;
    height: 60px;
    width: 280px;
    border: none;
    border-radius: 25px;
    background-color: #1552d6;
    color: white;
    font-size: 28px;
    cursor: pointer;
    transition: all 0.22s ease;
}

.twofa-btn:hover { background-color: #1146b8; }
.twofa-btn:active { transform: translateY(1px); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1100px) {
    .app-container { flex-direction: column; }
    .sidebar { width: 100%; }
    .calendar-month { font-size: 36px; }
    .calendar-day-name, .calendar-day { font-size: 32px; }
    .staff-grid { grid-template-columns: 1fr; }
    .kpi-layout { grid-template-columns: 1fr; }
    .kpi-card.center { grid-column: auto; max-width: none; }
}

@media (max-width: 600px) {
    .calendar-month { font-size: 28px; }
    .calendar-day-name, .calendar-day { font-size: 22px; }
    .main-content { padding: 30px 20px; }
    .form-card { padding: 28px 20px 40px; }
    .form-card h1 { font-size: 36px; }
    .form-input, .form-select { font-size: 20px; }
    .form-submit { font-size: 28px; min-width: auto; width: 100%; }
    .login-card { padding: 40px 30px; max-width: 90%; }
    .twofa-card { padding: 30px 24px; }
    .twofa-card h1 { font-size: 42px; }
    .twofa-btn { width: 100%; font-size: 24px; }
    .kpi-card p { font-size: 28px; }
}


/* ═══════════════════════════════════════════════════════════
   STAFF CARDS - avatars & layout
   ═══════════════════════════════════════════════════════════ */
.staff-avatar-img {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.staff-avatar-fallback {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background-color: #c2d1f3;
    display: grid;
    place-items: center;
    font-size: 24px;
    font-weight: 600;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   DOCTOR MODAL OVERLAY
   ═══════════════════════════════════════════════════════════ */
.doctor-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 600;
    padding: 20px;
}

.doctor-modal-overlay.open {
    display: flex;
}

.modal-panel {
    background: #fff;
    border-radius: 28px;
    padding: 32px 36px 36px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-panel-wide {
    max-width: 600px;
}

.modal-close-x {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #888;
    line-height: 1;
}

.modal-close-x:hover { color: #333; }

.modal-back-btn {
    background: none;
    border: none;
    font-size: 16px;
    color: #5a7ed8;
    cursor: pointer;
    padding: 0;
    margin-bottom: 16px;
    display: inline-block;
}

.modal-back-btn:hover { text-decoration: underline; }

.modal-doctor-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.modal-avatar-img {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.modal-doctor-name {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.modal-doctor-spec {
    font-size: 16px;
    color: #555;
}

.modal-label {
    font-size: 18px;
    font-weight: 500;
    color: #333;
}

.modal-actions {
    display: flex;
    gap: 12px;
}

.modal-btn {
    flex: 1;
    padding: 14px 16px;
    border: none;
    border-radius: 18px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
}

.modal-btn:hover { opacity: 0.88; transform: translateY(-1px); }

.btn-bonus     { background: #1ee000; color: #fff; }
.btn-cancel    { background: #8ea8e8; color: #fff; }
.btn-cancel-red{ background: #e05050; color: #fff; flex: 1; padding: 14px; border: none; border-radius: 18px; font-size:16px; font-weight:600; cursor:pointer; }
.btn-assign    { background: #124bd8; color: #fff; }
.btn-secondary { background: #ddd; color: #333; }

/* ═══════════════════════════════════════════════════════════
   MINI CALENDAR (inside modals)
   ═══════════════════════════════════════════════════════════ */
.mini-calendar {
    background: #f7f7f7;
    border-radius: 20px;
    padding: 16px;
}

.mini-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 18px;
    font-weight: 600;
}

.mini-cal-nav {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.mini-cal-nav:hover { background: #e8ecf5; }

.mini-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}

.mini-cal-name {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #888;
    padding: 4px 0;
}

.mini-cal-day {
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    background: #fff;
    transition: background 0.15s;
}

.mini-cal-day:hover { background: #e8ecf5; }
.mini-cal-day.empty { background: transparent; cursor: default; }
.mini-cal-day.empty:hover { background: transparent; }
.mini-cal-day.today { background: #c2d1f3; font-weight: 700; }

/* Calendar slot highlights */
.calendar-day.has-slots-cancel,
.mini-cal-day.has-slots-cancel {
    border-bottom: 4px solid #e05050;
    color: #c0392b;
    font-weight: 700;
}

.mini-cal-day.has-slots {
    border-bottom: 3px solid #8ea8e8;
}

/* ═══════════════════════════════════════════════════════════
   TIME SLOT BUTTONS
   ═══════════════════════════════════════════════════════════ */
.time-slots-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.time-slot-btn {
    padding: 10px 6px;
    border: 2px solid #ddd;
    border-radius: 12px;
    background: #fff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.time-slot-btn:hover:not(.occupied) {
    border-color: #8ea8e8;
    background: #e8ecf5;
}

.time-slot-btn.occupied {
    background: #fde8e8;
    border-color: #e05050;
    color: #c0392b;
    cursor: pointer;
}

.time-slot-btn.selected {
    background: #c2d1f3;
    border-color: #124bd8;
    color: #124bd8;
    font-weight: 700;
}

@media (max-width: 600px) {
    .time-slots-grid { grid-template-columns: repeat(3, 1fr); }
    .modal-panel { padding: 24px 20px; }
    .modal-actions { flex-direction: column; }
}

/* ── Doctor-view slot item (with patient name + consult type) */
.slot-item-doctor-view {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.slot-item-doctor-view .slot-time {
    font-size: 18px;
    font-weight: 700;
}

.slot-details {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.slot-patient-name {
    font-size: 16px;
    font-weight: 600;
}

.slot-consult-type {
    font-size: 14px;
    color: #666;
    background: #eef2ff;
    border-radius: 10px;
    padding: 2px 10px;
}

/* ── Multi-doctor slot list (admin/registrar calendar) */
.slot-item-doctor {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.slot-doctor-label {
    font-size: 16px;
    margin-bottom: 4px;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 6px;
    width: 100%;
}

.slot-row {
    display: flex;
    gap: 16px;
    font-size: 15px;
    padding: 2px 0;
}
