/* ==========================================================================
   Salon25 Back Office — AI Rebrand Design System
   Aligned with marketing brand: ink/cloud/lime/coral/blue/violet, Manrope.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* CSS Custom Properties */
:root {
    /* ---- AI Rebrand brand palette (canonical) ---- */
    --ink: #101014;
    --ink-2: #1a1a20;
    --ink-3: #24242c;
    --ink-line: rgba(255, 255, 255, 0.08);
    --cloud: #f7f4ee;
    --paper: #ffffff;
    --muted: #68615c;
    --line: rgba(16, 16, 20, 0.10);
    --line-2: rgba(16, 16, 20, 0.05);

    --lime: #c6ff3d;
    --coral: #ff5b7e;
    --blue: #2D6BFF;
    --violet: #8e63ff;

    --ok: #22c55e;
    --warn: #f59e0b;
    --err: #ef4444;

    /* Type families */
    --font-sans: Manrope, "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;

    /* Geometry — rail + headers */
    --rail-w: 64px;
    --rail-w-exp: 232px;
    --header-h: 56px;
    --radius-brand: 14px;

    /* Brand shadows */
    --shadow-glow: 0 0 0 1px rgba(198, 255, 61, 0.6), 0 8px 24px rgba(198, 255, 61, 0.35);
    --shadow-brand: 0 12px 32px rgba(16, 16, 20, 0.08);
    --shadow-brand-lg: 0 24px 80px rgba(16, 16, 20, 0.14);

    /* ---- Primary scale — remapped to Electric Blue (#2D6BFF) ---- */
    --primary-50: #eaf0ff;
    --primary-100: #d4e0ff;
    --primary-200: #a9c2ff;
    --primary-300: #7fa3ff;
    --primary-400: #5485ff;
    --primary-500: #2D6BFF;
    --primary-600: #1f4fcc;
    --primary-700: #173b99;
    --primary-800: #102b70;
    --primary-900: #0a1c4a;

    /* Neutral — Slate */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Semantic */
    --success-50: #f0fdf4;
    --success-100: #dcfce7;
    --success-500: #22c55e;
    --success-600: #16a34a;
    --warning-50: #fffbeb;
    --warning-100: #fef3c7;
    --warning-500: #f59e0b;
    --warning-600: #d97706;
    --error-50: #fef2f2;
    --error-100: #fee2e2;
    --error-500: #ef4444;
    --error-600: #dc2626;
    --info-50: #eff6ff;
    --info-100: #dbeafe;
    --info-500: #3b82f6;
    --info-600: #2563eb;

    /* Surfaces */
    --bg-primary: #ffffff;
    --bg-secondary: var(--cloud);
    --bg-tertiary: var(--gray-100);
    --bg-sidebar: #ffffff;
    --bg-header: #ffffff;

    /* Text */
    --text-primary: var(--gray-900);
    --text-secondary: var(--gray-500);
    --text-tertiary: var(--gray-400);
    --text-inverse: #ffffff;

    /* Borders */
    --border-primary: var(--gray-200);
    --border-secondary: var(--gray-100);
    --border-focus: var(--primary-500);

    /* Shadows — ultra-soft Linear style */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 4px 8px -2px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.06), 0 4px 8px -4px rgba(0, 0, 0, 0.03);
    --shadow-xl: 0 24px 48px -8px rgba(0, 0, 0, 0.08);
    --shadow-ring: 0 0 0 3px rgba(99, 102, 241, 0.15);

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 2.5rem;
    --spacing-3xl: 3rem;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;

    /* Typography */
    --font-size-xs: 0.6875rem;
    --font-size-sm: 0.8125rem;
    --font-size-base: 0.875rem;
    --font-size-lg: 1rem;
    --font-size-xl: 1.125rem;
    --font-size-2xl: 1.25rem;
    --font-size-3xl: 1.5rem;

    /* Transitions */
    --transition-fast: 120ms cubic-bezier(0.25, 0.1, 0.25, 1);
    --transition-base: 200ms cubic-bezier(0.25, 0.1, 0.25, 1);
    --transition-slow: 300ms cubic-bezier(0.25, 0.1, 0.25, 1);

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 56px;
    --content-padding: var(--spacing-xl);
}

/* Dark mode overrides */
.dark-mode {
    --bg-primary: #1e1e20;
    --bg-secondary: #111113;
    --bg-tertiary: #1a1a1c;
    --bg-sidebar: #161618;
    --bg-header: #161618;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --border-primary: #2a2a2e;
    --border-secondary: #222224;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.35);
    --shadow-xl: 0 24px 48px rgba(0, 0, 0, 0.4);
    --shadow-ring: 0 0 0 3px rgba(129, 140, 248, 0.2);
}

/* ==========================================================================
   Global
   ========================================================================== */

* { box-sizing: border-box; }

html {
    height: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    line-height: 1.5;
    letter-spacing: -0.011em;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: var(--primary-200);
    color: var(--primary-900);
}

.dark-mode ::selection {
    background: rgba(99, 102, 241, 0.3);
    color: #fff;
}

/* ==========================================================================
   Layout
   ========================================================================== */

.main-layout {
    min-height: 100vh;
    background: var(--bg-secondary);
}

/* App Bar */
.app-bar {
    background: var(--bg-header) !important;
    border-bottom: 1px solid var(--border-primary) !important;
    box-shadow: none !important;
    height: var(--header-height);
}

.app-bar .mud-appbar-content {
    padding: 0 var(--spacing-lg);
    gap: var(--spacing-sm);
}

.menu-toggle {
    color: var(--text-secondary) !important;
    border-radius: var(--radius-md) !important;
    width: 36px !important;
    height: 36px !important;
}

.menu-toggle:hover {
    background: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
}

.app-title-section {
    gap: var(--spacing-sm) !important;
    align-items: center;
}

.app-title-section .mud-icon-root {
    color: var(--primary-500) !important;
    font-size: 22px !important;
}

.app-title {
    font-weight: 600 !important;
    font-size: var(--font-size-base) !important;
    color: var(--text-primary) !important;
    letter-spacing: -0.02em;
}

/* Navigation Drawer */
.navigation-drawer {
    background: var(--bg-sidebar) !important;
    border-right: 1px solid var(--border-primary) !important;
    box-shadow: none !important;
    width: var(--sidebar-width) !important;
}

.drawer-header {
    padding: var(--spacing-lg) var(--spacing-lg) var(--spacing-md) !important;
    border-bottom: 1px solid var(--border-primary) !important;
    background: transparent !important;
}

.brand-name {
    font-weight: 700 !important;
    font-size: 1.1rem !important;
    color: var(--primary-400) !important;
    letter-spacing: -0.01em !important;
}

/* Main Content */
.main-content {
    background: var(--bg-secondary) !important;
    min-height: calc(100vh - var(--header-height));
}

.content-wrapper {
    padding: var(--content-padding);
    max-width: 100%;
}

/* Footer — minimal */
.app-footer {
    background: var(--bg-primary);
    border-top: 1px solid var(--border-primary);
    padding: var(--spacing-md) 0;
    margin-top: auto;
}

.footer-content {
    align-items: center;
}

.footer-links a {
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: var(--primary-500) !important;
}

/* ==========================================================================
   Dark Mode Toggle
   ========================================================================== */

.theme-toggle {
    width: 36px !important;
    height: 36px !important;
    border-radius: var(--radius-md) !important;
    color: var(--text-secondary) !important;
    transition: all var(--transition-fast) !important;
}

.theme-toggle:hover {
    background: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
}

/* ==========================================================================
   Cards — Clean, minimal
   ========================================================================== */

.modern-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    transition: all var(--transition-base);
    overflow: hidden;
}

.modern-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-primary);
}

.card-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-secondary);
}

.card-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.card-content {
    padding: var(--spacing-lg);
}

/* ==========================================================================
   Stat Cards (Dashboard)
   ========================================================================== */

.stat-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-xs);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-500);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card-primary::before { background: var(--primary-500); }
.stat-card-success::before { background: var(--success-500); }
.stat-card-warning::before { background: var(--warning-500); }
.stat-card-info::before { background: var(--info-500); }

.stat-value, .stat-number {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -0.025em;
}

.stat-label {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 500;
    margin-top: var(--spacing-xs);
}

/* ==========================================================================
   Appointment / Diary Styling
   ========================================================================== */

.appointment-blocked {
    background: var(--gray-50) !important;
    color: var(--text-secondary) !important;
    border-left: 3px solid var(--gray-300) !important;
    font-style: italic;
}

.appointment-cut {
    background: var(--error-50) !important;
    color: var(--error-600) !important;
    border-left: 3px solid var(--error-500) !important;
}

.appointment-color {
    background: var(--warning-50) !important;
    color: var(--warning-600) !important;
    border-left: 3px solid var(--warning-500) !important;
}

.appointment-extra {
    background: var(--success-50) !important;
    color: var(--success-600) !important;
    border-left: 3px solid var(--success-500) !important;
}

.appointment-brush {
    background: var(--info-50) !important;
    color: var(--info-600) !important;
    border-left: 3px solid var(--info-500) !important;
}

.appointment-default {
    background: var(--primary-50) !important;
    color: var(--primary-600) !important;
    border-left: 3px solid var(--primary-500) !important;
}

.slot-blocked {
    background: var(--gray-100) !important;
    color: var(--text-secondary) !important;
    font-style: italic;
    border-radius: var(--radius-sm);
}

.time-slot {
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm);
    margin: 2px 0;
    min-height: 40px;
    display: flex;
    align-items: center;
    transition: all var(--transition-fast);
    background: var(--bg-primary);
}

.time-slot:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-300);
}

/* Diary Grid */
.diary-container {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
    border: 1px solid var(--border-primary);
}

.diary-header {
    background: var(--primary-500);
    color: var(--text-inverse);
    padding: var(--spacing-md) var(--spacing-lg);
    text-align: center;
}

.diary-controls {
    background: var(--bg-primary);
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-primary);
}

/* Team Member Diary — Notion calendar style */
.team-member-diary {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.team-diary-card {
    height: 100%;
    min-height: 70vh;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-primary);
    transition: all var(--transition-fast);
    background: var(--bg-primary);
    box-shadow: none;
    display: flex;
    flex-direction: column;
}

.team-diary-card:hover {
    border-color: var(--gray-300);
    box-shadow: var(--shadow-xs);
}

.team-diary-header {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-primary);
    background: var(--bg-secondary);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    flex-shrink: 0;
}

.team-member-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    line-height: 1.4;
}

.team-diaries {
    min-height: 70vh;
    overflow: hidden;
    width: 100%;
}

.full-width-grid {
    width: 100% !important;
    margin: 0 !important;
}

.full-width-item {
    padding: 0 4px !important;
}

.team-diaries .mud-item {
    display: flex;
    align-items: stretch;
    min-height: 70vh;
    padding: 0 4px;
    margin-bottom: 16px;
}

.team-diary-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    overflow: hidden;
}

@media (max-width: 768px) {
    .team-diaries .mud-item {
        min-height: auto;
        margin-bottom: 16px;
    }
    .team-diary-card {
        min-height: auto;
    }
}

/* ==========================================================================
   Time Slots Grid & Bookings
   ========================================================================== */

.time-slots-container {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.time-slots-grid {
    gap: 0 !important;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex: 1;
    min-height: 500px;
}

.time-slots-grid .mud-grid-item {
    display: flex !important;
    align-items: stretch !important;
}

.time-slots-grid .mud-item {
    display: flex !important;
    flex-direction: column !important;
}

.time-slot-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 96px;
    padding: 0 12px;
    border-right: 1px solid var(--border-primary);
    border-bottom: 1px solid var(--border-primary);
    background: var(--bg-secondary);
    position: relative;
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.time-slot-cell:last-of-type { border-bottom: none; }
.time-slot-cell.working-slot { background: var(--bg-primary); }
.time-slot-cell.non-working-slot { background: var(--bg-tertiary); color: var(--text-tertiary); opacity: 0.7; }

.booking-cell {
    display: flex;
    align-items: stretch;
    height: 96px;
    padding: 4px 6px;
    overflow: hidden;
    border-bottom: 1px solid var(--border-primary);
    background: var(--bg-primary);
    position: relative;
}

.booking-cell:last-of-type { border-bottom: none; }
.booking-cell.working-slot { background: var(--bg-primary); }
.booking-cell.non-working-slot { background: var(--bg-tertiary); opacity: 0.7; }

.bookings-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 2px;
    justify-content: flex-start;
    align-items: stretch;
    padding: 0;
}

.booking-item {
    padding: 4px 28px 4px 10px;
    border-radius: var(--radius-sm);
    transition: filter var(--transition-fast);
    cursor: pointer;
    border: none;
    /* Per-customer color softened via color-mix; falls back to neutral cloud. */
    --booking-color: #94a3b8;
    background: color-mix(in srgb, var(--booking-color) 28%, #ffffff) !important;
    border-left: 4px solid color-mix(in srgb, var(--booking-color) 85%, #1a1a20);
    width: 100%;
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    align-items: center;
    position: relative;
    font-size: var(--font-size-xs);
    color: var(--ink, #101014);
    white-space: nowrap;
    overflow: hidden;
    box-shadow: none !important;
}
.dark-mode .booking-item {
    background: color-mix(in srgb, var(--booking-color) 22%, #1a1a20) !important;
    color: #ECE7DF;
}

.booking-item:last-child { margin-right: 0; }
.booking-item:hover { background: color-mix(in srgb, var(--booking-color) 28%, #ffffff) !important; }
.dark-mode .booking-item:hover { background: color-mix(in srgb, var(--booking-color) 32%, #1a1a20) !important; }

.booking-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.booking-description {
    font-weight: 500;
    color: var(--text-primary);
    font-size: var(--font-size-xs);
    line-height: 1.25;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.booking-item[style*="background"] .booking-description {
    color: #1e293b !important;
}

.time-text {
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.delete-btn {
    opacity: 0;
    transition: opacity var(--transition-fast);
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background-color: transparent !important;
    color: var(--error-500) !important;
    border: none !important;
    border-radius: 50% !important;
    width: 20px !important;
    height: 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer;
    z-index: 10;
    min-width: 20px !important;
    padding: 0 !important;
}

.delete-btn:hover { background-color: rgba(239, 68, 68, 0.1) !important; }
.delete-btn .mud-button-label, .delete-btn .mud-icon-button-label, .delete-btn svg, .delete-btn .mud-icon-root { display: none !important; }
.delete-btn::before { content: "\00d7"; font-size: 18px !important; font-weight: bold; line-height: 1; color: var(--error-500); }
.booking-item:hover .delete-btn { opacity: 1; }

.empty-slot {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: background-color var(--transition-fast);
    background: transparent;
    border-radius: 0;
}

.empty-slot:hover { background-color: rgba(45, 107, 255, 0.04); }

.dark-mode .empty-slot:hover { background-color: rgba(255,255,255,0.04); }

.available-text {
    font-size: var(--font-size-xs);
    color: var(--muted, #68615c) !important;
    font-weight: 400;
    opacity: 0.65;
    letter-spacing: 0.01em;
}
.empty-slot:hover .available-text { opacity: 0.9; }

.no-schedule {
    padding: var(--spacing-2xl);
    text-align: center;
    color: var(--text-secondary);
}

.time-slots-grid .mud-item:nth-child(2n) { border-right: none; }

/* ==========================================================================
   Navigation Menu
   ========================================================================== */

.navigation-menu {
    padding: var(--spacing-sm) 0;
}

.mud-nav-menu {
    padding: 0 var(--spacing-sm);
}

.nav-section-header {
    padding: var(--spacing-lg) var(--spacing-md) var(--spacing-xs) !important;
    font-size: var(--font-size-xs) !important;
    font-weight: 600 !important;
    color: var(--text-tertiary) !important;
    letter-spacing: 0.04em !important;
    text-transform: uppercase !important;
}

.mud-nav-item {
    margin-bottom: 1px;
    border-radius: var(--radius-md);
}

.mud-navlink {
    border-radius: var(--radius-md) !important;
    padding: 6px 12px !important;
    font-size: var(--font-size-sm) !important;
    font-weight: 500 !important;
    color: var(--text-secondary) !important;
    transition: all var(--transition-fast) !important;
    gap: 10px !important;
}

.mud-navlink:hover {
    background: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
}

.mud-navlink.active {
    background: var(--primary-50) !important;
    color: var(--primary-600) !important;
}

.dark-mode .mud-navlink.active {
    background: rgba(99, 102, 241, 0.12) !important;
    color: var(--primary-400) !important;
}

.mud-navlink .mud-icon-root {
    font-size: 20px !important;
}

.nav-divider {
    margin: var(--spacing-sm) var(--spacing-md) !important;
    border-color: var(--border-primary) !important;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn-primary {
    background: var(--primary-500) !important;
    border: none !important;
    color: var(--text-inverse) !important;
    border-radius: var(--radius-md) !important;
    font-weight: 500 !important;
    padding: var(--spacing-sm) var(--spacing-lg) !important;
    transition: all var(--transition-fast) !important;
    box-shadow: var(--shadow-xs) !important;
}

.btn-primary:hover {
    background: var(--primary-600) !important;
    box-shadow: var(--shadow-sm) !important;
}

.btn-secondary {
    background: var(--bg-primary) !important;
    border: 1px solid var(--border-primary) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-md) !important;
    font-weight: 500 !important;
    padding: var(--spacing-sm) var(--spacing-lg) !important;
    transition: all var(--transition-fast) !important;
}

.btn-secondary:hover {
    background: var(--bg-tertiary) !important;
    border-color: var(--gray-300) !important;
}

/* ==========================================================================
   Form Controls
   ========================================================================== */

.form-control:focus, .form-select:focus {
    border-color: var(--border-focus) !important;
    box-shadow: var(--shadow-ring) !important;
}

/* ==========================================================================
   Utility
   ========================================================================== */

.gradient-bg {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-400));
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-400));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.glass-effect {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.dark-mode .glass-effect {
    background: rgba(30, 30, 32, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .content-wrapper { padding: var(--spacing-md); }
    .stat-card { padding: var(--spacing-md); }
    .stat-value, .stat-number { font-size: var(--font-size-xl); }
    .footer-links { display: none !important; }
}

@media (max-width: 480px) {
    .app-title { font-size: var(--font-size-sm); }
    .content-wrapper { padding: var(--spacing-sm); }
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(12px); }
    to { opacity: 1; transform: translateX(0); }
}

.animate-fade-in-up { animation: fadeInUp 0.35s ease-out; }
.animate-slide-in-right { animation: slideInRight 0.25s ease-out; }

/* ==========================================================================
   MudBlazor Overrides
   ========================================================================== */

.mud-paper {
    box-shadow: var(--shadow-xs) !important;
    border-radius: var(--radius-lg) !important;
    border: 1px solid var(--border-primary);
}

.mud-card {
    box-shadow: var(--shadow-xs) !important;
    border-radius: var(--radius-lg) !important;
    border: 1px solid var(--border-primary) !important;
    transition: all var(--transition-base);
}

.mud-card:hover {
    box-shadow: var(--shadow-sm) !important;
}

.mud-button-filled-primary {
    background: var(--primary-500) !important;
    box-shadow: var(--shadow-xs) !important;
    transition: all var(--transition-fast) !important;
}

.mud-button-filled-primary:hover {
    background: var(--primary-600) !important;
    box-shadow: var(--shadow-sm) !important;
}

.mud-button-filled-secondary {
    background: var(--gray-600) !important;
    box-shadow: var(--shadow-xs) !important;
}

.mud-button-filled-secondary:hover {
    background: var(--gray-700) !important;
    box-shadow: var(--shadow-sm) !important;
}

.mud-button-text {
    transition: all var(--transition-fast) !important;
}

.mud-input-outlined .mud-input-outlined-border {
    border-color: var(--border-primary) !important;
    border-radius: var(--radius-md) !important;
    transition: border-color var(--transition-fast) !important;
}

.mud-input-outlined:hover .mud-input-outlined-border {
    border-color: var(--gray-300) !important;
}

.mud-input-outlined.mud-input-focused .mud-input-outlined-border {
    border-color: var(--primary-500) !important;
    box-shadow: var(--shadow-ring);
}

.mud-table .mud-table-head .mud-table-cell {
    font-weight: 600;
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
}

.mud-table .mud-table-body .mud-table-row:hover {
    background: var(--bg-secondary) !important;
}

.mud-chip {
    border-radius: var(--radius-sm) !important;
    font-weight: 500 !important;
    font-size: var(--font-size-xs) !important;
}

.mud-dialog {
    border-radius: var(--radius-xl) !important;
    box-shadow: var(--shadow-xl) !important;
}

.mud-snackbar {
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-lg) !important;
}

/* Culture selector refinement */
.culture-selector-wrapper .mud-select {
    font-size: var(--font-size-sm) !important;
}

/* Login display refinement */
.user-info {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.user-info:hover {
    background: var(--bg-tertiary);
}

.user-name {
    font-weight: 500 !important;
    font-size: var(--font-size-sm) !important;
}

/* ==========================================================================
   Loading Screen (index.html)
   ========================================================================== */

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #f8fafc;
    gap: 20px;
}

.loading-logo {
    animation: pulse-subtle 2s ease-in-out infinite;
}

.loading-bar {
    width: 180px;
    height: 3px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.loading-bar-inner {
    width: 40%;
    height: 100%;
    background: #6366f1;
    border-radius: 3px;
    animation: loading-slide 1.2s ease-in-out infinite;
}

@keyframes loading-slide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

@keyframes pulse-subtle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading-text {
    color: #64748b;
    font-family: Manrope, system-ui, sans-serif;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.01em;
}

/* Error UI */
#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    background: var(--bg-primary);
    border: 1px solid var(--error-500);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--spacing-md) var(--spacing-lg);
    max-width: 400px;
}

.error-content {
    text-align: center;
}

.error-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    margin-top: var(--spacing-sm);
}

.error-actions a {
    color: var(--primary-500);
    text-decoration: none;
    font-weight: 500;
    font-size: var(--font-size-sm);
}

/* ==========================================================================
   End of Stylesheet
   ========================================================================== */

/* ==========================================================================
   Rebrand — Nav Rail (compact icon menu) · Top bar pill/AI · Mobile bottom nav
   ========================================================================== */

.nav-rail {
    display: flex;
    flex-direction: column;
    padding: 8px 6px;
    gap: 2px;
    background: var(--ink, #101014);
    color: #ECE7DF;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}
.nav-rail .nav-rail__divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 6px 4px;
}
.nav-rail .nav-rail__link.mud-nav-link {
    color: #F7F4EE !important;
    border-radius: 12px;
    margin: 1px 0;
    padding: 10px 12px;
    transition: background-color .15s ease, color .15s ease;
    min-height: 44px;
}
.nav-rail .nav-rail__link.mud-nav-link .mud-icon-root,
.nav-rail .nav-rail__link.mud-nav-link .mud-nav-link-icon {
    color: #F7F4EE !important;
    fill: currentColor !important;
    opacity: 0.92;
}
.nav-rail .nav-rail__link.mud-nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: #ffffff !important;
}
.nav-rail .nav-rail__link.mud-nav-link:hover .mud-icon-root,
.nav-rail .nav-rail__link.mud-nav-link:hover .mud-nav-link-icon {
    color: #ffffff !important;
    opacity: 1;
}
.nav-rail .nav-rail__link.mud-nav-link.active {
    background: var(--lime, #C6FF3D) !important;
    color: var(--ink, #101014) !important;
}
.nav-rail .nav-rail__link.mud-nav-link.active .mud-icon-root,
.nav-rail .nav-rail__link.mud-nav-link.active .mud-nav-link-icon {
    color: var(--ink, #101014) !important;
    opacity: 1;
}
.nav-rail .nav-rail__link.mud-nav-link.active .nav-rail__label,
.nav-rail .nav-rail__link.mud-nav-link.active .mud-nav-link-text {
    color: var(--ink, #101014) !important;
    font-weight: 700;
}
.nav-rail .nav-rail__label {
    margin-left: 10px;
    font-family: var(--font-sans, 'Manrope'), sans-serif;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    opacity: 1;
    transition: opacity .15s ease;
}
.nav-rail--collapsed .nav-rail__label,
.nav-rail--collapsed .mud-nav-link-text {
    display: none;
}
.nav-rail--collapsed .nav-rail__link.mud-nav-link {
    justify-content: center;
    padding: 10px;
}
.nav-rail--expanded .nav-rail__link .mud-nav-link-text {
    display: inline;
}

/* Drawer host overrides — make MudDrawer transparent so .nav-rail provides bg */
.nav-rail-host.mud-drawer {
    background: var(--ink, #101014) !important;
    border-right: 1px solid rgba(255,255,255,0.06);
}

/* Top bar — salon pill, brand mark, Ask AI */
.app-bar.app-bar--rebrand {
    background: var(--paper, #ffffff) !important;
    color: var(--ink, #101014) !important;
    border-bottom: 1px solid var(--line, #E6E1D8);
    box-shadow: none !important;
}
.dark-mode .app-bar.app-bar--rebrand {
    background: var(--ink, #101014) !important;
    color: var(--cloud, #F7F4EE) !important;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-mark__logo {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--lime, #C6FF3D), var(--blue, #2D6BFF));
    box-shadow: var(--shadow-glow, 0 0 0 4px rgba(198,255,61,0.18));
}

.salon-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 16px;
    padding: 4px 10px 4px 8px;
    border-radius: 999px;
    background: var(--cloud, #F7F4EE);
    border: 1px solid var(--line, #E6E1D8);
    font-family: var(--font-mono, 'IBM Plex Mono'), monospace;
    font-size: 12px;
    font-weight: 500;
    color: var(--ink, #101014);
    max-width: 220px;
    overflow: hidden;
}
.dark-mode .salon-pill {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.12);
    color: #fff;
}
.salon-pill__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--lime, #C6FF3D);
    box-shadow: 0 0 0 3px rgba(198,255,61,0.18);
    flex-shrink: 0;
}
.salon-pill__name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar__ai.mud-button-filled {
    background: var(--lime, #C6FF3D) !important;
    color: var(--ink, #101014) !important;
    border-radius: 999px;
    padding: 6px 14px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
    margin: 0 8px;
    box-shadow: 0 1px 0 rgba(0,0,0,0.06);
}
.topbar__ai.mud-button-filled:hover {
    background: #d4ff5e !important;
    filter: brightness(1.02);
}

/* AI Insight bar (Diary) */
.ai-insight-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    background: linear-gradient(90deg, rgba(198,255,61,0.10), rgba(45,107,255,0.08));
    border: 1px solid rgba(45,107,255,0.18);
    margin: 12px 0;
    font-family: var(--font-sans, 'Manrope'), sans-serif;
}
.ai-insight-bar__icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    background: var(--lime, #C6FF3D);
    color: var(--ink, #101014);
    flex-shrink: 0;
}
.ai-insight-bar__text { flex: 1; font-size: 14px; color: var(--ink, #101014); }
.dark-mode .ai-insight-bar__text { color: var(--cloud, #F7F4EE); }

/* Mobile bottom nav (rendered only on small screens via CSS) */
.bottom-nav { display: none; }

@media (max-width: 768px) {
    /* Hide rail labels & shrink to icon-only */
    .nav-rail__label { display: none !important; }

    /* Topbar — drop the salon pill & Ask AI label content for space */
    .salon-pill { display: none; }
    .topbar__ai .mud-button-label > span { display: none; }
    .topbar__ai.mud-button-filled { padding: 6px 10px; min-width: 0; }

    /* Diary: stack team columns vertically */
    .diary-page .mud-grid-item { width: 100% !important; flex-basis: 100% !important; max-width: 100% !important; }

    /* Bottom nav */
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        height: 60px;
        background: var(--ink, #101014);
        color: #ECE7DF;
        border-top: 1px solid rgba(255,255,255,0.08);
        z-index: 1300;
        justify-content: space-around;
        align-items: center;
        padding: 4px 8px env(safe-area-inset-bottom);
    }
    .bottom-nav__item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        flex: 1;
        padding: 4px;
        color: #ECE7DF;
        text-decoration: none;
        font-family: var(--font-sans, 'Manrope'), sans-serif;
        font-size: 11px;
        font-weight: 600;
        border-radius: 8px;
    }
    .bottom-nav__item.active { color: var(--lime, #C6FF3D); }
    .bottom-nav__item:hover { background: rgba(255,255,255,0.06); }

    /* Reserve space at bottom of main content for the nav bar */
    .main-content { padding-bottom: 76px !important; }

    /* Hide the mini drawer on mobile in favour of bottom nav */
    .nav-rail-host.mud-drawer { display: none !important; }
    .menu-toggle { display: none !important; }

    /* The persistent MudDrawer is open by default and applies a left margin to
       MudMainContent (~232px). When the drawer is hidden on mobile, that margin
       must be reset so the page content uses the full viewport width. */
    .mud-main-content {
        margin-left: 0 !important;
        padding-left: 0 !important;
    }

    /* ----- Diary page — compact mobile layout -----
       Goal: show ~1.2 days worth of slots without scrolling so users can scan
       the schedule at a glance. Shrinks header, controls, slot rows. */

    /* MudContainer side padding eats too much width on a 398px viewport */
    .diary-page { padding-left: 8px !important; padding-right: 8px !important; }

    /* Page header: stack vertically, smaller title, hide subtitle */
    .diary-page .page-header .mud-stack-row { flex-direction: column !important; align-items: stretch !important; gap: 8px; }
    .diary-page .page-header .mb-6 { margin-bottom: 8px !important; }
    .diary-page .page-title { font-size: 1.25rem !important; }
    .diary-page .page-title .mud-icon-root { font-size: 20px !important; margin-right: 6px !important; }
    .diary-page .page-subtitle { display: none !important; }

    /* Action buttons (Nieuwe afspraak / Tijd blokkeren): compact, equal width */
    .diary-page .page-header .mud-button-root {
        font-size: 13px !important;
        padding: 6px 10px !important;
        min-width: 0 !important;
        flex: 1 1 0;
    }
    .diary-page .page-header .mud-button-root .mud-button-icon-start { margin-right: 4px !important; }
    .diary-page .page-header .mud-button-root .mud-icon-root { font-size: 18px !important; }

    /* Controls (date picker + chevrons): tighter and single-row, hide today chip */
    .diary-page .controls-section .mud-paper { padding: 8px !important; }
    .diary-page .controls-section .mb-6 { margin-bottom: 8px !important; }
    .diary-page .controls-section .mud-stack-row { gap: 6px !important; flex-wrap: wrap; }
    .diary-page .controls-section .mud-input-control { min-width: 0 !important; }
    .diary-page .controls-section .mud-icon-button { width: 32px !important; height: 32px !important; }
    .diary-page .controls-section .mud-chip { display: none !important; }

    /* AI insight bar: trim padding */
    .diary-page .ai-insight-bar { padding: 6px 10px; margin: 6px 0; font-size: 12px; }
    .diary-page .ai-insight-bar__icon { width: 24px; height: 24px; }
    .diary-page .ai-insight-bar__text { font-size: 12px; }

    /* Team diary card: remove min-height + tighten header */
    .diary-page .team-diary-card { min-height: 0 !important; }
    .diary-page .team-diary-header { padding: 6px 10px; }
    .diary-page .team-diary-header .mb-3 { margin-bottom: 0 !important; }
    .diary-page .team-diary-header .mud-avatar { width: 28px !important; height: 28px !important; min-width: 28px !important; font-size: 13px !important; }
    .diary-page .team-member-name { font-size: 13px !important; }
    .diary-page .team-diary-header .mud-typography-caption { font-size: 11px !important; }

    .diary-page .team-diaries .mud-item { margin-bottom: 8px; padding: 0 2px; }
    .diary-page .full-width-item { padding: 0 2px !important; }

    /* Slot grid: drop fixed min-height; rely on slot-cell heights */
    .diary-page .time-slots-container { padding: 4px; }
    .diary-page .time-slots-grid { min-height: 0; }

    /* The big win — shrink slot rows from 96px to 32px (~3x more visible) */
    .diary-page .time-slot-cell,
    .diary-page .booking-cell {
        height: 32px !important;
        padding: 0 6px !important;
    }
    .diary-page .time-slot-cell .time-text,
    .diary-page .time-text { font-size: 10px !important; }

    .diary-page .booking-item {
        padding: 2px 22px 2px 6px !important;
        font-size: 11px !important;
        border-left-width: 3px !important;
    }
    .diary-page .booking-description { font-size: 11px !important; }
    .diary-page .available-text { font-size: 10px !important; }
}

/* ==========================================================================
   PWA Install Button (mobile-first floating action)
   ========================================================================== */

.pwa-install-btn {
    position: fixed;
    right: 12px;
    bottom: 76px; /* sits above the .bottom-nav (60px + safe area) */
    z-index: 1400;
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--lime, #C6FF3D), var(--blue, #2D6BFF));
    color: var(--ink, #101014);
    font-family: var(--font-sans, 'Manrope'), sans-serif;
    font-weight: 700;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(45,107,255,0.35), 0 0 0 1px rgba(16,16,20,0.06);
    transition: transform 150ms ease, box-shadow 150ms ease, opacity 200ms ease;
}

.pwa-install-btn--visible { display: inline-flex; }
.pwa-install-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(45,107,255,0.45); }
.pwa-install-btn:active { transform: translateY(0); }
.pwa-install-btn:disabled { opacity: 0.6; cursor: default; }

.pwa-install-btn__icon { display: inline-flex; align-items: center; }

/* On wider screens we don't have a bottom nav; place button bottom-right corner */
@media (min-width: 769px) {
    .pwa-install-btn { bottom: 20px; right: 20px; }
}

/* iOS install hint — Safari has no programmatic install; instruct the user. */
.pwa-ios-hint {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 76px;
    z-index: 1400;
    display: none;
    background: var(--ink, #101014);
    color: var(--cloud, #F7F4EE);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.35);
    padding: 12px 14px;
    font-family: var(--font-sans, 'Manrope'), sans-serif;
}
.pwa-ios-hint--visible { display: block; }
.pwa-ios-hint__inner { position: relative; padding-right: 28px; }
.pwa-ios-hint__title { font-weight: 700; font-size: 14px; margin-bottom: 2px; }
.pwa-ios-hint__body { font-size: 13px; opacity: 0.85; }
.pwa-ios-hint__close {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--cloud, #F7F4EE);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.7;
}
.pwa-ios-hint__close:hover { opacity: 1; }
