/* styles.css — AutoDay v2 */
:root {
    --bg-dark: #0D0D0D;
    --bg-card: #1A1A1A;
    --accent-green: #39EB59;
    --accent-red: #EB3959;
    --accent-cyan: #8FFCFF;
    --accent-blue: #3959EB;
    --accent-yellow: #EBDF39;
    --text-primary: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.6);
    --glass-bg: rgba(26, 26, 26, 0.65);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Glass & Blobs */
.blob {
    position: fixed; border-radius: 50%; filter: blur(90px);
    z-index: -1; opacity: 0.3; pointer-events: none;
}
.blob-1 { width: 500px; height: 500px; background: var(--accent-blue); top: -150px; left: -150px; }
.blob-2 { width: 400px; height: 400px; background: var(--accent-cyan); bottom: 5%; right: -100px; }

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
    padding: 24px;
}

/* Typography Utilities */
.title-primary { font-size: 2.2rem; font-weight: 800; letter-spacing: -1px; margin-bottom: 10px; }
.title-massive { font-size: 3.5rem; font-weight: 800; letter-spacing: -2px; line-height: 1.1; margin: 20px 0;}
.section-title { font-size: 1rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-muted); margin-bottom: 15px; }
.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
.mt-10 { margin-top: 10px; }
.pt-20 { padding-top: 20px; }
.border-top { border-top: 1px solid var(--glass-border); }

/* Navigation */
.top-nav {
    width: 100%; max-width: 900px;
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 24px; margin: 20px auto;
    gap: 10px;
    flex-wrap: wrap;
}
.brand { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.5px; white-space: nowrap; }
.clock-display { font-variant-numeric: tabular-nums; font-size: 1.25rem; font-weight: 600; white-space: nowrap; }
.nav-links {
    display: flex; gap: 4px; background: rgba(0,0,0,0.3); padding: 5px; border-radius: 12px;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-btn {
    background: transparent; border: none; color: var(--text-muted);
    font-family: 'Inter'; font-weight: 600; padding: 8px 14px; border-radius: 8px;
    cursor: pointer; transition: 0.3s; white-space: nowrap; font-size: 0.85rem;
}
.nav-btn:hover { color: var(--text-primary); }
.nav-btn.active { background: rgba(255,255,255,0.1); color: var(--text-primary); }

.controls-right { display: flex; align-items: center; gap: 15px; }
.focus-score-mini { font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.focus-score-mini span { color: var(--accent-green); font-weight: 800; }

/* SPA Container & Views */
.app-container {
    width: 100%; max-width: 900px;
    flex-grow: 1; position: relative;
    padding: 0 15px 50px 15px;
}
.spa-view {
    display: none; animation: fadeIn 0.3s ease forwards;
}
.spa-view.active {
    display: block;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Dashboard Elements */
.progress-section { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.progress-labels { display: flex; justify-content: space-between; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
.progress-bar-wrapper { width: 100%; height: 8px; background: rgba(255, 255, 255, 0.1); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue)); width: 0%; transition: width 0.3s ease; }

.card-now { text-align: center; padding: 40px 30px; margin-bottom: 20px; }
.card-workspace { text-align: center; padding: 50px 30px; margin-bottom: 20px; border-width: 2px;}
.workspace-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }

.timer-display { font-size: 4.5rem; font-weight: 300; font-variant-numeric: tabular-nums; letter-spacing: -2px; margin: 15px 0; }
.timer-massive { font-size: 6rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -3px; }

/* Badges */
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; flex-wrap: wrap; gap: 5px; }
.time-badge { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; background: rgba(255,255,255,0.08); padding: 4px 10px; border-radius: 6px; }
.badge { font-size: 0.75rem; text-transform: uppercase; font-weight: 800; letter-spacing: 1px; padding: 4px 8px; border-radius: 4px; border: 1px solid rgba(255,255,255,0.1); }
.badge-focus { background: rgba(235, 57, 89, 0.15); color: var(--accent-red); border-color: rgba(235, 57, 89, 0.3); }
.badge-workout { background: rgba(143, 252, 255, 0.15); color: var(--accent-cyan); border-color: rgba(143, 252, 255, 0.3); }
.badge-fixed { background: rgba(57, 90, 235, 0.15); color: var(--accent-blue); border-color: rgba(57, 90, 235, 0.3); }
.badge-check { background: rgba(57, 235, 89, 0.15); color: var(--accent-green); border-color: rgba(57, 235, 89, 0.3); }
.badge-buffer { background: rgba(235, 223, 57, 0.15); color: var(--accent-yellow); border-color: rgba(235, 223, 57, 0.3); }
.badge-routine { background: rgba(57, 235, 89, 0.15); color: var(--accent-green); border-color: rgba(57, 235, 89, 0.3); }
.badge-success { background: rgba(57, 235, 89, 0.15); color: var(--accent-green); border-color: rgba(57, 235, 89, 0.3); }

/* Buttons */
.task-controls { display: flex; justify-content: center; gap: 15px; margin-top: 20px; flex-wrap: wrap;}
.btn { font-family: 'Inter', sans-serif; font-weight: 600; font-size: 0.95rem; padding: 10px 20px; border-radius: 8px; cursor: pointer; transition: 0.2s; border: none; outline: none; }
.btn-primary { background: var(--text-primary); color: var(--bg-dark); }
.btn-primary:hover { background: var(--text-muted); }
.btn-outline { background: transparent; border: 1px solid var(--glass-border); color: var(--text-primary); }
.btn-outline:hover { background: rgba(255,255,255,0.1); }
.btn-danger { background: rgba(235, 57, 89, 0.15); color: var(--accent-red); border: 1px solid rgba(235, 57, 89, 0.3); }
.btn-danger:hover { background: rgba(235, 57, 89, 0.3); }
.btn-success { background: rgba(57, 235, 89, 0.15); color: var(--accent-green); border: 1px solid rgba(57, 235, 89, 0.3); }
.btn-success:hover { background: rgba(57, 235, 89, 0.3); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text-primary); }

/* Queue Lists */
.queue-list { display: flex; flex-direction: column; gap: 10px; }
.queue-item { display: grid; grid-template-columns: 80px 1fr auto; align-items: start; padding: 12px 16px; background: rgba(0,0,0,0.2); border-radius: 8px; border: 1px solid transparent; transition: all 0.3s ease; }
.queue-item.active { background: rgba(255,255,255,0.05); border-color: rgba(255, 255, 255, 0.2); }
.queue-item.past { opacity: 0.6; }
.queue-item.skipped { opacity: 0.4; border-color: var(--accent-red); }
.q-time { color: var(--text-muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; padding-top: 4px; }
.q-title { font-weight: 600; display: flex; flex-direction: column; gap: 5px; padding-top: 2px;}
.q-subtitle { font-size: 0.75rem; color: var(--text-muted); font-weight: 400; }
.q-badge { padding-top: 2px;}

/* Drag and Drop & Action Buttons */
.queue-item.draggable { cursor: grab; }
.queue-item.draggable:active { cursor: grabbing; }
.queue-item.dragging { opacity: 0.5; background: rgba(255,255,255,0.1); }
.queue-item.drag-over { border-top: 2px solid var(--accent-cyan); }
.q-actions { display: flex; gap: 5px; align-items: flex-start; justify-content: flex-end; }
.btn-icon { background: transparent; border: 1px solid var(--glass-border); color: var(--text-muted); cursor: pointer; padding: 4px 8px; border-radius: 4px; transition: 0.2s; font-size: 0.8rem; }
.btn-icon:hover { color: var(--text-primary); background: rgba(255,255,255,0.1); }
.btn-icon.danger:hover { color: var(--accent-red); background: rgba(235, 57, 89, 0.15); border-color: rgba(235, 57, 89, 0.3); }

/* Routine Subtasks styling */
.routine-sublist { display: flex; flex-direction: column; gap: 5px; margin-top: 5px; }
.subtask-item { display: flex; align-items: center; gap: 10px; font-size: 0.85rem; color: var(--text-muted); padding: 4px 8px; background: rgba(0,0,0,0.2); border-radius: 4px; cursor: pointer; transition: 0.2s;}
.subtask-item:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.subtask-item input[type="checkbox"] { accent-color: var(--accent-green); width: 16px; height: 16px; cursor: pointer;}
.subtask-item.checked { color: var(--accent-green); text-decoration: line-through; opacity: 0.8; }

.active-routine-list { display: flex; flex-direction: column; gap: 10px; text-align: left; max-width: 300px; margin: 0 auto 20px auto; background: rgba(0,0,0,0.2); padding: 15px; border-radius: 8px;}

/* Presets Grid */
.presets-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.preset-card { cursor: pointer; transition: transform 0.2s; display: flex; flex-direction: column; gap: 10px; }
.preset-card:hover { transform: translateY(-5px); border-color: rgba(255,255,255,0.2); }
.preset-card.active-preset { border-color: var(--accent-cyan); box-shadow: 0 0 20px rgba(143, 252, 255, 0.1); }

/* Inline Session */
.inline-session { margin-bottom: 20px; }

/* Forms & Modals */
.form-group { margin-bottom: 15px; display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 0.85rem; color: var(--text-muted); }
.form-group.row { flex-direction: row; align-items: flex-end; gap: 10px; }
.glass-input { background: rgba(0, 0, 0, 0.3); border: 1px solid var(--glass-border); color: var(--text-primary); padding: 10px 12px; border-radius: 6px; font-family: 'Inter', sans-serif; outline: none; }
.glass-input:focus { border-color: var(--accent-blue); }
select option { background: var(--bg-card); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.sub-panel { background: rgba(0,0,0,0.2); border-radius: 8px; padding: 15px; border: 1px solid var(--glass-border); margin-bottom: 15px; }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); backdrop-filter: blur(8px); display: flex; justify-content: center; align-items: center; z-index: 100; padding: 15px; }
.modal-content { width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; }
.hidden { display: none !important; }

/* Micro UI */
.pomodoro-circle {
    width: 250px; height: 250px; border-radius: 50%; border: 4px dashed rgba(235, 57, 89, 0.3);
    display: flex; justify-content: center; align-items: center; margin: 30px auto;
    animation: rotate 60s linear infinite;
}
.pomodoro-circle .timer-massive { animation: reverse-rotate 60s linear infinite; font-size: 4rem; }
@keyframes rotate { 100% { transform: rotate(360deg); } }
@keyframes reverse-rotate { 100% { transform: rotate(-360deg); } }


/* ======================== RESPONSIVE ======================== */

@media (max-width: 768px) {
    .top-nav {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px 16px;
        margin: 10px auto;
    }
    .top-nav > .brand,
    .top-nav > .clock-display {
        text-align: center;
    }
    .nav-links {
        justify-content: flex-start;
        gap: 3px;
    }
    .nav-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    .controls-right {
        justify-content: center;
    }
    .app-container { padding: 0 10px 40px 10px; }
    .glass-panel { padding: 16px; border-radius: 12px; }
    .card-now { padding: 25px 16px; }
    .card-workspace { padding: 30px 16px; }
    .title-primary { font-size: 1.6rem; }
    .title-massive { font-size: 2.2rem; letter-spacing: -1px; margin: 12px 0; }
    .timer-display { font-size: 3rem; }
    .timer-massive { font-size: 3.5rem; letter-spacing: -1px; }
    .queue-item { grid-template-columns: 60px 1fr auto; padding: 10px 12px; }
    .q-time { font-size: 0.8rem; }
    .q-title { font-size: 0.9rem; }
    .presets-grid { grid-template-columns: 1fr; gap: 15px; }
    .pomodoro-circle { width: 180px; height: 180px; }
    .pomodoro-circle .timer-massive { font-size: 2.5rem; }
}

@media (max-width: 480px) {
    .brand { font-size: 1.2rem; }
    .clock-display { font-size: 1rem; }
    .top-nav { margin: 5px auto; padding: 10px 12px; }
    .nav-btn { padding: 5px 8px; font-size: 0.72rem; }
    .glass-panel { padding: 12px; border-radius: 10px; }
    .card-now { padding: 18px 12px; }
    .title-primary { font-size: 1.3rem; }
    .title-massive { font-size: 1.8rem; }
    .timer-display { font-size: 2.4rem; }
    .timer-massive { font-size: 2.5rem; }
    .queue-item { grid-template-columns: 50px 1fr auto; padding: 8px 10px; font-size: 0.85rem; }
    .btn { font-size: 0.85rem; padding: 8px 14px; }
    .pomodoro-circle { width: 150px; height: 150px; margin: 15px auto; }
    .pomodoro-circle .timer-massive { font-size: 2rem; }
    .workspace-header { flex-direction: column; text-align: center; }
}
