/* =========================================
   BandSync – Design System & Global Styles
   ========================================= */

/* --- CSS Custom Properties (Dark Mode) --- */
:root {
    /* Surface colors */
    --bg-primary: #0D0D14;
    --bg-secondary: #16161F;
    --bg-card: #1C1C28;
    --bg-card-hover: #24243A;
    --bg-elevated: #22222E;
    --bg-input: #1A1A26;
    
    /* Text colors */
    --text-primary: #F0F0F5;
    --text-secondary: #9E9EB8;
    --text-muted: #6B6B80;
    --text-inverse: #0D0D14;
    
    /* Accent colors – event types */
    --color-rehearsal: #4A90D9;
    --color-rehearsal-soft: rgba(74, 144, 217, 0.15);
    --color-rehearsal-mid: rgba(74, 144, 217, 0.35);
    --color-gig: #F5A623;
    --color-gig-soft: rgba(245, 166, 35, 0.15);
    --color-gig-mid: rgba(245, 166, 35, 0.35);
    --color-other: #8E8E93;
    --color-other-soft: rgba(142, 142, 147, 0.15);
    --color-other-mid: rgba(142, 142, 147, 0.35);
    --color-absence-vacation: #E07A7A;
    --color-absence-vacation-soft: rgba(224, 122, 122, 0.15);
    --color-absence-sick: #E8A855;
    --color-absence-sick-soft: rgba(232, 168, 85, 0.15);
    --color-absence-other: #9E9EB8;

    /* Status colors */
    --color-accepted: #4CD964;
    --color-declined: #FF3B5C;
    --color-tentative: #F5A623;

    /* UI colors */
    --color-accent: #7C5CFC;
    --color-accent-soft: rgba(124, 92, 252, 0.15);
    --color-accent-hover: #9578FF;
    --color-border: rgba(255, 255, 255, 0.08);
    --color-border-hover: rgba(255, 255, 255, 0.15);
    --color-danger: #FF3B5C;
    --color-success: #4CD964;
    --color-warning: #F5A623;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Border radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow-accent: 0 0 20px rgba(124, 92, 252, 0.3);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;

    /* Layout */
    --header-height: 56px;
    --tab-bar-height: 68px;
    --fab-size: 56px;
    --max-width: 480px;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    max-width: var(--max-width);
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

/* --- Header --- */
#app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 var(--space-md);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.header-logo {
    font-size: 24px;
}

.header-title {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-accent), var(--color-gig));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--space-sm);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    position: relative;
}

.icon-btn:hover {
    color: var(--text-primary);
    background: var(--color-accent-soft);
}

.badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--color-danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* --- Main Content --- */
#main-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: var(--space-md);
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* --- Bottom Tab Bar --- */
#tab-bar {
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: var(--tab-bar-height);
    background: var(--bg-secondary);
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.tab.active {
    color: var(--color-accent);
}

.tab:hover {
    color: var(--text-secondary);
}

.tab.active:hover {
    color: var(--color-accent-hover);
}

/* --- Floating Action Button --- */
#fab {
    position: absolute;
    bottom: calc(var(--tab-bar-height) + 16px + env(safe-area-inset-bottom, 0px));
    right: 16px;
    width: var(--fab-size);
    height: var(--fab-size);
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--color-accent), #9578FF);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow-accent);
    transition: all var(--transition-base);
    z-index: 90;
    -webkit-tap-highlight-color: transparent;
}

#fab:hover {
    transform: scale(1.08);
    box-shadow: 0 0 30px rgba(124, 92, 252, 0.5);
}

#fab:active {
    transform: scale(0.95);
}

#fab.open {
    transform: rotate(45deg);
}

/* --- FAB Menu --- */
.fab-menu {
    position: absolute;
    inset: 0;
    z-index: 95;
}

.fab-menu.hidden {
    display: none;
}

.fab-menu-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.fab-menu-items {
    position: absolute;
    bottom: calc(var(--tab-bar-height) + 16px + var(--fab-size) + 12px + env(safe-area-inset-bottom, 0px));
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    animation: fabMenuIn 0.25s ease;
}

@keyframes fabMenuIn {
    from { opacity: 0; transform: translateY(16px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.fab-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.fab-menu-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--color-border-hover);
}

.fab-menu-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.fab-menu-icon.rehearsal { background: var(--color-rehearsal-soft); }
.fab-menu-icon.gig { background: var(--color-gig-soft); }
.fab-menu-icon.other { background: var(--color-other-soft); }
.fab-menu-icon.absence { background: var(--color-absence-vacation-soft); }

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.modal-overlay.hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    width: 100%;
    max-width: var(--max-width);
    max-height: 92vh;
    max-height: 92dvh;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    -webkit-overflow-scrolling: touch;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 10;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--space-sm);
    font-size: 20px;
    line-height: 1;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--color-accent-soft);
}

.modal-body {
    padding: var(--space-lg);
}

/* --- Forms --- */
.form-group {
    margin-bottom: var(--space-md);
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.location-wrap {
    position: relative;
}

.location-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    z-index: 100;
    max-height: 220px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.location-suggestion-item {
    padding: var(--space-sm) var(--space-md);
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
    line-height: 1.4;
}
.location-suggestion-item:last-child { border-bottom: none; }
.location-suggestion-item:hover { background: var(--color-accent-soft); color: var(--color-accent); }

.location-map {
    height: 180px;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-top: var(--space-sm);
    border: 1px solid var(--color-border);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-input);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    transition: border-color var(--transition-fast);
    -webkit-appearance: none;
    appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.form-textarea {
    min-height: 80px;
    resize: vertical;
}

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%239E9EB8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-row {
    display: flex;
    gap: var(--space-md);
}

.form-row .form-group {
    flex: 1;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
}

.form-checkbox input {
    width: 20px;
    height: 20px;
    accent-color: var(--color-accent);
    cursor: pointer;
}

.form-checkbox span {
    font-size: 14px;
    color: var(--text-primary);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-accent), #9578FF);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    box-shadow: var(--shadow-glow-accent);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
}

.btn-danger {
    background: rgba(255, 59, 92, 0.15);
    color: var(--color-danger);
}

.btn-danger:hover {
    background: rgba(255, 59, 92, 0.25);
}

.btn-full {
    width: 100%;
}

.btn-sm {
    padding: 6px var(--space-md);
    font-size: 13px;
    border-radius: var(--radius-sm);
}

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    padding: var(--space-md);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.card:hover {
    background: var(--bg-card-hover);
    border-color: var(--color-border-hover);
    transform: translateY(-1px);
}

/* --- Chips --- */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
}

.chip-rehearsal { background: var(--color-rehearsal-soft); color: var(--color-rehearsal); }
.chip-gig { background: var(--color-gig-soft); color: var(--color-gig); }
.chip-other { background: var(--color-other-soft); color: var(--color-other); }
.chip-absence { background: var(--color-absence-vacation-soft); color: var(--color-absence-vacation); }

/* --- RSVP Buttons --- */
.rsvp-group {
    display: flex;
    gap: var(--space-sm);
}

.rsvp-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: var(--space-sm) var(--space-md);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.rsvp-btn:hover {
    border-color: var(--color-border-hover);
}

.rsvp-btn.accepted {
    background: rgba(76, 217, 100, 0.15);
    border-color: var(--color-accepted);
    color: var(--color-accepted);
}

.rsvp-btn.declined {
    background: rgba(255, 59, 92, 0.15);
    border-color: var(--color-declined);
    color: var(--color-declined);
}

.rsvp-btn.tentative {
    background: rgba(245, 166, 35, 0.15);
    border-color: var(--color-tentative);
    color: var(--color-tentative);
}

/* --- Toast --- */
#toast-container {
    position: fixed;
    top: calc(var(--header-height) + var(--space-sm));
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    width: calc(100% - 32px);
    max-width: calc(var(--max-width) - 32px);
    pointer-events: none;
}

.toast {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    pointer-events: auto;
}

.toast.success { border-left: 3px solid var(--color-success); }
.toast.warning { border-left: 3px solid var(--color-warning); }
.toast.error { border-left: 3px solid var(--color-danger); }
.toast.info { border-left: 3px solid var(--color-accent); }

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

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

/* =========================================
   Calendar Styles
   ========================================= */

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-md) var(--space-sm);
}

.calendar-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.calendar-nav button {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--space-xs);
    border-radius: var(--radius-sm);
    font-size: 18px;
    transition: all var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.calendar-nav button:hover {
    color: var(--text-primary);
    background: var(--color-accent-soft);
}

.view-toggle {
    display: flex;
    margin: 0 var(--space-md) var(--space-sm);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 3px;
    border: 1px solid var(--color-border);
}

.view-toggle button {
    flex: 1;
    padding: 6px var(--space-md);
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.view-toggle button.active {
    background: var(--color-accent);
    color: white;
    box-shadow: var(--shadow-sm);
}

/* Month View */
.month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    padding: 0 var(--space-sm);
}

.month-grid .day-header {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    padding: var(--space-xs) 0;
    text-transform: uppercase;
}

.month-grid .day-cell {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 2px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.month-grid .day-cell:hover {
    background: var(--bg-card);
}

.month-grid .day-cell.other-month {
    opacity: 0.3;
}

.month-grid .day-cell.today .day-number {
    background: var(--color-accent);
    color: white;
    border-radius: var(--radius-full);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.month-grid .day-cell.selected {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 0 0 1px var(--color-accent);
}

.day-number {
    font-size: 14px;
    font-weight: 500;
    line-height: 28px;
}

.day-dots {
    display: flex;
    gap: 3px;
    margin-top: 2px;
    flex-wrap: wrap;
    justify-content: center;
}

.day-dot {
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
}

.day-dot.rehearsal { background: var(--color-rehearsal); }
.day-dot.gig { background: var(--color-gig); }
.day-dot.other { background: var(--color-other); }
.day-dot.absence { background: var(--color-absence-vacation); }

/* Absence bars in month view */
.day-cell .absence-indicator {
    position: absolute;
    bottom: 2px;
    left: 2px;
    right: 2px;
    height: 3px;
    border-radius: 2px;
    background: var(--color-absence-vacation);
    opacity: 0.6;
}

/* Week View */
.week-view {
    padding: 0 var(--space-sm);
}

.week-day-headers {
    display: grid;
    grid-template-columns: 50px repeat(7, 1fr);
    gap: 1px;
    margin-bottom: var(--space-xs);
}

.week-day-header {
    text-align: center;
    padding: var(--space-xs);
}

.week-day-header .day-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.week-day-header .day-num {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.week-day-header.today .day-num {
    background: var(--color-accent);
    color: white;
    border-radius: var(--radius-full);
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#calendar-view .week-day-header {
    cursor: pointer;
    transition: all var(--transition-fast);
    pointer-events: auto !important; /* Ensure clicks are captured */
    position: relative;
    z-index: 20; /* Above the grid and time labels */
}

#calendar-view .week-day-header.selected {
    background: rgba(255, 255, 255, 0.15) !important;
    border: 2px solid var(--color-accent) !important;
    border-radius: var(--radius-sm);
    padding: calc(var(--space-xs) - 2px);
}

#calendar-view .week-day-header.selected .day-num {
    color: white !important;
}

.week-absence-bar {
    display: grid;
    grid-template-columns: 50px repeat(7, 1fr);
    gap: 1px;
    margin-bottom: var(--space-xs);
}

.week-absence-cell {
    min-height: 4px;
}

.week-absence-cell .absence-bar {
    height: 4px;
    border-radius: 2px;
    margin: 0 1px;
}

.week-time-grid {
    display: grid;
    grid-template-columns: 50px repeat(7, 1fr);
    gap: 1px;
    position: relative;
}

.week-time-label {
    font-size: 10px;
    color: var(--text-muted);
    text-align: right;
    padding-right: var(--space-sm);
    height: 48px;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
}

.week-time-slot {
    height: 48px;
    border-top: 1px solid var(--color-border);
    position: relative;
    transition: background var(--transition-fast);
}

.week-time-slot.selected {
    background: rgba(255, 255, 255, 0.03);
}

.week-event-block {
    position: absolute;
    left: 2px;
    right: 2px;
    border-radius: 4px;
    padding: 2px 4px;
    font-size: 10px;
    font-weight: 600;
    overflow: hidden;
    cursor: pointer;
    z-index: 5;
    transition: all var(--transition-fast);
}

.week-event-block:hover {
    z-index: 10;
    transform: scale(1.02);
}

.week-event-block.rehearsal {
    background: var(--color-rehearsal-mid);
    color: var(--color-rehearsal);
    border-left: 3px solid var(--color-rehearsal);
}

.week-event-block.gig {
    background: var(--color-gig-mid);
    color: var(--color-gig);
    border-left: 3px solid var(--color-gig);
}

.week-event-block.other {
    background: var(--color-other-mid);
    color: var(--color-other);
    border-left: 3px solid var(--color-other);
}

/* Day detail section below calendar */
.day-detail {
    padding: var(--space-md);
}

.day-detail-header {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

.day-events-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.day-event-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.day-event-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-1px);
}

.event-color-bar {
    width: 4px;
    height: 40px;
    border-radius: 2px;
    flex-shrink: 0;
}

.event-color-bar.rehearsal { background: var(--color-rehearsal); }
.event-color-bar.gig { background: var(--color-gig); }
.event-color-bar.other { background: var(--color-other); }

.event-info {
    flex: 1;
    min-width: 0;
}

.event-info .event-title {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.event-info .event-time {
    font-size: 13px;
    color: var(--text-secondary);
}

.event-info .event-location {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.event-rsvp-summary {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.rsvp-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
}

.rsvp-dot.accepted { background: var(--color-accepted); }
.rsvp-dot.declined { background: var(--color-declined); }
.rsvp-dot.tentative { background: var(--color-tentative); }
.rsvp-dot.none { background: var(--text-muted); }

/* =========================================
   Event Detail Styles
   ========================================= */

.event-detail-type {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.event-detail-type .type-icon {
    font-size: 24px;
}

.event-detail-title {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: var(--space-lg);
    line-height: 1.3;
}

.detail-section {
    margin-bottom: var(--space-lg);
}

.detail-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid var(--color-border);
}

.detail-row {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-xs) 0;
    font-size: 14px;
}

.detail-row .detail-icon {
    font-size: 16px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.detail-row .detail-text {
    color: var(--text-primary);
}

.detail-row .detail-label {
    color: var(--text-secondary);
    min-width: 80px;
}

/* Participants */
.participants-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
}

.participant-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
}

.participant-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

.participant-name {
    font-size: 13px;
    font-weight: 500;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.participant-status {
    font-size: 14px;
    flex-shrink: 0;
}

/* =========================================
   Events List Page
   ========================================= */

.events-tabs {
    display: flex;
    margin: var(--space-md);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 3px;
    border: 1px solid var(--color-border);
}

.events-tab {
    flex: 1;
    padding: var(--space-sm);
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.events-tab.active {
    background: var(--color-accent);
    color: white;
}

.events-filter {
    display: flex;
    gap: var(--space-xs);
    padding: 0 var(--space-md) var(--space-sm);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.events-filter::-webkit-scrollbar { display: none; }

.filter-chip {
    flex-shrink: 0;
    padding: 5px 12px;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    background: var(--bg-card);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}
.filter-chip:hover { border-color: var(--color-border-hover); color: var(--text-primary); }
.filter-chip.active { color: white; border-color: transparent; }
.filter-chip.rehearsal.active { background: var(--color-rehearsal); }
.filter-chip.gig.active { background: var(--color-gig); }
.filter-chip.other.active { background: var(--color-other); }
.filter-chip:not(.rehearsal):not(.gig):not(.other).active { background: var(--color-accent); }

.events-list {
    padding: 0 var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.events-date-group {
    margin-bottom: var(--space-md);
}

.events-date-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: var(--space-sm) 0;
}

/* =========================================
   Band Page Styles
   ========================================= */

.band-header {
    text-align: center;
    padding: var(--space-lg) var(--space-md);
}

.band-avatar {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, var(--color-accent), var(--color-gig));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin: 0 auto var(--space-md);
    box-shadow: var(--shadow-glow-accent);
}

.band-name {
    font-size: 24px;
    font-weight: 800;
}

.band-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: var(--space-xs);
}

.member-list {
    padding: 0 var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.icon-pick-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--space-xs);
    margin-top: var(--space-xs);
}

.icon-pick-btn {
    aspect-ratio: 1;
    font-size: 22px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}
.icon-pick-btn:hover { border-color: var(--color-border-hover); background: var(--bg-elevated); }
.icon-pick-btn.selected { border-color: var(--color-accent); background: var(--color-accent-soft); }

.member-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.member-avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
}

.member-info {
    flex: 1;
}

.member-name {
    font-size: 15px;
    font-weight: 600;
}

.member-role {
    font-size: 12px;
    color: var(--text-secondary);
}

.member-instrument {
    font-size: 12px;
    color: var(--text-muted);
}

.member-badge {
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.member-badge.admin {
    background: var(--color-accent-soft);
    color: var(--color-accent);
}

.member-badge.member {
    background: var(--color-other-soft);
    color: var(--color-other);
}

/* Availability Section */
.availability-section {
    padding: var(--space-md);
    margin-top: var(--space-md);
}

.availability-section h3 {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}

.availability-grid {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    overflow: hidden;
    display: grid;
    grid-template-columns: 80px repeat(7, 1fr);
}

.availability-row {
    display: contents;
}

.availability-row:last-child {
    border-bottom: none;
}

.availability-row.header {
    background: var(--bg-elevated);
}

.availability-cell {
    padding: var(--space-xs);
    text-align: center;
    font-size: 11px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    min-width: 0;
    overflow: hidden;
    color: #ffffff !important; /* Force true white for both browsers */
    border-bottom: 1px solid var(--color-border);
    -webkit-text-fill-color: #ffffff !important; /* Overwrite gradient text fill from collision */
}

.availability-cell.name {
    justify-content: flex-start;
    padding-left: var(--space-md);
    font-weight: 600;
    font-size: 12px;
}

.availability-cell.av-header {
    background: var(--bg-elevated);
    font-weight: 600;
    padding: var(--space-sm) 2px;
    justify-content: center;
    align-items: center;
    min-height: 48px;
    height: 100%;
}

.av-header-date {
    font-size: 11px;
    font-weight: 700;
    color: #ffffff !important;
}

/* Remove vertical title styles as they are no longer used */
.av-header-title-container, .av-header-title {
    display: none;
}

.availability-dot {
    width: 12px;
    height: 12px;
    border-radius: var(--radius-full);
}

.availability-dot.available { background: var(--color-accepted); }
.availability-dot.absent { background: var(--color-declined); }

/* Availability list (event rows) */
.avail-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.avail-event-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: var(--bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md) var(--space-sm) 0;
    overflow: hidden;
}

.avail-event-row .event-color-bar {
    width: 4px;
    min-width: 4px;
    height: auto;
    align-self: stretch;
    border-radius: 0;
}

.avail-event-info {
    flex: 1;
    min-width: 0;
}

.avail-event-meta {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-bottom: 2px;
}

.avail-type-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}
.avail-type-badge.rehearsal { background: var(--color-rehearsal-soft); color: var(--color-rehearsal); }
.avail-type-badge.gig       { background: var(--color-gig-soft);       color: var(--color-gig); }
.avail-type-badge.other     { background: var(--color-other-soft);     color: var(--color-other); }

.avail-event-date {
    font-size: 12px;
    color: var(--text-muted);
}

.avail-event-title {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.avail-members {
    display: flex;
    gap: var(--space-sm);
    flex-shrink: 0;
}

.avail-member-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.avail-member-name {
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* =========================================
   Settings Page
   ========================================= */

.settings-section {
    padding: var(--space-md);
}

.settings-section h3 {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
}

.settings-item-label {
    font-size: 15px;
    font-weight: 500;
}

.settings-item-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Toggle Switch */
.toggle {
    width: 48px;
    height: 28px;
    background: var(--text-muted);
    border-radius: var(--radius-full);
    position: relative;
    cursor: pointer;
    transition: background var(--transition-fast);
    flex-shrink: 0;
    border: none;
}

.toggle.active {
    background: var(--color-accent);
}

.toggle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: var(--radius-full);
    transition: transform var(--transition-fast);
}

.toggle.active::after {
    transform: translateX(20px);
}

/* =========================================
   Empty States
   ========================================= */

.empty-state {
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.empty-state .empty-text {
    font-size: 15px;
    font-weight: 500;
}

.empty-state .empty-hint {
    font-size: 13px;
    margin-top: var(--space-xs);
}

/* =========================================
   Collision Warning
   ========================================= */

.collision-warning {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: rgba(245, 166, 35, 0.1);
    border: 1px solid rgba(245, 166, 35, 0.3);
    border-radius: var(--radius-md);
    margin-top: var(--space-sm);
    font-size: 13px;
    color: var(--color-warning);
}

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

.hidden { display: none !important; }

.section-spacer {
    height: var(--space-lg);
}

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.mt-md { margin-top: var(--space-md); }
.mb-md { margin-bottom: var(--space-md); }

/* Scrollbar styling */
#main-content::-webkit-scrollbar {
    width: 4px;
}

#main-content::-webkit-scrollbar-track {
    background: transparent;
}

#main-content::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

/* Swipe hint animation */
@keyframes swipeHint {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-8px); }
}

/* --- Responsive (larger screens) --- */
@media (min-width: 481px) {
    #app {
        border-left: 1px solid var(--color-border);
        border-right: 1px solid var(--color-border);
    }
}

/* =========================================
   Auth & Onboarding Screens
   ========================================= */

#auth-screen,
#onboarding-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    overflow-y: auto;
    padding: var(--space-lg);
}

.auth-container {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.auth-logo {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}

.auth-title {
    font-size: 32px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--color-accent), var(--color-gig));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 15px;
}

.auth-tabs {
    display: flex;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 4px;
    gap: 4px;
}

.auth-tab {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.auth-tab.active {
    background: var(--color-accent);
    color: white;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.auth-error {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: 14px;
    text-align: center;
}

.auth-error.hidden {
    display: none;
}

.auth-error.error {
    background: rgba(255, 59, 92, 0.15);
    color: var(--color-danger);
}

.auth-error.info {
    background: rgba(74, 144, 217, 0.15);
    color: #4A90D9;
}

/* Onboarding */
.onboarding-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.onboarding-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-lg) var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-base);
    text-align: center;
    font-family: inherit;
    color: var(--text-primary);
}

.onboarding-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--color-accent);
    box-shadow: var(--shadow-glow-accent);
    transform: translateY(-2px);
}

.onboarding-card-title {
    font-weight: 600;
    font-size: 15px;
}

.onboarding-card-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.mt-sm {
    margin-top: var(--space-sm);
}

/* ===================== */
/* Custom Date Picker    */
/* ===================== */
.dp-trigger {
    text-align: left;
    cursor: pointer;
    color: var(--text-primary);
}

#dp-popup {
    position: fixed;
    z-index: 2000;
    background: var(--bg-elevated);
    border: 1.5px solid var(--color-accent);
    border-radius: var(--radius-lg);
    padding: var(--space-sm);
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    min-width: 240px;
}

.dp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
    padding: 0 var(--space-xs);
}

.dp-header span {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.dp-header button {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    line-height: 1;
}

.dp-header button:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

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

.dp-day-hdr {
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 4px 0;
}

.dp-day {
    text-align: center;
    padding: 6px 2px;
    font-size: 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-primary);
    transition: background 0.1s;
}

.dp-day:hover:not(.other) {
    background: var(--bg-card-hover);
}

.dp-day.other {
    color: var(--text-muted);
    cursor: default;
}

.dp-day.today {
    color: var(--color-accent);
    font-weight: 700;
}

.dp-day.selected {
    background: var(--color-accent);
    color: #fff;
    font-weight: 700;
}

.dp-day.selected.today {
    color: #fff;
}

/* ===================== */
/* Custom Time Picker    */
/* ===================== */
#tp-popup {
    position: fixed;
    z-index: 2000;
    background: var(--bg-elevated);
    border: 1.5px solid var(--color-accent);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    overflow: hidden;
}

.tp-manual {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--color-border);
}

.tp-manual-input {
    flex: 1;
    background: var(--bg-card);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    padding: 5px 8px;
    outline: none;
    width: 0;
    min-width: 0;
    text-align: center;
    letter-spacing: 1px;
}

.tp-manual-input:focus {
    border-color: var(--color-accent);
}

.tp-manual-label {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.tp-list {
    max-height: 200px;
    overflow-y: auto;
    padding: var(--space-xs) 0;
}

.tp-list::-webkit-scrollbar {
    width: 4px;
}
.tp-list::-webkit-scrollbar-track {
    background: transparent;
}
.tp-list::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 2px;
}

.tp-item {
    padding: 9px var(--space-md);
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.1s;
}

.tp-item:hover {
    background: var(--bg-card-hover);
}

.tp-item.selected {
    background: var(--color-accent);
    color: #fff;
    font-weight: 600;
}
