:root {
    --bg-main: #0b0f19;
    --bg-card: rgba(22, 28, 45, 0.75);
    --bg-card-hover: rgba(30, 39, 62, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: #3b82f6;
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dim: #6b7280;
    
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --accent: #10b981;
    
    --avail-high: #10b981;
    --avail-high-bg: rgba(16, 185, 129, 0.15);
    --avail-mid: #f59e0b;
    --avail-mid-bg: rgba(245, 158, 11, 0.15);
    --avail-low: #ef4444;
    --avail-low-bg: rgba(239, 68, 68, 0.15);
    --avail-none: #374151;
    --avail-none-bg: rgba(55, 65, 81, 0.3);
    
    --font: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(at 15% 15%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 85% 85%, rgba(16, 185, 129, 0.12) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: var(--font);
    min-height: 100vh;
    padding: 1.5rem;
}

.app-container {
    max-width: 1500px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    padding: 1.25rem 1.75rem;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    font-size: 2.2rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem 0.75rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.header-brand h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ffffff 0%, #93c5fd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 0.2rem;
}

/* Controls & Trail Selector */
.controls-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    padding: 1.5rem 1.75rem;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.trail-selector-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.trail-selector-wrapper label {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #93c5fd;
}

.main-trail-select {
    background: #0f172a;
    border: 2px solid rgba(59, 130, 246, 0.4);
    color: #ffffff;
    padding: 0.85rem 1.25rem;
    border-radius: 12px;
    font-family: var(--font);
    font-size: 1.1rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.main-trail-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.25);
}

.quick-trail-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.pill-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.825rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pill-chip:hover, .pill-chip.active {
    background: rgba(59, 130, 246, 0.25);
    border-color: var(--primary);
    color: #ffffff;
}

/* Collapsible Filters Dropdown */
.filters-dropdown {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.filters-summary {
    padding: 0.85rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    list-style: none;
}

.filters-summary::-webkit-details-marker {
    display: none;
}

.filters-summary:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
}

.filters-dropdown[open] .summary-arrow {
    transform: rotate(180deg);
}

.summary-arrow {
    transition: transform 0.2s ease;
    font-size: 0.75rem;
    color: var(--text-dim);
}

.filters-body {
    padding: 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.25rem;
    background: rgba(15, 23, 42, 0.5);
}

.input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.input-wrapper label {
    font-size: 0.775rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
}

.input-wrapper input, .input-wrapper select {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.6rem 0.9rem;
    border-radius: 10px;
    font-family: var(--font);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s ease;
}

.input-wrapper input:focus, .input-wrapper select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

/* Trail Banner Card */
.trail-banner-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.9) 100%);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem 1.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.trail-title-group {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.trail-code-lg {
    font-size: 1.5rem;
    font-weight: 800;
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.4);
    padding: 0.5rem 1rem;
    border-radius: 12px;
}

.trail-banner-card h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
}

.trail-meta {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.2rem;
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn-external {
    background: linear-gradient(135deg, var(--accent) 0%, #059669 100%);
    color: white;
    text-decoration: none;
}

.btn-external:hover {
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

/* Calendar Days Multi-Column Grid */
.calendar-days-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
    align-items: start;
}

.day-column-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.day-column-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.day-header {
    background: rgba(15, 23, 42, 0.9);
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.day-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
}

.day-date-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.day-summary-badge {
    padding: 0.3rem 0.6rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
}

.day-summary-badge.high {
    background: var(--avail-high-bg);
    color: var(--avail-high);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.day-summary-badge.mid {
    background: var(--avail-mid-bg);
    color: var(--avail-mid);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.day-summary-badge.none {
    background: var(--avail-none-bg);
    color: var(--text-dim);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Slots List Inside Day Card */
.slots-list {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-height: 600px;
    overflow-y: auto;
}

.slot-item {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.15s ease;
}

.slot-item.available {
    background: rgba(16, 185, 129, 0.06);
    border-color: rgba(16, 185, 129, 0.25);
}

.slot-item.booked {
    opacity: 0.45;
}

.slot-time {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-main);
}

.slot-capacity-badge {
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.25rem 0.55rem;
    border-radius: 6px;
}

.slot-capacity-badge.high {
    background: var(--avail-high-bg);
    color: var(--avail-high);
}

.slot-capacity-badge.mid {
    background: var(--avail-mid-bg);
    color: var(--avail-mid);
}

.slot-capacity-badge.booked {
    background: rgba(239, 68, 68, 0.15);
    color: var(--avail-low);
}

/* Footer & Hidden Sync Dropdown */
.app-footer {
    margin-top: 1rem;
    margin-bottom: 2rem;
}

.sync-dropdown-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    overflow: hidden;
}

.sync-dropdown-summary {
    padding: 1rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    list-style: none;
}

.sync-dropdown-summary::-webkit-details-marker {
    display: none;
}

.sync-dropdown-summary:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
}

.summary-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.summary-right {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.sync-dropdown-body {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
}

.sync-help-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent);
    box-shadow: 0 0 8px var(--accent);
}

.pulse-dot.syncing {
    background-color: var(--avail-mid);
    box-shadow: 0 0 8px var(--avail-mid);
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    0% { opacity: 0.4; }
    100% { opacity: 1; }
}
