/* ============================================
   I-131 Ward Scheduling System - Styles
   Soft, feminine, warm UI
   ============================================ */

/* CSS Variables - Soft/Feminine Theme */
:root {
    /* Primary Colors - Rose/Pink */
    --primary: #e879a9;
    --primary-dark: #d65d8c;
    --primary-light: #f5a3c4;
    --primary-glow: rgba(232, 121, 169, 0.2);

    /* Accent Colors */
    --accent: #9f7aea;
    --accent-light: #c4b5fd;

    /* Status Colors */
    --success: #68d391;
    --success-light: #9ae6b4;
    --warning: #f6ad55;
    --danger: #fc8181;

    /* Bed Colors */
    --bed-5b: #63b3ed;
    --bed-5b-light: rgba(99, 179, 237, 0.15);
    --bed-6b: #b794f4;
    --bed-6b-light: rgba(183, 148, 244, 0.15);

    /* Neutral Colors - Warm tones */
    --bg-primary: #faf5f7;
    --bg-secondary: #fff9fb;
    --bg-tertiary: #fef0f5;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-hover: rgba(232, 121, 169, 0.08);
    --bg-closed: #f0eeef;

    --text-primary: #4a3f47;
    --text-secondary: #7a6b74;
    --text-muted: #a89aa3;

    --border-color: rgba(232, 121, 169, 0.15);
    --border-focus: rgba(232, 121, 169, 0.5);

    /* Glass Effect */
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(232, 121, 169, 0.1);
    --glass-blur: blur(20px);

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Typography */
    --font-sans: 'Inter', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'Fira Code', 'Consolas', monospace;

    /* Radius - Softer, rounder */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-full: 9999px;

    /* Shadows - Softer */
    --shadow-sm: 0 2px 8px rgba(232, 121, 169, 0.08);
    --shadow-md: 0 4px 20px rgba(232, 121, 169, 0.12);
    --shadow-lg: 0 8px 40px rgba(232, 121, 169, 0.15);
    --shadow-glow: 0 0 30px var(--primary-glow);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fff9fb 0%, #fef0f5 50%, #faf5f7 100%);
}

.loading-content {
    text-align: center;
}

.loading-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto var(--space-lg);
    color: var(--primary);
}

.atom-icon {
    animation: atom-pulse 2s ease-in-out infinite;
}

.orbit {
    transform-origin: center;
}

.orbit-1 {
    transform: rotate(0deg);
    animation: orbit-1 3s linear infinite;
}

.orbit-2 {
    transform: rotate(60deg);
    animation: orbit-2 3s linear infinite;
}

.orbit-3 {
    transform: rotate(-60deg);
    animation: orbit-3 3s linear infinite;
}

@keyframes atom-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

@keyframes orbit-1 {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes orbit-2 {
    from {
        transform: rotate(60deg);
    }

    to {
        transform: rotate(420deg);
    }
}

@keyframes orbit-3 {
    from {
        transform: rotate(-60deg);
    }

    to {
        transform: rotate(300deg);
    }
}

.loading-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--space-lg);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.loading-bar {
    width: 200px;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin: 0 auto;
}

.loading-bar span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: var(--radius-full);
    animation: loading-progress 1.5s ease-out forwards;
}

@keyframes loading-progress {
    0% {
        width: 0;
    }

    100% {
        width: 100%;
    }
}

/* Page */
.page {
    min-height: 100vh;
}

/* Login Page - Centered Single Column */
.login-page {
    background: linear-gradient(135deg, #fff9fb 0%, #fef0f5 50%, #faf5f7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
}

.login-container-centered {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: var(--space-lg);
}

.logo-emoji {
    font-size: 4rem;
    display: inline-block;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

.login-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.login-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.input-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    pointer-events: none;
}

.input-wrapper input {
    width: 100%;
    padding: var(--space-md) var(--space-md) var(--space-md) calc(var(--space-md) * 3);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition-fast);
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: #fff;
}

.input-wrapper input::placeholder {
    color: var(--text-muted);
}

.login-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.checkbox-label input {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    position: relative;
}

.checkbox-label input:checked+.checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-label input:checked+.checkmark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.inline-checkbox {
    margin-top: var(--space-sm);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary svg {
    width: 20px;
    height: 20px;
    transition: var(--transition-fast);
}

.btn-primary:hover svg {
    transform: translateX(4px);
}

.btn-login {
    width: 100%;
    padding: var(--space-md) var(--space-xl);
    font-size: 1.1rem;
}

.demo-hint {
    margin-top: var(--space-xl);
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.demo-hint code {
    display: inline-block;
    padding: 2px 8px;
    background: #fff;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    color: var(--primary);
    margin: 0 var(--space-xs);
    border: 1px solid var(--border-color);
}

/* Dashboard Layout */
.dashboard {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: var(--transition-normal);
}

.sidebar-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.logo-icon {
    font-size: 1.8rem;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
}

.nav-item svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary-glow), transparent);
    color: var(--primary);
    border: 1px solid var(--primary-glow);
}

.nav-item.admin-only {
    display: none;
}

.nav-item.admin-only.visible {
    display: flex;
}

.sidebar-footer {
    padding: var(--space-md);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.user-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    color: white;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-logout {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-logout svg {
    width: 20px;
    height: 20px;
}

.btn-logout:hover {
    background: rgba(252, 129, 129, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

/* Main Content */
.main-content {
    grid-column: 2;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg) var(--space-xl);
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border-color);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.btn-menu {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
}

.btn-menu svg {
    width: 24px;
    height: 24px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
}

.header-stats {
    display: flex;
    gap: var(--space-lg);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.header-date {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Content Area */
.content-area {
    flex: 1;
    padding: var(--space-xl);
}

.content-page {
    display: none;
    animation: fadeIn 0.3s ease;
}

.content-page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Upcoming Slots */
.upcoming-slots {
    margin-bottom: var(--space-lg);
    padding: var(--space-lg);
    background: linear-gradient(135deg, rgba(232, 121, 169, 0.08), rgba(159, 122, 234, 0.08));
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.upcoming-slots h3 {
    font-size: 1rem;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

.slots-list {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.slot-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.slot-chip:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.slot-chip .bed {
    font-weight: 600;
    color: var(--primary);
}

.slot-chip.bed-5b .bed {
    color: var(--bed-5b);
}

.slot-chip.bed-6b .bed {
    color: var(--bed-6b);
}

/* Calendar */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.btn-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-icon svg {
    width: 20px;
    height: 20px;
}

.btn-icon:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.calendar-title {
    font-size: 1.5rem;
    font-weight: 700;
    min-width: 180px;
    text-align: center;
}

.calendar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.btn-today {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-today:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.calendar-legend {
    display: flex;
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
    padding: var(--space-md);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 4px;
}

.legend-color.available {
    background: var(--success);
}

.legend-color.occupied-5b {
    background: var(--bed-5b);
}

.legend-color.occupied-6b {
    background: var(--bed-6b);
}

.legend-color.closed {
    background: var(--text-muted);
}

.calendar-grid {
    background: var(--bg-card);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.03);
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.08);
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: linear-gradient(to right, rgba(248, 250, 252, 0.8), rgba(241, 245, 249, 0.8));
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
}

.weekday {
    padding: 16px 12px;
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.weekday.highlight {
    color: var(--primary);
    font-weight: 700;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--bg-card);
}

.calendar-day {
    min-height: 140px;
    padding: 12px;
    border-right: 1px solid rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    background: transparent;
}

.calendar-day:nth-child(7n) {
    border-right: none;
}

.calendar-day.other-month {
    opacity: 0.4;
    background: rgba(248, 250, 252, 0.4);
    cursor: default;
}

.calendar-day.today {
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.05), rgba(var(--primary-rgb), 0.1));
}

/* Closed day - premium display */
.calendar-day.closed-day {
    background: repeating-linear-gradient(45deg,
            rgba(241, 245, 249, 0.4),
            rgba(241, 245, 249, 0.4) 10px,
            rgba(248, 250, 252, 0.4) 10px,
            rgba(248, 250, 252, 0.4) 20px);
    cursor: default;
}

.calendar-day.closed-day .day-number-centered {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-muted);
    opacity: 0.2;
    letter-spacing: -1px;
}

.calendar-day:not(.other-month):not(.closed-day):hover {
    background: #ffffff;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    transform: scale(1.02);
    z-index: 10;
    border-radius: 12px;
    border: 1px solid rgba(var(--primary-rgb), 0.1);
}

.day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.day-number {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
    transition: color 0.2s ease;
}

.calendar-day.today .day-number {
    color: var(--primary);
    font-weight: 800;
    background: rgba(var(--primary-rgb), 0.1);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.calendar-day:not(.other-month):not(.closed-day):hover .day-number {
    color: var(--primary);
}

.day-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.day-status.available {
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
}

.day-status.partial {
    background: var(--warning);
    box-shadow: 0 0 6px var(--warning);
}

.day-status.full {
    background: var(--danger);
    box-shadow: 0 0 6px var(--danger);
}

.day-status.closed {
    background: var(--text-muted);
}

.day-beds {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bed-slot {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    transition: all 0.2s ease;
    position: relative;
    border: 1px solid transparent;
}

.bed-slot:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    background: #ffffff;
    border-color: rgba(var(--primary-rgb), 0.1);
}

.bed-slot.available {
    border: 1px dashed var(--success);
    color: var(--success);
    background: rgba(104, 211, 145, 0.1);
}

.bed-slot.available:hover {
    background: rgba(104, 211, 145, 0.2);
}

.bed-slot.occupied-5b {
    background: var(--bed-5b-light);
    border-left: 3px solid var(--bed-5b);
}

.bed-slot.occupied-6b {
    background: var(--bed-6b-light);
    border-left: 3px solid var(--bed-6b);
}

.bed-label {
    font-weight: 700;
    font-size: 0.85rem;
}

.bed-patient {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.bed-slot .slot-actions {
    display: none;
    gap: 2px;
}

.bed-slot:hover .slot-actions {
    display: flex;
}

.slot-action-btn {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7rem;
    transition: var(--transition-fast);
}

.slot-action-btn:hover {
    border-color: var(--primary);
}

.slot-action-btn.delete:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* Audit Section (in calendar page) */
.audit-section {
    margin-top: var(--space-xl);
    padding: var(--space-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.audit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.audit-header h3 {
    font-size: 1rem;
    margin: 0;
}

.audit-filters {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.audit-filters input[type="date"] {
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.8rem;
}

.audit-filters span {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.btn-search-log,
.btn-reset-log {
    padding: var(--space-xs) var(--space-md);
    font-size: 0.8rem;
}

.audit-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-height: 300px;
    overflow-y: auto;
}

.audit-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
}

.audit-item .audit-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.audit-item .audit-content {
    flex: 1;
}

.audit-item .audit-detail {
    color: var(--text-primary);
}

.audit-item .audit-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Bookings Table */
.bookings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.search-bar {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    width: 350px;
}

.search-bar svg {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

.search-bar input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.search-bar input:focus {
    outline: none;
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.bookings-table-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.bookings-table {
    width: 100%;
    border-collapse: collapse;
}

.bookings-table th,
.bookings-table td {
    padding: var(--space-md);
    text-align: left;
}

.bookings-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.bookings-table td {
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.bookings-table tr:hover td {
    background: var(--bg-hover);
}

.bookings-table tr:last-child td {
    border-bottom: none;
}

.bed-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.75rem;
}

.bed-badge.bed-5b {
    background: var(--bed-5b-light);
    color: var(--bed-5b);
}

.bed-badge.bed-6b {
    background: var(--bed-6b-light);
    color: var(--bed-6b);
}

.action-btns {
    display: flex;
    gap: var(--space-sm);
}

.btn-sm {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-sm svg {
    width: 16px;
    height: 16px;
}

.btn-sm:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-sm.delete:hover {
    color: var(--danger);
    border-color: var(--danger);
}

/* Reports */
.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.report-card {
    padding: var(--space-xl);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: var(--transition-normal);
    box-shadow: var(--shadow-sm);
}

.report-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.report-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-md);
}

.report-card h3 {
    font-size: 1.1rem;
    margin-bottom: var(--space-sm);
}

.report-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
}

.report-actions {
    display: flex;
    gap: var(--space-sm);
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.report-filter {
    padding: var(--space-xl);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.report-filter h3 {
    margin-bottom: var(--space-lg);
}

.filter-row {
    display: flex;
    gap: var(--space-xl);
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.date-range,
.range-inputs {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.date-range input,
.range-inputs input {
    flex: 1;
}

.date-range span,
.range-inputs span {
    color: var(--text-muted);
}

/* Admin Page */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.admin-header h3 {
    font-size: 1.25rem;
    margin: 0;
}

.admin-table-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: var(--space-md);
    text-align: left;
}

.admin-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.admin-table td {
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.admin-table tr:hover td {
    background: var(--bg-hover);
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.role-badge.admin {
    background: rgba(159, 122, 234, 0.15);
    color: var(--accent);
}

.role-badge.user {
    background: rgba(99, 179, 237, 0.15);
    color: var(--bed-5b);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge.active {
    background: rgba(104, 211, 145, 0.15);
    color: var(--success);
}

.status-badge.inactive {
    background: rgba(168, 154, 163, 0.15);
    color: var(--text-muted);
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
}

.modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(74, 63, 71, 0.5);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    animation: slideUp 0.3s ease;
    box-shadow: var(--shadow-lg);
}

.day-modal-content {
    max-width: 400px;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.modal-header h3 {
    font-size: 1.25rem;
}

.btn-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-close svg {
    width: 20px;
    height: 20px;
}

.btn-close:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.modal-body {
    padding: var(--space-lg);
    overflow-y: auto;
    max-height: 60vh;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.form-group {
    margin-bottom: var(--space-md);
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.bed-selector {
    display: flex;
    gap: var(--space-md);
}

.bed-option {
    flex: 1;
    position: relative;
}

.bed-option input {
    position: absolute;
    opacity: 0;
}

.bed-label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.bed-option input:checked+.bed-label {
    border-color: var(--primary);
    background: var(--primary-glow);
    color: var(--primary);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-md);
    padding: var(--space-lg);
    border-top: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

/* Day Modal */
.day-modal-body {
    padding: var(--space-lg);
}

.day-info {
    text-align: center;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-color);
}

.day-info h4 {
    font-size: 1.1rem;
    margin-bottom: var(--space-xs);
}

.day-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.day-beds-control {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.bed-control-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.bed-control-item .bed-name {
    font-weight: 600;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--text-muted);
    border-radius: var(--radius-full);
    transition: var(--transition-fast);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--transition-fast);
}

.toggle-switch input:checked+.toggle-slider {
    background: var(--success);
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(24px);
}

.day-bookings-list h5 {
    font-size: 0.9rem;
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
}

.day-booking-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-xs);
    font-size: 0.85rem;
}

/* Context Menu */
.context-menu {
    position: fixed;
    z-index: 2000;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: var(--space-xs);
    display: none;
    min-width: 150px;
}

.context-menu.active {
    display: block;
}

.context-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    text-align: left;
    transition: var(--transition-fast);
}

.context-item:hover {
    background: var(--bg-hover);
}

.context-item.delete {
    color: var(--danger);
}

.context-item.delete:hover {
    background: rgba(252, 129, 129, 0.1);
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast.warning {
    border-left: 4px solid var(--warning);
}

.toast-icon {
    font-size: 1.25rem;
}

.toast-message {
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .dashboard {
        grid-template-columns: 1fr;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        grid-column: 1;
    }

    .btn-menu {
        display: flex;
    }

    .calendar-day {
        min-height: 90px;
    }
}

@media (max-width: 768px) {
    .header-stats {
        display: none;
    }

    .calendar-header {
        flex-direction: column;
        gap: var(--space-md);
    }

    .calendar-legend {
        flex-wrap: wrap;
    }

    .bookings-header {
        flex-direction: column;
        gap: var(--space-md);
    }

    .search-bar {
        width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .filter-row {
        flex-direction: column;
    }

    .slots-list {
        max-height: 100px;
        overflow-y: auto;
    }

    .audit-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .content-area {
        padding: var(--space-md);
    }

    .calendar-day {
        min-height: 70px;
        padding: 4px;
    }

    .bed-slot {
        padding: 4px;
        font-size: 0.6rem;
    }

    .weekday {
        font-size: 0.7rem;
        padding: var(--space-sm);
    }

    .upcoming-slots {
        display: none;
    }
}

/* Print Styles */
@media print {

    .sidebar,
    .main-header,
    .calendar-actions,
    .action-btns,
    .upcoming-slots,
    .audit-section {
        display: none !important;
    }

    .main-content {
        grid-column: 1;
    }

    .content-area {
        padding: 0;
    }
}