:root {
    --bg-base: #0f172a;
    --bg-surface: #1e293b;
    --bg-surface-elevated: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    
    --accent-primary: #3b82f6;
    --accent-primary-hover: #2563eb;
    
    --status-working: rgba(16, 185, 129, 0.8); /* Green */
    --status-flexible: rgba(245, 158, 11, 0.6); /* Orange */
    --status-sleeping: rgba(15, 23, 42, 0.6); /* Dark */
    --status-hover: rgba(255, 255, 255, 0.2);
    
    --border: rgba(255,255,255,0.1);
    --radius-md: 8px;
}

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

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--bg-base);
    background-image: radial-gradient(at top right, #3b82f622, transparent 50%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 2rem 1rem;
    display: flex;
    justify-content: center;
}

.app-container {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.glass-panel {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

header { text-align: center; margin-bottom: 1rem; }
header h1 { font-size: 2rem; color: var(--accent-primary); margin-bottom: 0.5rem; }
header p { color: var(--text-secondary); }

/* Controls */
.controls {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    justify-content: space-between;
}

.add-tz-group {
    position: relative;
    width: 100%;
    max-width: 400px;
}

input {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
}
input:focus { border-color: var(--accent-primary); }

.suggestions-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    max-height: 250px;
    overflow-y: auto;
    z-index: 100;
    list-style: none;
}
.suggestions-list.hidden { display: none; }
.suggestions-list li {
    padding: 0.75rem 1rem;
    cursor: pointer;
}
.suggestions-list li:hover { background: var(--bg-surface); }

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    border: none;
    font-weight: 600;
    cursor: pointer;
    background: var(--accent-primary);
    color: white;
    transition: all 0.2s;
}
.btn:hover { background: var(--accent-primary-hover); }
.btn-outline { background: transparent; border: 1px solid var(--border); }
.btn-outline:hover { background: var(--bg-surface-elevated); }
.icon-btn { padding: 0.5rem; width: 40px; height: 40px; display:flex; align-items:center; justify-content:center; }

.date-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
}
#current-date-display { font-size: 1.25rem; font-weight: 600; min-width: 250px; text-align: center; }


/* Timeline */
.timeline-container {
    position: relative;
    overflow-x: auto;
    padding-bottom: 1rem;
}

.timeline-header {
    display: grid;
    grid-template-columns: 200px repeat(24, 1fr);
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
}
.th-label {
    /* empty for timezone name space */
}
.th-hour {
    position: relative;
}

.timezone-rows {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tz-row {
    display: grid;
    grid-template-columns: 200px repeat(24, 1fr);
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    height: 48px;
}

.tz-info {
    padding: 0.5rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-right: 1px solid var(--border);
    position: relative;
}
.tz-info .name { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tz-info .time { font-size: 0.75rem; color: var(--text-secondary); }

.btn-remove-tz {
    position: absolute;
    top: 50%;
    right: 5px;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0;
}
.tz-info:hover .btn-remove-tz { opacity: 1; color: var(--accent-primary); }

.hour-block {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    transition: filter 0.2s;
    user-select: none;
    border-right: 1px solid rgba(255,255,255,0.05);
}
.hour-block:last-child { border-right: none; }

.hour-block.working { background-color: var(--status-working); color: #000; }
.hour-block.flexible { background-color: var(--status-flexible); color: #000; }
.hour-block.sleeping { background-color: var(--status-sleeping); color: var(--text-secondary); }

.hour-block:hover, .hour-block.highlight {
    filter: brightness(1.3);
    border: 1px solid white;
    z-index: 2;
}


/* Footer */
footer {
    display: flex;
    justify-content: center;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}
.legend {
    display: flex;
    gap: 1.5rem;
}
.legend-item {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.color-box {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    margin-right: 0.5rem;
}
.color-box.working { background-color: var(--status-working); }
.color-box.flexible { background-color: var(--status-flexible); }
.color-box.sleeping { background-color: var(--status-sleeping); }
