:root {
    --paper-050: #f8f8f7;
    --stone-200: #cbc0b2;
    --taupe-600: #7e6961;
    --wine-900: #550b14;

    --cream-050: var(--paper-050);
    --cream-100: var(--paper-050);
    --beige-200: var(--stone-200);
    --sand-300: var(--stone-200);
    --clay-500: var(--wine-900);
    --wood-700: var(--taupe-600);
    --ink-900: var(--wine-900);

    --white-glass: rgba(248, 248, 247, 0.86);
    --shadow-soft: 0 10px 30px rgba(85, 11, 20, 0.12);
    --shadow-deep: 0 25px 45px rgba(85, 11, 20, 0.2);
    --radius-xl: 24px;
    --transition-normal: all 0.3s ease;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: "Cairo", sans-serif;
    color: var(--wood-700);
    background:
        radial-gradient(circle at 10% 20%, rgba(203, 192, 178, 0.44), transparent 45%),
        radial-gradient(circle at 80% 10%, rgba(126, 105, 97, 0.24), transparent 40%),
        linear-gradient(120deg, var(--cream-050), rgba(203, 192, 178, 0.42));
}

.text-muted {
    color: rgba(126, 105, 97, 0.86) !important;
}

.app-shell {
    max-width: 1280px;
}

.card-soft {
    border-radius: var(--radius-xl);
    border: 1px solid rgba(203, 192, 178, 0.62);
    background: linear-gradient(140deg, var(--white-glass), rgba(248, 248, 247, 0.72));
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(8px);
}

.nav-soft {
    position: sticky;
    top: 12px;
    z-index: 11;
}

.logo-pill,
.logo-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--ink-900);
    border: 1px solid rgba(126, 105, 97, 0.28);
    background: rgba(248, 248, 247, 0.84);
}

.logo-badge {
    min-width: 110px;
    font-size: 0.95rem;
}

.school-name {
    font-weight: 800;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    color: var(--wine-900);
}

.greeting-text {
    font-size: clamp(1rem, 1.8vw, 1.2rem);
    font-weight: 600;
    line-height: 1.85;
    white-space: pre-line;
    color: var(--wood-700);
}

.btn-soft,
.btn-soft-outline,
.btn-nav {
    border-radius: 14px;
    transition: var(--transition-normal);
}

.btn-primary.btn-soft {
    --bs-btn-bg: transparent;
    --bs-btn-border-color: transparent;
    --bs-btn-hover-bg: transparent;
    --bs-btn-hover-border-color: transparent;
    --bs-btn-active-bg: transparent;
    --bs-btn-active-border-color: transparent;
    --bs-btn-disabled-bg: transparent;
    --bs-btn-disabled-border-color: transparent;
    --bs-btn-color: var(--paper-050);
    --bs-btn-hover-color: var(--paper-050);
    --bs-btn-active-color: var(--paper-050);
    --bs-btn-disabled-color: var(--paper-050);
}

.btn-soft {
    background: linear-gradient(120deg, var(--clay-500), var(--wood-700));
    border-color: transparent;
    color: var(--paper-050);
}

.btn-soft:hover,
.btn-soft:focus-visible {
    background: linear-gradient(120deg, var(--clay-500), var(--wood-700));
    color: var(--paper-050);
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(85, 11, 20, 0.35);
}

.btn-soft-outline {
    border: 1px solid rgba(126, 105, 97, 0.35);
    color: var(--ink-900);
    background: rgba(248, 248, 247, 0.7);
}

.btn-soft-outline:hover {
    background: rgba(248, 248, 247, 0.96);
    color: var(--ink-900);
}

.btn-nav {
    border: 1px solid rgba(126, 105, 97, 0.26);
    background: rgba(248, 248, 247, 0.76);
    color: var(--ink-900);
}

.btn-nav:hover {
    background: rgba(203, 192, 178, 0.3);
    color: var(--ink-900);
}

.btn-nav-danger {
    border-color: rgba(85, 11, 20, 0.32);
    color: var(--ink-900);
}

.btn-nav-danger:hover {
    color: var(--ink-900);
    background: rgba(85, 11, 20, 0.08);
}

.section-title {
    font-weight: 800;
    color: var(--ink-900);
}

.hall-section-card {
    border-color: rgba(85, 11, 20, 0.18);
    background: linear-gradient(140deg, rgba(248, 248, 247, 0.92), rgba(248, 248, 247, 0.74));
}

.hall-section-head {
    padding-bottom: 0.8rem;
    margin-bottom: 1.1rem !important;
    border-bottom: 1px dashed rgba(85, 11, 20, 0.22);
}

.lead-text {
    font-size: 1.05rem;
    line-height: 1.9;
    color: var(--wood-700);
}

.view-panel {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.view-panel.is-active {
    opacity: 1;
    transform: translateY(0);
}

.slot-card {
    padding: 1.15rem;
    min-height: 100%;
    transition: transform 0.28s ease, box-shadow 0.28s ease;
    position: relative;
}

.slot-card.is-open:hover {
    transform: scale(1.02) translateY(-4px);
    box-shadow: var(--shadow-deep);
}

.slot-card.is-booked {
    opacity: 1;
    border-color: rgba(85, 11, 20, 0.3);
    background: linear-gradient(140deg, rgba(203, 192, 178, 0.5), rgba(126, 105, 97, 0.28));
}

.slot-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ink-900);
}

.slot-time {
    font-size: 0.9rem;
    color: rgba(126, 105, 97, 0.86);
}

.slot-badge {
    font-size: 0.78rem;
    border-radius: 999px;
    padding: 0.3rem 0.6rem;
    font-weight: 700;
}

.badge-open,
.badge-available {
    color: var(--wood-700);
    background: rgba(126, 105, 97, 0.16);
}

.badge-booked,
.badge-unavailable {
    color: var(--ink-900);
    background: rgba(85, 11, 20, 0.15);
}

.btn-soft-disabled {
    border-radius: 14px;
    border: 0;
    opacity: 1;
    background: linear-gradient(120deg, var(--wood-700), var(--clay-500));
    color: var(--paper-050);
}

.booked-info {
    border-radius: 14px;
    border: 1px solid rgba(85, 11, 20, 0.22);
    background: rgba(248, 248, 247, 0.76);
    padding: 0.75rem 0.85rem;
}

.booked-line {
    color: var(--wood-700);
    font-size: 0.92rem;
    line-height: 1.7;
}

.booked-unavailable {
    color: var(--ink-900);
    font-size: 0.95rem;
    font-weight: 800;
}

.form-soft {
    border-radius: 14px;
    border: 1px solid rgba(126, 105, 97, 0.3);
    background: rgba(248, 248, 247, 0.82);
    padding: 0.65rem 0.85rem;
}

.form-soft:focus {
    border-color: rgba(85, 11, 20, 0.42);
    box-shadow: 0 0 0 0.2rem rgba(85, 11, 20, 0.12);
}

.book-btn {
    position: relative;
    min-height: 42px;
}

.book-btn.is-loading .btn-label {
    opacity: 0.35;
}

.btn-loader {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(248, 248, 247, 0.84);
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
    position: absolute;
    top: 50%;
    left: 18px;
    transform: translateY(-50%);
}

.slot-card[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    right: 12px;
    top: -12px;
    transform: translateY(-4px) scale(0.95);
    transform-origin: top right;
    opacity: 0;
    pointer-events: none;
    font-size: 0.8rem;
    white-space: nowrap;
    padding: 0.4rem 0.6rem;
    border-radius: 10px;
    color: var(--paper-050);
    background: rgba(85, 11, 20, 0.92);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.slot-card[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateY(-12px) scale(1);
    animation: tooltip-pop 0.2s ease;
}

.flash-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%) translateY(20px);
    min-width: 240px;
    border-radius: 16px;
    padding: 0.8rem 1rem;
    color: var(--paper-050);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    opacity: 0;
    z-index: 50;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.flash-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.flash-success {
    background: linear-gradient(120deg, #7e6961, #550b14);
}

.flash-error {
    background: linear-gradient(120deg, #550b14, #7e6961);
}

.flash-warning {
    background: linear-gradient(120deg, #cbc0b2, #7e6961);
    color: #550b14;
}

.flash-warning .flash-checkmark span {
    background: #550b14;
}

.flash-checkmark {
    width: 18px;
    height: 18px;
    position: relative;
}

.flash-checkmark span {
    position: absolute;
    background: var(--paper-050);
    border-radius: 2px;
}

.flash-checkmark span:first-child {
    width: 3px;
    height: 9px;
    transform: rotate(-45deg);
    top: 6px;
    left: 5px;
}

.flash-checkmark span:last-child {
    width: 3px;
    height: 14px;
    transform: rotate(45deg);
    top: 1px;
    left: 11px;
}

.auth-wrapper {
    min-height: calc(100vh - 8rem);
    display: grid;
    place-items: center;
}

.auth-card {
    width: min(560px, 95%);
}

.auth-title {
    font-size: 1.85rem;
    font-weight: 800;
}

.link-soft {
    color: var(--clay-500);
    font-weight: 700;
    text-decoration: none;
}

.link-soft:hover {
    color: var(--wood-700);
}

.metric-card {
    min-height: 170px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.metric-label {
    color: rgba(126, 105, 97, 0.78);
    font-weight: 700;
}

.metric-value {
    font-size: clamp(2rem, 4vw, 2.6rem);
    line-height: 1;
    font-weight: 800;
    color: var(--ink-900);
}

.table-soft {
    margin-bottom: 0;
}

.table-soft thead th {
    background: rgba(248, 248, 247, 0.76);
    border-bottom: 1px solid rgba(126, 105, 97, 0.2);
    color: var(--ink-900);
}

.table-soft td,
.table-soft th {
    border-color: rgba(126, 105, 97, 0.16);
    background: transparent;
}

.alert {
    border: 1px solid rgba(126, 105, 97, 0.28);
    background: rgba(248, 248, 247, 0.84);
    color: var(--ink-900);
}

.alert-success {
    border-color: rgba(126, 105, 97, 0.35);
    background: rgba(126, 105, 97, 0.16);
    color: var(--ink-900);
}

.alert-warning {
    border-color: rgba(126, 105, 97, 0.35);
    background: rgba(203, 192, 178, 0.48);
    color: var(--ink-900);
}

.alert-danger {
    border-color: rgba(85, 11, 20, 0.32);
    background: rgba(85, 11, 20, 0.1);
    color: var(--ink-900);
}

.fade-slide-in {
    animation: fade-slide-in 0.6s ease both;
}

.delay-1 {
    animation-delay: 0.15s;
}

@keyframes fade-slide-in {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes tooltip-pop {
    0% {
        transform: translateY(-6px) scale(0.95);
    }
    100% {
        transform: translateY(-12px) scale(1);
    }
}

@keyframes spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

.long-term-slots-grid {
    min-height: 70px;
    display: grid;
    gap: 0.85rem;
}

.lt-day-row {
    border: 1px solid rgba(85, 11, 20, 0.12);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(248, 247, 245, 0.9));
    border-color: rgba(85, 11, 20, 0.16);
}

.lt-periods-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.7rem;
}

.lt-period-option {
    border: 1px solid rgba(126, 105, 97, 0.28);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.94);
    padding: 0.65rem 0.75rem;
    display: flex;
    gap: 0.6rem;
    align-items: center;
    min-height: 62px;
    transition: var(--transition-normal);
    cursor: pointer;
}

.lt-period-option .lt-period-checkbox {
    margin: 0;
    flex-shrink: 0;
}

.lt-period-copy {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    min-width: 0;
}

.lt-period-name {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--ink-900);
    line-height: 1.35;
}

.lt-period-state {
    font-size: 0.76rem;
    font-weight: 700;
    color: rgba(126, 105, 97, 0.9);
    line-height: 1.25;
}

.lt-period-option.is-busy {
    background: rgba(203, 192, 178, 0.3);
    border-color: rgba(85, 11, 20, 0.26);
}

.lt-period-option.is-busy .lt-period-name {
    color: rgba(85, 11, 20, 0.85);
}

.lt-period-option.is-busy .lt-period-state {
    color: rgba(85, 11, 20, 0.9);
}

.lt-period-option.is-available {
    border-color: rgba(85, 11, 20, 0.2);
}

.lt-period-option.is-available:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(85, 11, 20, 0.12);
}

.lt-day-hint {
    min-height: 1.2rem;
}

@media (max-width: 767px) {
    .school-header {
        text-align: center;
    }

    .slot-card[data-tooltip]::after {
        right: 50%;
        transform: translate(50%, -4px) scale(0.95);
        transform-origin: top center;
        white-space: normal;
        width: 90%;
    }

    .slot-card[data-tooltip]:hover::after {
        transform: translate(50%, -12px) scale(1);
    }

    .lt-periods-grid {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
}
