/* ========================================
   ChronoX — Modern Glassmorphism Theme
   ======================================== */

:root {
    --bg-deep: #0a0e1a;
    --bg-surface: rgba(15, 19, 42, 0.85);
    --bg-card: rgba(20, 24, 51, 0.65);
    --bg-card-hover: rgba(30, 35, 72, 0.75);
    --bg-glass: rgba(255, 255, 255, 0.04);
    --bg-glass-strong: rgba(255, 255, 255, 0.08);

    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-medium: rgba(255, 255, 255, 0.1);
    --border-accent: rgba(139, 92, 246, 0.4);

    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent: #8b5cf6;
    --accent-dark: #6c3fb5;
    --accent-light: #a78bfa;
    --accent-glow: rgba(139, 92, 246, 0.3);

    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px var(--accent-glow);

    --blur: blur(20px);
    --blur-strong: blur(40px);

    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;

    --sidebar-width: 320px;
    --ring-circumference: 722.566;  /* 2 * PI * 115 */
}

/* ========================================
   Light Theme
   ======================================== */

[data-theme="light"] {
    --bg-deep: #f0f2f5;
    --bg-surface: rgba(255, 255, 255, 0.9);
    --bg-card: rgba(255, 255, 255, 0.7);
    --bg-card-hover: rgba(255, 255, 255, 0.85);
    --bg-glass: rgba(0, 0, 0, 0.03);
    --bg-glass-strong: rgba(0, 0, 0, 0.06);

    --border-subtle: rgba(0, 0, 0, 0.08);
    --border-medium: rgba(0, 0, 0, 0.12);
    --border-accent: rgba(139, 92, 246, 0.3);

    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --accent: #7c3aed;
    --accent-dark: #6d28d9;
    --accent-light: #8b5cf6;
    --accent-glow: rgba(124, 58, 237, 0.2);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 30px var(--accent-glow);
}

[data-theme="light"] body::before {
    background:
        radial-gradient(circle at 20% 50%, rgba(124, 58, 237, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.04) 0%, transparent 50%),
        radial-gradient(circle at 50% 80%, rgba(79, 70, 229, 0.03) 0%, transparent 50%);
}

[data-theme="light"] .countdown-digits {
    background: linear-gradient(135deg, var(--accent-dark), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: none;
}

[data-theme="light"] .ring-container.finished .countdown-digits {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    -webkit-background-clip: text;
    background-clip: text;
}

[data-theme="light"] .progress-ring {
    filter: drop-shadow(0 0 10px var(--accent-glow));
}

[data-theme="light"] .timer-card::before {
    background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.04), transparent);
}

[data-theme="light"] .logo {
    background: linear-gradient(135deg, var(--accent-dark), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="light"] .form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

[data-theme="light"] .modal-overlay {
    background: rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .timer-card:hover {
    box-shadow: var(--shadow-md), 0 0 20px rgba(139, 92, 246, 0.06);
}

[data-theme="light"] .timer-card.selected {
    box-shadow: var(--shadow-sm), 0 0 20px rgba(139, 92, 246, 0.1);
}

/* ========================================
   Reset & Base
   ======================================== */

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

/* hidden-attributt må vinne over display: flex/block i CSS */
[hidden] {
    display: none !important;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
}

/* Animated background */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(circle at 20% 50%, rgba(108, 63, 181, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 50% 80%, rgba(79, 70, 229, 0.05) 0%, transparent 50%);
    animation: bgShift 30s ease-in-out infinite alternate;
    z-index: 0;
    pointer-events: none;
}

@keyframes bgShift {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(-5%, -5%) rotate(3deg); }
}

/* ========================================
   App Layout
   ======================================== */

.app {
    display: flex;
    height: 100vh;
    position: relative;
    z-index: 1;
}

/* ========================================
   Sidebar
   ======================================== */

.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-surface);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 2;
}

.sidebar-header {
    padding: 16px 12px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

/* Save button */
.save-btn {
    padding: 6px 12px;
    background: var(--bg-glass-strong);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.save-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: var(--border-medium);
}

.save-btn.saved {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.3);
    color: var(--success);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Theme toggle */
.theme-toggle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border-subtle);
    background: var(--bg-glass);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: var(--bg-glass-strong);
    color: var(--text-primary);
    border-color: var(--border-medium);
}

/* Dark mode: show sun icon, hide moon */
.theme-icon-moon { display: none; }
.theme-icon-sun { display: block; }

/* Light mode: show moon icon, hide sun */
[data-theme="light"] .theme-icon-moon { display: block; }
[data-theme="light"] .theme-icon-sun { display: none; }

/* Profile button */
.profile-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px 4px 4px;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: 99px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.profile-btn:hover {
    background: var(--bg-glass-strong);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

.profile-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-dark), var(--accent));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
}

.profile-name {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Profile dropdown */
.profile-dropdown {
    position: absolute;
    top: 64px;
    right: 12px;
    background: var(--bg-surface);
    backdrop-filter: var(--blur-strong);
    -webkit-backdrop-filter: var(--blur-strong);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    min-width: 200px;
    box-shadow: var(--shadow-lg);
    z-index: 50;
    animation: menuEnter 0.15s ease;
    padding: 6px;
}

.profile-dropdown-list {
    max-height: 200px;
    overflow-y: auto;
}

.profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.profile-dropdown-item:hover {
    background: var(--bg-glass-strong);
    color: var(--text-primary);
}

.profile-dropdown-item.active {
    color: var(--accent-light);
    background: rgba(139, 92, 246, 0.1);
}

.profile-item-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    overflow: hidden;
    cursor: pointer;
}

.profile-item-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-dark), var(--accent));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    flex-shrink: 0;
}

.profile-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-delete-btn {
    opacity: 0;
    color: var(--text-muted);
    font-size: 1rem;
    transition: all var(--transition-fast);
    padding: 0 4px;
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.profile-dropdown-item:hover .profile-delete-btn {
    opacity: 1;
}

.profile-delete-btn:hover {
    color: var(--danger);
}

.profile-dropdown-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 4px 8px;
}

.profile-add {
    color: var(--accent-light);
}

.profile-add:hover {
    color: var(--accent-light);
    background: rgba(139, 92, 246, 0.1);
}

/* Small modal variant */
.modal-sm {
    max-width: 360px;
}

.logo {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--accent-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 0;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.logo-icon {
    font-size: 1.56rem;
    display: inline-block;
    transform: rotate(180deg);
    background: linear-gradient(135deg, var(--accent-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Search bar */
.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 16px 0;
    padding: 10px 14px;
    background: var(--surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast);
}

.search-bar:focus-within {
    border-color: var(--accent);
}

.search-icon {
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
}

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

/* Filter bar */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--bg-glass);
    border-bottom: 1px solid var(--border-subtle);
    animation: slideDown 0.2s ease;
}

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

.filter-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-tag {
    font-size: 0.75rem;
    padding: 2px 10px;
    border-radius: 99px;
    font-weight: 500;
}

.filter-clear {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.filter-clear:hover {
    color: var(--text-primary);
    background: var(--bg-glass-strong);
}

/* Timer list */
.timer-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.timer-list::-webkit-scrollbar {
    width: 6px;
}

.timer-list::-webkit-scrollbar-track {
    background: transparent;
}

.timer-list::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 3px;
}

.timer-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Empty state */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    flex: 1;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.4;
}

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

.empty-hint {
    font-size: 0.8rem !important;
    margin-top: 4px;
    opacity: 0.6;
}

/* Timer Card */
.timer-card {
    background: var(--bg-card);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    user-select: none;
    flex-shrink: 0;
}

.timer-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.timer-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-accent);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm), 0 0 20px rgba(139, 92, 246, 0.08);
}

.timer-card:hover::before {
    opacity: 1;
}

.timer-card.selected {
    border-color: var(--accent);
    box-shadow: var(--shadow-sm), 0 0 20px rgba(139, 92, 246, 0.15);
}

.timer-card.selected::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(to bottom, var(--accent), var(--accent-dark));
    border-radius: 0 2px 2px 0;
}

.timer-card.finished {
    opacity: 1;
}

.timer-card.finished .card-status {
    color: var(--success);
    font-weight: 600;
}

.timer-card.dragging {
    opacity: 0.5;
    transform: scale(0.98);
}

.timer-card.drop-target {
    border-color: var(--accent-light);
    border-style: dashed;
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.card-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 8px;
}

.card-class-tag {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 99px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.card-class-tag:hover {
    filter: brightness(1.2);
    transform: scale(1.05);
}

.card-status {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 4px;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.running {
    background: var(--accent);
    box-shadow: 0 0 6px var(--accent-glow);
    animation: pulse 2s ease-in-out infinite;
}

.status-dot.paused {
    background: var(--warning);
}

.status-dot.finished {
    background: var(--success);
}

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

/* Card progress bar */
.card-progress {
    width: 100%;
    height: 3px;
    background: var(--bg-glass);
    border-radius: 2px;
    margin-top: 12px;
    overflow: hidden;
}

.card-progress-bar {
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(to right, var(--accent-dark), var(--accent));
    transition: width 0.2s linear;
    position: relative;
}

.card-progress-bar::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 20px;
    height: 100%;
    background: linear-gradient(to right, transparent, var(--accent-light));
    opacity: 0.6;
}

/* Done button on card */
.card-done-btn {
    display: block;
    margin-top: 8px;
    width: 100%;
    padding: 4px;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: var(--radius-sm);
    color: #22c55e;
    font-size: 0.65rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.card-done-btn:hover {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.5);
    color: #16a34a;
}

/* Add button */
.add-btn {
    margin: 12px;
    padding: 14px;
    background: linear-gradient(135deg, var(--accent-dark), var(--accent));
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.add-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s ease;
}

.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.add-btn:hover::before {
    left: 100%;
}

.add-btn:active {
    transform: translateY(0);
}

.add-icon {
    font-size: 1.2rem;
    font-weight: 300;
}

/* ========================================
   Main Content
   ======================================== */

.main-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    position: relative;
}

.main-top-bar {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1;
}

.how-to-btn {
    padding: 6px 14px;
    background: var(--bg-glass-strong);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.how-to-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* Placeholder */
.main-placeholder {
    text-align: center;
    color: var(--text-muted);
    animation: fadeIn 0.5s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-height: 100%;
    overflow-y: auto;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.placeholder-icon {
    font-size: 4rem;
    opacity: 0.2;
    margin-bottom: 16px;
}

.main-placeholder h2 {
    font-size: 1.3rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.main-placeholder p {
    font-size: 0.9rem;
}

/* Guide */
.guide {
    margin-top: 40px;
    text-align: left;
    max-width: 420px;
    width: 100%;
}

.guide-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-subtle);
}

.guide-section {
    margin-bottom: 18px;
}

.guide-section h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.guide-section ul {
    list-style: none;
    padding: 0;
}

.guide-section li {
    font-size: 0.82rem;
    color: var(--text-muted);
    padding: 4px 0;
    padding-left: 14px;
    position: relative;
}

.guide-section li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent);
    transform: translateY(-50%);
}

.guide-section li strong {
    color: var(--text-secondary);
}

/* Display */
.main-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    animation: fadeIn 0.4s ease;
    width: 100%;
    max-width: 500px;
}

.display-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}

.display-meta {
    flex: 1;
}

.display-name {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.display-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.4;
}

.display-class-tag {
    font-size: 0.75rem;
    padding: 3px 12px;
    border-radius: 99px;
    font-weight: 500;
    display: inline-block;
}

.display-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.action-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: var(--bg-glass);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.action-btn:hover {
    background: var(--bg-glass-strong);
    color: var(--text-primary);
    border-color: var(--border-medium);
}

.delete-btn:hover {
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.1);
}

/* ========================================
   Circular Progress Ring
   ======================================== */

.ring-container {
    position: relative;
    width: 260px;
    height: 260px;
}

.progress-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    filter: drop-shadow(0 0 15px var(--accent-glow));
}

.ring-bg {
    fill: none;
    stroke: var(--bg-glass-strong);
    stroke-width: 6;
}

.ring-progress {
    fill: none;
    stroke: url(#ringGradient);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: var(--ring-circumference);
    stroke-dashoffset: var(--ring-circumference);
    transition: stroke-dashoffset 0.2s linear;
}

.ring-inner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.countdown-digits {
    font-size: 2.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(135deg, #fff, var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    filter: drop-shadow(0 0 20px var(--accent-glow));
}

.countdown-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 4px;
}

/* Finished state */
.ring-container.finished .ring-progress {
    stroke: url(#ringGradient);
    animation: ringPulse 2s ease-in-out infinite;
}

.ring-container.finished .countdown-digits {
    background: linear-gradient(135deg, var(--success), #4ade80);
    -webkit-background-clip: text;
    background-clip: text;
}

@keyframes ringPulse {
    0%, 100% { opacity: 1; filter: drop-shadow(0 0 15px var(--accent-glow)); }
    50% { opacity: 0.6; filter: drop-shadow(0 0 25px var(--accent-glow)); }
}

/* ========================================
   Controls
   ======================================== */

.controls {
    display: flex;
    gap: 12px;
}

.ctrl-btn {
    padding: 12px 28px;
    border-radius: var(--radius-md);
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.ctrl-pause {
    background: var(--bg-glass-strong);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border-medium);
    color: var(--text-primary);
}

.ctrl-pause:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--border-accent);
}

.ctrl-resume {
    background: linear-gradient(135deg, var(--accent-dark), var(--accent));
    color: white;
}

.ctrl-resume:hover {
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.ctrl-restart {
    background: var(--bg-glass-strong);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border-medium);
    color: var(--text-primary);
}

.ctrl-restart:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--border-accent);
}

.ctrl-done {
    background: linear-gradient(135deg, #059669, #10b981);
    color: #fff;
    border: none;
}

.ctrl-done:hover {
    background: linear-gradient(135deg, #047857, #059669);
}

/* ========================================
   Modal
   ======================================== */

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

.modal {
    background: var(--bg-surface);
    backdrop-filter: var(--blur-strong);
    -webkit-backdrop-filter: var(--blur-strong);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 440px;
    box-shadow: var(--shadow-lg), 0 0 60px rgba(139, 92, 246, 0.1);
    animation: modalEnter 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 0;
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

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

.modal-body {
    padding: 20px 24px 24px;
}

/* Form */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.optional {
    color: var(--text-muted);
    font-weight: 400;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    transition: all var(--transition-fast);
    outline: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group input.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

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

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.timer-mode-selector {
    display: flex;
    gap: 0;
    background: var(--bg-glass);
    border-radius: 8px;
    padding: 3px;
    margin-bottom: 16px;
}

.mode-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-btn.active {
    background: var(--accent);
    color: #fff;
}

.mode-btn:not(.active):hover {
    color: var(--text-primary);
    background: var(--bg-glass-strong);
}

.reset-time-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.reset-time-wrapper input[type="time"] {
    flex: 0 0 auto;
}

.reset-time-local {
    font-size: 0.82rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Buttons */
.btn {
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.btn-secondary {
    background: var(--bg-glass-strong);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-dark), var(--accent));
    color: white;
}

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

.btn-primary:active {
    transform: translateY(0);
}

/* ========================================
   Context Menu
   ======================================== */

.context-menu {
    position: fixed;
    background: var(--bg-surface);
    backdrop-filter: var(--blur-strong);
    -webkit-backdrop-filter: var(--blur-strong);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: 6px;
    min-width: 160px;
    box-shadow: var(--shadow-lg);
    z-index: 200;
    animation: menuEnter 0.15s ease;
}

@keyframes menuEnter {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.context-menu-item:hover {
    background: var(--bg-glass-strong);
    color: var(--text-primary);
}

.context-menu-item.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.context-menu-separator {
    height: 1px;
    background: var(--border-subtle);
    margin: 4px 8px;
}

/* ========================================
   Notifications / Toast
   ======================================== */

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-surface);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    color: var(--text-primary);
    font-size: 0.85rem;
    box-shadow: var(--shadow-lg);
    z-index: 300;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
}

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

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

.toast-icon {
    font-size: 1.1rem;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 768px) {
    .app {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        min-width: 100%;
        height: 50vh;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
    }

    .main-content {
        padding: 24px;
        height: 50vh;
    }

    .ring-container {
        width: 200px;
        height: 200px;
    }

    .countdown-digits {
        font-size: 2rem;
    }

    .display-name {
        font-size: 1.2rem;
    }

    .controls {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .sidebar-header {
        padding: 16px;
    }

    .timer-list {
        padding: 8px;
    }

    .add-btn {
        margin: 8px;
    }

    .main-content {
        padding: 16px;
    }

    .main-display {
        gap: 20px;
    }
}
