/* ============================================
   FocusFlow — Design System & Styles
   Warm Orange Theme | Dark/Light Mode
   ============================================ */

/* --- CSS Custom Properties (Dark Theme — Default) --- */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.06);
    --bg-elevated: rgba(255, 255, 255, 0.05);

    --accent: #ff6b35;
    --accent-hover: #ff8c5a;
    --accent-glow: rgba(255, 107, 53, 0.3);
    --accent-muted: rgba(255, 107, 53, 0.12);

    --text-primary: #f5f5f7;
    --text-secondary: rgba(245, 245, 247, 0.55);
    --text-muted: rgba(245, 245, 247, 0.3);

    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --border-accent: rgba(255, 107, 53, 0.3);

    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.1);

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

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.35);

    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

    --header-height: 64px;
    --drawer-width: 340px;
}

/* --- Light Theme --- */
[data-theme="light"] {
    --bg-primary: #f5f5f7;
    --bg-secondary: #ffffff;
    --bg-card: rgba(0, 0, 0, 0.02);
    --bg-card-hover: rgba(0, 0, 0, 0.04);
    --bg-elevated: #ffffff;

    --accent: #e85d2a;
    --accent-hover: #d44d1a;
    --accent-glow: rgba(232, 93, 42, 0.18);
    --accent-muted: rgba(232, 93, 42, 0.08);

    --text-primary: #1a1a2e;
    --text-secondary: rgba(26, 26, 46, 0.55);
    --text-muted: rgba(26, 26, 46, 0.3);

    --border: rgba(0, 0, 0, 0.06);
    --border-hover: rgba(0, 0, 0, 0.12);
    --border-accent: rgba(232, 93, 42, 0.25);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.3s var(--ease-out), color 0.3s var(--ease-out);
}

::selection {
    background: var(--accent);
    color: #fff;
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 2px; }

/* --- App Container --- */
.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Header --- */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    height: var(--header-height);
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-shrink: 0;
    transition: background 0.3s var(--ease-out), border-color 0.3s var(--ease-out), transform 0.4s var(--ease-out), opacity 0.4s var(--ease-out);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text-primary);
}

.logo-icon {
    width: 24px;
    height: 24px;
    color: var(--accent);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--ease-out);
    position: relative;
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

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

.btn-icon .badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--accent);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 600;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    display: none;
}

.btn-icon .badge.visible {
    display: flex;
}

/* --- Main Layout --- */
.main {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

/* --- Timer Section (Center) --- */
.timer-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    gap: 1.5rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Active Task Display */
.active-task {
    text-align: center;
    margin-bottom: 0.5rem;
}

.active-task .label {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    display: block;
    margin-bottom: 0.35rem;
}

.active-task .task-name {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.4rem 1rem;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: inline-block;
    transition: all 0.2s var(--ease-out);
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.active-task .task-name:hover {
    border-color: var(--accent);
    background: var(--accent-muted);
    color: var(--accent);
}

.active-task .task-name.empty {
    color: var(--text-muted);
    font-style: italic;
    font-weight: 400;
}

/* Mode Tabs */
.mode-tabs {
    display: flex;
    gap: 0.3rem;
    background: var(--bg-card);
    padding: 3px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
}

.mode-tab {
    padding: 0.45rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 500;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.3s var(--ease-out);
    white-space: nowrap;
}

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

.mode-tab.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 12px var(--accent-glow);
}

/* Timer Ring */
.timer-ring-container {
    position: relative;
    width: 260px;
    height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timer-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ring-bg {
    fill: none;
    stroke: var(--border);
    stroke-width: 8;
}

.ring-progress {
    fill: none;
    stroke: var(--accent);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 753.98;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.5s var(--ease-out), stroke 0.3s var(--ease-out);
    filter: drop-shadow(0 0 6px var(--accent-glow));
}

.timer-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    z-index: 1;
}

.timer-time {
    font-size: 4.2rem;
    font-weight: 700;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: -3px;
    line-height: 1;
    color: var(--text-primary);
    transition: color 0.3s var(--ease-out);
}

.timer-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 2.5px;
    color: var(--accent);
    text-transform: uppercase;
    transition: color 0.3s var(--ease-out);
}

/* Timer Controls */
.timer-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn {
    border: none;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s var(--ease-out);
    flex-shrink: 0;
}

.btn-primary {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 24px var(--accent-glow);
}

.btn-primary svg {
    width: 28px;
    height: 28px;
}

.btn-primary:hover {
    transform: scale(1.06);
    box-shadow: 0 6px 32px var(--accent-glow);
}

.btn-primary:active {
    transform: scale(0.95);
}

.btn-secondary {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary svg {
    width: 18px;
    height: 18px;
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-hover);
    transform: scale(1.05);
}

.btn-secondary:active {
    transform: scale(0.93);
}

/* Session Dots */
.session-dots {
    display: flex;
    gap: 0.45rem;
    align-items: center;
}

.session-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    border: 1.5px solid transparent;
    transition: all 0.4s var(--ease-spring);
}

.session-dot.completed {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

.session-dot.active {
    border-color: var(--accent);
    animation: dotPulse 1.5s ease-in-out infinite;
}

/* Pulse animation for running timer */
.timer-section.running .timer-time {
    animation: timerPulse 2s ease-in-out infinite;
}

@keyframes timerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes dotPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.4); }
}

/* Celebration animation */
@keyframes celebrate {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.timer-ring-container.celebrate {
    animation: celebrate 0.6s var(--ease-spring);
}

.timer-ring-container.celebrate .ring-progress {
    filter: drop-shadow(0 0 20px var(--accent-glow));
}

/* --- Stats Bar --- */
.stats-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    padding: 0.85rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-shrink: 0;
    transition: background 0.3s var(--ease-out), border-color 0.3s var(--ease-out), transform 0.4s var(--ease-out), opacity 0.4s var(--ease-out);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
}

.stat-item svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.stat-item .stat-value {
    color: var(--text-primary);
    font-weight: 600;
}

/* --- Task Drawer --- */
.task-drawer {
    width: var(--drawer-width);
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.3s var(--ease-out), background 0.3s var(--ease-out), border-color 0.3s var(--ease-out);
}

.task-drawer.collapsed {
    transform: translateX(100%);
    width: 0;
    border-left: none;
    overflow: hidden;
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.drawer-header h2 {
    font-size: 0.9rem;
    font-weight: 600;
}

.drawer-header h2 span {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.8rem;
}

.btn-close {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--ease-out);
}

.btn-close svg {
    width: 16px;
    height: 16px;
}

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

/* Task Input */
.task-input-wrapper {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.task-input {
    flex: 1;
    padding: 0.65rem 0.9rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    transition: all 0.2s var(--ease-out);
}

.task-input::placeholder {
    color: var(--text-muted);
}

.task-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn-add {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: none;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s var(--ease-out);
}

.btn-add svg {
    width: 20px;
    height: 20px;
}

.btn-add:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.btn-add:active {
    transform: scale(0.93);
}

/* Task Filter */
.task-filter {
    display: flex;
    gap: 0.25rem;
    padding: 0.6rem 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.filter-btn {
    padding: 0.3rem 0.75rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 500;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
}

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

.filter-btn.active {
    background: var(--accent-muted);
    color: var(--accent);
}

/* Task List */
.task-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-md);
    transition: all 0.25s var(--ease-out);
    animation: taskIn 0.3s var(--ease-spring);
    cursor: default;
}

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

.task-item.completed .task-text {
    text-decoration: line-through;
    color: var(--text-muted);
}

.task-item.removing {
    animation: taskOut 0.25s var(--ease-out) forwards;
}

@keyframes taskIn {
    from { opacity: 0; transform: translateY(-6px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes taskOut {
    to { opacity: 0; transform: translateX(20px) scale(0.95); }
}

/* Custom Checkbox */
.task-checkbox {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 2px solid var(--border-hover);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.25s var(--ease-spring);
    color: transparent;
}

.task-checkbox svg {
    width: 12px;
    height: 12px;
    stroke-width: 3;
}

.task-checkbox:hover {
    border-color: var(--accent);
}

.task-item.completed .task-checkbox {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.task-text {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-primary);
    transition: color 0.2s var(--ease-out);
    line-height: 1.4;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-pomodoros {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 600;
    flex-shrink: 0;
    background: var(--accent-muted);
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-full);
}

.task-delete {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0;
    transition: all 0.2s var(--ease-out);
}

.task-delete svg {
    width: 14px;
    height: 14px;
}

.task-item:hover .task-delete {
    opacity: 1;
}

.task-delete:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

/* Active task indicator */
.task-item.active-task {
    background: var(--accent-muted);
    border-left: 3px solid var(--accent);
}

.task-item.active-task .task-text {
    font-weight: 500;
}

/* Empty State */
.empty-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
    text-align: center;
    flex: 1;
}

.empty-state.visible {
    display: flex;
}

.empty-state svg {
    width: 40px;
    height: 40px;
    opacity: 0.25;
}

.empty-state p {
    font-size: 0.82rem;
}

/* Tasks Footer */
.tasks-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.tasks-footer span {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.btn-clear {
    border: none;
    background: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.72rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s var(--ease-out);
}

.btn-clear:hover {
    color: var(--danger);
    background: var(--danger-bg);
}

/* Keyboard shortcuts hint */
.shortcuts-hint {
    padding: 0.5rem 1.25rem;
    text-align: center;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.shortcuts-hint kbd {
    display: inline-block;
    padding: 0.1rem 0.35rem;
    font-size: 0.65rem;
    font-family: var(--font-mono);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    margin: 0 0.1rem;
    color: var(--text-muted);
}

.shortcuts-hint span {
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* --- Settings Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s var(--ease-out);
    backdrop-filter: blur(4px);
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.75rem;
    width: 90%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95) translateY(8px);
    transition: transform 0.25s var(--ease-out), background 0.3s var(--ease-out);
}

.modal-overlay.open .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--ease-out);
}

.modal-close svg {
    width: 18px;
    height: 18px;
}

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

/* Settings Form */
.settings-group {
    margin-bottom: 1.25rem;
}

.settings-group-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.75rem;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0;
}

.settings-row + .settings-row {
    border-top: 1px solid var(--border);
}

.settings-label {
    font-size: 0.85rem;
    color: var(--text-primary);
}

.settings-label small {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.settings-input {
    width: 64px;
    padding: 0.4rem 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    text-align: center;
    outline: none;
    transition: all 0.2s var(--ease-out);
}

.settings-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

/* Toggle Switch */
.toggle {
    position: relative;
    width: 40px;
    height: 22px;
    cursor: pointer;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border-hover);
    border-radius: var(--radius-full);
    transition: all 0.3s var(--ease-out);
}

.toggle-slider::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    top: 2px;
    left: 2px;
    transition: transform 0.3s var(--ease-out);
}

.toggle input:checked + .toggle-slider {
    background: var(--accent);
}

.toggle input:checked + .toggle-slider::after {
    transform: translateX(18px);
}

/* Save Button */
.btn-save {
    width: 100%;
    padding: 0.75rem;
    margin-top: 0.5rem;
    border: none;
    border-radius: var(--radius-md);
    background: var(--accent);
    color: #fff;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
}

.btn-save:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-save:active {
    transform: scale(0.98);
}

/* --- Shortcuts Modal --- */
.shortcuts-grid {
    display: grid;
    gap: 0.5rem;
}

.shortcut-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0;
}

.shortcut-row kbd {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
}

.shortcut-row span {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

/* --- Utility --- */
.hidden {
    display: none !important;
}

/* --- Animations --- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* --- Responsive --- */
@media (max-width: 1024px) {
    .task-drawer {
        position: fixed;
        top: var(--header-height);
        right: 0;
        bottom: 0;
        z-index: 50;
        box-shadow: var(--shadow-lg);
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 56px;
    }

    .header {
        padding: 0 1rem;
    }

    .timer-section {
        padding: 1.5rem 1rem;
    }

    .timer-ring-container {
        width: 220px;
        height: 220px;
    }

    .timer-time {
        font-size: 3.4rem;
        letter-spacing: -2px;
    }

    .btn-primary {
        width: 60px;
        height: 60px;
    }

    .btn-primary svg {
        width: 24px;
        height: 24px;
    }

    .stats-bar {
        gap: 1rem;
        padding: 0.7rem 1rem;
    }

    .stat-item {
        font-size: 0.72rem;
    }

    .task-drawer {
        width: 100%;
    }

    .mode-tab {
        font-size: 0.72rem;
        padding: 0.4rem 0.75rem;
    }
}

@media (max-width: 480px) {
    .timer-ring-container {
        width: 190px;
        height: 190px;
    }

    .timer-time {
        font-size: 2.8rem;
    }

    .stats-bar {
        flex-direction: column;
        gap: 0.3rem;
        padding: 0.6rem;
    }
}

/* --- Backup buttons in settings --- */
.btn-backup {
    padding: 0.45rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 550;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
}

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

.btn-backup:active {
    transform: scale(0.97);
}

/* --- Toast Container & Toast styles --- */
.toast-container {
    position: fixed;
    bottom: 24px;
    left: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.65rem 1rem;
    color: var(--text-primary);
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.35s var(--ease-spring);
    transition: all 0.25s var(--ease-out);
}

.toast.fade-out {
    opacity: 0;
    transform: translateY(8px) scale(0.95);
}

.toast-action {
    background: none;
    border: none;
    color: var(--accent);
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.82rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: background 0.2s, color 0.2s;
}

.toast-action:hover {
    background: var(--accent-muted);
    color: var(--accent-hover);
}

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

@media (max-width: 480px) {
    .toast-container {
        left: 12px;
        right: 12px;
        bottom: 12px;
    }
    .toast {
        justify-content: space-between;
    }
}

/* --- Document Picture-in-Picture window style --- */
body.pip-body {
    background: #0a0a0f !important;
    color: #f5f5f7;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    overflow: hidden;
}

body.pip-body[data-theme="light"] {
    background: #ffffff !important;
    color: #1a1a2e;
}

.pip-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0.5rem;
    box-sizing: border-box;
}

.pip-header {
    margin-bottom: 0.2rem;
}

.pip-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: #ff6b35;
    text-transform: uppercase;
}

.pip-time {
    font-size: 2.8rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    font-variant-numeric: tabular-nums;
    letter-spacing: -1.5px;
    line-height: 1.1;
    color: inherit;
    margin-bottom: 0.4rem;
}

.pip-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.pip-btn {
    border: none;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(245, 245, 247, 0.6);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

body[data-theme="light"] .pip-btn {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: rgba(26, 26, 46, 0.6);
}

.pip-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f5f5f7;
    border-color: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

body[data-theme="light"] .pip-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #1a1a2e;
    border-color: rgba(0, 0, 0, 0.15);
}

.pip-btn:active {
    transform: scale(0.95);
}

.pip-btn svg {
    width: 14px;
    height: 14px;
}

/* --- Focus Mode Styles --- */
body.focus-mode-active .header {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

body.focus-mode-active .stats-bar {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

body.focus-mode-active .task-drawer {
    display: none !important;
}

body.focus-mode-active .timer-section {
    max-width: 100%;
    height: 100vh;
    justify-content: center;
    padding: 0;
}

/* Exit button */
.btn-exit-focus {
    position: fixed;
    top: 24px;
    right: 24px;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.15;
    z-index: 1000;
    transition: all 0.3s var(--ease-out);
}

.btn-exit-focus:hover {
    opacity: 1;
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-hover);
    transform: scale(1.05);
}

.btn-exit-focus:active {
    transform: scale(0.95);
}

.btn-exit-focus svg {
    width: 20px;
    height: 20px;
}
