/* Base Styles */
:root {
    --primary-color: #6200ee;
    --primary-light: #bb86fc;
    --primary-dark: #3700b3;
    --secondary-color: #03dac6;
    --secondary-dark: #018786;
    --background: #f5f5f5;
    --surface: #ffffff;
    --error: #b00020;
    --on-primary: #ffffff;
    --on-secondary: #000000;
    --on-background: #000000;
    --on-surface: #000000;
    --on-error: #ffffff;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--on-background);
    background-color: var(--background);
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.hidden {
    display: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin-bottom: 1rem;
    line-height: 1.2;
}

p {
    margin-bottom: 1rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

ul {
    list-style: none;
}

button,
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: var(--primary-color);
    color: var(--on-primary);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
}

button:hover,
.btn:hover {
    background-color: var(--primary-dark);
}

button:disabled,
.btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

button:focus,
.btn:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--on-primary);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--on-secondary);
}

.btn-secondary:hover {
    background-color: var(--secondary-dark);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: var(--on-primary);
}

input,
select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
}

/* Header & Nav */
header {
    background-color: var(--primary-color);
    color: var(--on-primary);
    padding: 2rem 0;
    text-align: center;
    position: relative;
}

header .container {
    position: relative;
}

.current-time {
    display: block;
    font-size: 0.9rem;
    color: var(--on-primary);
    opacity: 0.8;
    margin-top: 0.5rem;
}


/* Main content */
main {
    padding: 2rem 0;
}

footer {
    background-color: var(--primary-dark);
    color: var(--on-primary);
    padding: 1rem 0;
    text-align: center;
    margin-top: 2rem;
}

/* Tool Sections */
.tool-section {
    display: none;
    background-color: var(--surface);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--box-shadow);
}

.tool-section.active {
    display: block;
}

/* Home Page Grid */


/* Pomodoro Timer */
.pomodoro-container {
    max-width: 600px;
    margin: 0 auto;
}

.timer-display {
    text-align: center;
    margin: 2rem 0;
}

.timer-circle {
    width: 250px;
    height: 250px;
    border-radius: 50%;
    background-color: var(--primary-light);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    box-shadow: var(--box-shadow);
}

.time {
    font-size: 3rem;
    font-weight: bold;
    color: var(--on-primary);
}

.timer-label {
    font-size: 1.2rem;
    color: var(--on-primary);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.timer-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.session-counter {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.2rem;
}

.mode-change-message {
    text-align: center;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

/* Collapsible Pomodoro Settings */
.pomodoro-settings-collapsible {
    margin-top: 2rem;
    background-color: var(--surface);
    border-radius: var(--border-radius);
    border: 1px solid #eee;
    box-shadow: var(--box-shadow);
}

.pomodoro-settings-collapsible summary {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    font-weight: bold;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--primary-dark);
}

.pomodoro-settings-collapsible summary::-webkit-details-marker {
    display: none;
}

.pomodoro-settings-collapsible summary:hover {
    background-color: #f0f0f0;
}

.pomodoro-settings-collapsible summary i {
    margin-left: 0.5rem;
    transition: transform 0.2s ease-in-out;
}

.pomodoro-settings-collapsible[open] summary {
    border-bottom: 1px solid #ddd;
}

.pomodoro-settings-collapsible[open] summary i {
    transform: rotate(90deg);
}

.pomodoro-settings-collapsible .timer-settings {
    border-top: none;
}

/* Pomodoro Sticky Progress Bar */
.sticky-progress-container {
    position: sticky;
    top: 56px;
    z-index: 50;
    width: 100%;
    height: 8px;
    background-color: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background-color: var(--primary-color);
    border-radius: 4px;
    transition: width 0.2s ease-out;
}

/* Task Manager Collapsible Filters */
.task-filters-collapsible {
    margin: 1.5rem 0;
    background-color: #f9f9f9;
    border-radius: var(--border-radius);
    border: 1px solid #eee;
    box-shadow: var(--box-shadow);
}

.task-filters-collapsible summary {
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-weight: bold;
    list-style: none;
    display: flex;
    align-items: center;
    color: var(--primary-dark);
}

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

.task-filters-collapsible summary:hover {
    background-color: #f0f0f0;
}

.task-filters-collapsible summary i {
    margin-right: 0.5rem;
}

.task-filters-collapsible[open] summary {
    border-bottom: 1px solid #eee;
}

.task-filters-collapsible .task-filters {
    padding: 1rem;
    margin-bottom: 0;
}

/* Focus Mode Advanced Settings */
.focus-advanced-settings {
    margin-top: 1.5rem;
    background-color: #f9f9f9;
    border-radius: var(--border-radius);
    border: 1px solid #eee;
    box-shadow: var(--box-shadow);
}

.focus-advanced-settings summary {
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-weight: bold;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--primary-dark);
}

.focus-advanced-settings summary::-webkit-details-marker {
    display: none;
}

.focus-advanced-settings summary:hover {
    background-color: #f0f0f0;
}

.focus-advanced-settings summary i {
    margin-left: 0.5rem;
    transition: transform 0.2s ease-in-out;
}

.focus-advanced-settings[open] summary {
    border-bottom: 1px solid #ddd;
}

.focus-advanced-settings[open] summary i {
    transform: rotate(90deg);
}

.focus-advanced-settings .advanced-options-content {
    padding: 1rem;
}

/* Evening Review / Past Tasks */
.rewards-past-tasks {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.past-tasks-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.past-task-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--surface);
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
}

.past-task-info {
    flex: 1;
}

.past-task-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.past-task-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.past-task-actions {
    display: flex;
    gap: 0.5rem;
}

.past-task-actions .btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

/* Rewards Tool Toggle */
#toggle-rewards-setup-btn {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
}

#toggle-rewards-setup-btn i {
    margin-right: 0.5rem;
}

.rewards-setup {
    padding: 1.5rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    background-color: var(--surface);
    margin-top: 1rem;
}

/* Habit Tracker Collapsible Stats */
.habit-stats-collapsible {
    margin-top: 1.5rem;
    background-color: #f9f9f9;
    border-radius: var(--border-radius);
    border: 1px solid #eee;
    box-shadow: var(--box-shadow);
}

.habit-stats-collapsible summary {
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-weight: bold;
    list-style: none;
    display: flex;
    align-items: center;
    color: var(--primary-dark);
}

.habit-stats-collapsible summary::-webkit-details-marker {
    display: none;
}

.habit-stats-collapsible summary:hover {
    background-color: #f0f0f0;
}

.habit-stats-collapsible summary i {
    margin-right: 0.5rem;
    transition: transform 0.2s ease-in-out;
}

.habit-stats-collapsible[open] summary {
    border-bottom: 1px solid #eee;
}

.habit-stats-collapsible[open] summary i {
    transform: rotate(90deg);
}

.habit-stats-collapsible .habit-stats {
    padding: 1rem;
}

/* Habit Tracker - Modern, User-Friendly Design */
.habit-tracker-container.new-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 2rem;
    align-items: flex-start;
}

.habit-list-panel,
.habit-calendar-panel {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07), 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.3s ease;
}

.habit-list-panel:hover,
.habit-calendar-panel:hover {
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
}

.habit-list-panel h3 {
    margin-bottom: 1rem;
    font-size: 1.3rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.habit-input {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.habit-input input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.habit-input input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(187, 134, 252, 0.1);
    outline: none;
}

.habit-input button {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: pointer;
}

.habit-input button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(187, 134, 252, 0.3);
}

.habit-actions {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: flex-end;
}

.habit-actions button {
    padding: 0.5rem 1rem;
    background-color: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    color: #666;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.habit-actions button:hover {
    background-color: white;
    border-color: var(--primary-light);
    color: var(--primary-color);
    transform: translateY(-1px);
}

.habit-list .habit-item {
    margin-bottom: 1rem;
    border: 2px solid #f0f0f0;
    padding: 1rem;
    border-radius: 10px;
    background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.habit-list .habit-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--habit-color, linear-gradient(180deg, var(--primary-color) 0%, var(--secondary-color) 100%));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.habit-list .habit-item:hover {
    border-color: var(--primary-light);
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.habit-list .habit-item:hover::before {
    opacity: 1;
}

.habit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    gap: 0.75rem;
}

/* Color indicator for each habit */
.habit-color-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 2px solid white;
}

.habit-name {
    font-weight: 600;
    font-size: 1.05rem;
    color: #2c3e50;
    flex: 1;
}

.streak-counter {
    margin-right: 0.5rem;
    color: var(--secondary-dark);
    font-size: 0.85rem;
    background-color: #fff3cd;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 500;
    white-space: nowrap;
}

.delete-btn,
.edit-btn {
    background: none;
    border: none;
    color: #999;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.delete-btn:hover {
    background-color: #ffebee;
    color: var(--error);
    transform: scale(1.1);
}

.edit-btn {
    margin-right: 0.25rem;
}

.edit-btn:hover {
    background-color: #e3f2fd;
    color: var(--primary-color);
    transform: scale(1.1);
}

.habit-progress .progress-bar {
    width: 100%;
    height: 10px;
    background: #e8e8e8;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.habit-progress .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-light) 0%, var(--primary-color) 100%);
    width: 0%;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(187, 134, 252, 0.5);
}

.habit-progress .progress-text {
    text-align: right;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    color: #666;
    font-weight: 500;
}

.month-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--secondary-color) 100%);
    border-radius: 10px;
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
}

.day-header {
    text-align: center;
    font-weight: 700;
    color: var(--primary-dark);
    padding: 0.5rem;
    font-size: 0.85rem;
}

.calendar-day {
    min-height: 70px;
    border: 2px solid #e8e8e8;
    padding: 4px;
    position: relative;
    border-radius: 8px;
    background: white;
    transition: all 0.2s ease;
    cursor: pointer;
}

.calendar-day:hover {
    border-color: var(--primary-light);
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.calendar-day.empty {
    border-color: transparent;
    background: transparent;
    cursor: default;
}

.calendar-day.empty:hover {
    transform: none;
    box-shadow: none;
}

.calendar-day.today {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-color: var(--primary-color);
    border-width: 3px;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.2);
}

.habit-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 6px;
}

.habit-check {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 2px solid var(--habit-color, var(--primary-light));
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    position: relative;
}

.habit-check:hover {
    transform: scale(1.2);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    z-index: 10;
}

.habit-check.completed {
    background: var(--habit-color, var(--primary-color));
    border-color: var(--habit-color, var(--primary-color));
    box-shadow: 0 0 8px var(--habit-color, rgba(187, 134, 252, 0.5));
}

.habit-check.completed::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 10px;
    font-weight: bold;
}

.month-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 1.5rem;
    gap: 1rem;
}

.month-nav button {
    flex: 1;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    color: #666;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.month-nav button:hover {
    background: linear-gradient(135deg, white 0%, #f5f5f5 100%);
    border-color: var(--primary-light);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}


/* Routine Tool Enhancements */
#current-task-display {
    position: sticky;
    top: 0;
    background-color: var(--surface);
    z-index: 10;
    padding-top: 1rem;
    cursor: pointer;
}

.routine-view-controls {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 1rem;
}

.routine-container {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}

.routine-setup,
.routine-player {
    background: var(--surface);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: var(--box-shadow);
}

.routine-management-controls,
.routine-select-row,
.routine-name-row,
.routine-player-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.routine-task-list {
    padding-left: 1rem;
}

@media (max-width: 768px) {
    .routine-container {
        grid-template-columns: 1fr;
    }

    .routine-view-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .routine-view-controls .btn {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .routine-management-controls,
    .routine-select-row,
    .routine-name-row,
    .routine-actions-row,
    .routine-player-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .routine-management-controls .input-group,
    .routine-actions-row,
    .routine-name-row,
    .routine-player-controls {
        width: 100%;
    }

    .routine-select-row select,
    .routine-select-row button,
    .routine-name-row input,
    .routine-name-row button,
    .routine-actions-row button,
    .routine-player-controls button,
    #routine-start-time,
    #set-start-time-btn {
        width: 100%;
    }

    .routine-player-controls {
        gap: 0.5rem;
    }
}

/* Eisenhower Matrix */
.eisenhower-container {
    max-width: 800px;
    margin: 0 auto;
}

.matrix-controls {
    margin-bottom: 2rem;
}

.task-input {
    display: flex;
    gap: 1rem;
}

.matrix-grid {
    display: grid;
    grid-template-columns: 120px 1fr 1fr;
    gap: 1px;
    background: #ddd;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.matrix-cell,
.matrix-header-cell {
    background-color: var(--surface);
    padding: 1rem;
}

.matrix-header-cell {
    font-weight: bold;
    text-align: center;
}

.matrix-cell h4 {
    text-align: center;
    margin-bottom: 1rem;
}

/* Responsive Overrides */
@media (max-width: 768px) {

    
    .user-switcher {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        order: -1;
        margin-bottom: 0.5rem;
    }
    
    .user-switcher select {
        flex-grow: 1;
        min-width: 0; /* allows select to shrink properly */
        height: 44px;
        margin: 0 0.5rem; /* Add margin between label and + button */
    }
    
    .user-switcher button {
        height: 44px;
        width: 44px;
        display: flex;
        justify-content: center;
        align-items: center;
    }


    #language-flags {
        width: 100%;
        justify-content: center;
        margin-top: 0.5rem;
    }


    .matrix-grid {
        grid-template-columns: 80px 1fr 1fr;
    }

    .setting-group {
        flex-direction: column;
        align-items: flex-start;
    }

    .setting-group input,
    .setting-group select {
        width: 100%;
        margin-top: 0.5rem;
    }

    .sticky-progress-container {
        top: 0;
    }

    .tool-section h2 {
        font-size: 1.5rem;
    }

    .habit-tracker-container.new-layout {
        grid-template-columns: 1fr;
    }

    .habit-list-panel,
    .habit-calendar-panel {
        min-width: 0;
        padding: 1rem;
    }

    #habit-calendar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 480px) {
    .timer-circle {
        width: 200px;
        height: 200px;
    }

    .time {
        font-size: 2.5rem;
    }

    .timer-controls {
        flex-direction: column;
    }

    header .container>p {
        display: none;
    }

    .current-time {
        margin-top: 0.25rem;
    }


    /* Eisenhower small tweaks */
    .matrix-grid {
        grid-template-columns: 60px 1fr 1fr;
        font-size: 0.85rem;
    }

    .matrix-header-cell,
    .matrix-cell {
        padding: 0.5rem;
    }

    .matrix-cell h4 {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }

    .eisenhower-container .task-input {
        flex-direction: column;
        gap: 0.5rem;
    }

    .eisenhower-container .task-input input,
    .eisenhower-container .task-input button {
        width: 100%;
    }
}

/* Day Planner - Modern, User-Friendly Design */
.day-planner-container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

.planner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--secondary-color) 100%);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.planner-header h3 {
    color: white;
    margin: 0;
    font-size: 1.5rem;
}

.planner-controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.planner-controls .btn {
    background-color: rgba(255, 255, 255, 0.95);
    color: var(--primary-dark);
    border: none;
    transition: all 0.2s ease;
}

.planner-controls .btn:hover {
    background-color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.time-blocks-container {
    border: 2px solid #e0e0e0;
    border-radius: var(--border-radius);
    overflow-y: auto;
    overflow-x: hidden;
    height: calc(4 * 60 * var(--minute-height));
    max-height: 80vh;
    background: white;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
    scroll-behavior: smooth;
}

/* Custom scrollbar */
.time-blocks-container::-webkit-scrollbar {
    width: 10px;
}

.time-blocks-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.time-blocks-container::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 10px;
    transition: background 0.2s;
}

.time-blocks-container::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

:root {
    --minute-height: 2px;
}

.time-block {
    padding: 0.75rem 1rem;
    height: calc(60 * var(--minute-height));
    border-bottom: 1px solid #f0f0f0;
    position: relative;
    transition: background-color 0.2s ease;
}

.time-block:hover {
    background-color: #f8f9fa;
}

.time-block:last-child {
    border-bottom: none;
}

.time-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #666;
    margin-bottom: 0.5rem;
    display: inline-block;
    background-color: #f5f5f5;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.event-content {
    position: relative;
    height: calc(60 * var(--minute-height));
    font-size: 0.9rem;
}

.time-block.past {
    background-color: #fafafa;
}

.time-block.past .time-label {
    color: #999;
}

.event {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
    color: var(--on-primary);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    position: absolute;
    left: 0;
    right: 0;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-left: 4px solid rgba(255, 255, 255, 0.5);
    z-index: 10;
}

.event:hover {
    transform: translateX(2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.event.calendar-event {
    background: rgba(3, 218, 198, 0.15);
    border-left: 4px solid var(--secondary-color);
    color: var(--text-color);
    z-index: 1;
    pointer-events: none;
    box-shadow: none;
}



.event .resize-handle {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 8px;
    cursor: s-resize;
    background-color: rgba(0, 0, 0, 0.15);
    transition: background-color 0.2s;
}

.event .resize-handle:hover {
    background-color: rgba(0, 0, 0, 0.3);
}

/* Current time indicator styling */
.current-time-indicator {
    box-shadow: 0 0 10px rgba(255, 68, 68, 0.5);
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--surface);
    padding: 2rem;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

.close-button {
    position: sticky;
    top: 0;
    float: right;
    width: 44px;
    height: 44px;
    margin-top: -1rem;
    margin-right: -1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    cursor: pointer;
    background: var(--surface); /* Keep it readable if overlapping */
    border: none;
    border-radius: 50%;
    z-index: 10;
}

#event-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Routine Tool Layout */
.routine-view-controls {
    text-align: center;
    margin-bottom: 1rem;
}

.routine-layout {
    display: grid;
    gap: 1.5rem;
}

.routine-quick-add {
    background: var(--surface);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1rem;
}

.routine-quick-task-form {
    display: grid;
    gap: 0.75rem;
}

.routine-quick-task-form input[type="text"],
.routine-quick-task-form input[type="number"] {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.routine-slider-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.routine-slider-group input[type="range"] {
    accent-color: var(--primary-color);
}

.routine-setup,
.routine-player {
    background-color: var(--surface);
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

@media (min-width: 768px) {
    .routine-layout {
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }
}

.routine-task-list {
    list-style: none;
    padding: 0;
}

.routine-task-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
}

.routine-task-list li:last-child {
    border-bottom: none;
}

.routine-task-actions {
    display: flex;
    gap: 0.25rem;
}

.routine-section-hidden {
    display: none;
}

/* Responsive adjustments for day planner */
@media (max-width: 768px) {
    .hour-label {
        width: 60px;
        font-size: 0.9rem;
    }

    .time-blocks-row {
        width: calc(100% - 60px);
    }

    .time-block {
        min-height: 70px;
    }

    .time-label {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .hour-label {
        width: 50px;
        font-size: 0.8rem;
    }

    .time-blocks-row {
        width: calc(100% - 50px);
    }

    .time-block {
        min-height: 60px;
        padding: 0.25rem;
    }

    .time-label {
        font-size: 0.7rem;
    }

    .event-content {
        min-height: 40px;
        font-size: 0.8rem;
    }
}

/* Hide breakdown icon on small screens */
.breakdown-import-btn {
    display: none;
}

/* Calendar tool */
.calendar-events-list {
    margin-top: 1rem;
}

.calendar-event {
    padding: 0.25rem 0;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* New calendar views */
.calendar-controls {
    margin-bottom: 0.5rem;
}

.calendar-view-btn {
    margin-right: 0.25rem;
}

.calendar-view-btn.active {
    background-color: var(--primary-color);
    color: #fff;
}

.calendar-header {
    text-align: center;
    font-weight: bold;
    margin: 0.5rem 0;
}

.calendar-table {
    width: 100%;
    border-collapse: collapse;
}

.calendar-table th,
.calendar-table td {
    border: 1px solid #ddd;
    padding: 4px;
    vertical-align: top;
}

.calendar-table td.today {
    background-color: #f0f8ff;
}

/* Focus Mode Text Editor */
#focus-text {
    width: 100%;
    min-height: 300px;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: var(--border-radius);
}

.focus-text-actions {
    text-align: right;
    margin-bottom: 1rem;
}

/* Focus Mode Fullscreen */
.fullscreen-focus {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--surface);
    z-index: 1000;
    padding: 1rem;
    overflow-y: auto;
}

.fullscreen-focus.hidden {
    display: none;
}

.fullscreen-content {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.fullscreen-timer {
    font-size: 3rem;
    color: var(--primary-dark);
    margin-top: 1rem;
}

.fullscreen-goal {
    font-size: 1.5rem;
    margin-top: 0.5rem;
}

#exit-focus-mode {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.1rem;
}

.fullscreen-settings {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.preview-timer {
    font-size: 2rem;
}

/* Focus Mode Background Themes */
.bg-solid {
    background-color: #1a1a1a;
    color: #fff;
}

.bg-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.bg-nature {
    background: url('https://images.unsplash.com/photo-1501785888041-af3ef285b470?auto=format&fit=crop&w=1350&q=80') center/cover no-repeat;
    color: #fff;
}

.bg-minimal {
    background-color: #ffffff;
    color: #333;
}

/* Accessibility improvements */
input[type="checkbox"] {
    width: 1.5rem;
    height: 1.5rem;
}

button {
    min-height: 3rem;
}

.validation-error {
    color: var(--error);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.calendar-event {
    display: flex;
    align-items: center;
    gap: 4px;
}

.calendar-event button {
    min-width: 1.5rem;
    font-size: 0.8rem;
    line-height: 1;
}

@media (max-width: 480px) {

    .tool-section button,
    .tool-section .btn,
    .tool-section input,
    .tool-section select {
        width: 100%;
    }
}

/* Task Breakdown - Task Selection Modal */
.task-select-modal-content {
    max-width: 600px;
}

.task-select-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.task-select-controls input,
.task-select-controls select {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
}

.task-select-controls input {
    flex: 1;
}

.task-select-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
}

.task-select-item {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--surface);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.task-select-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.task-select-item-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.task-select-item-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Task Breakdown - Modern Design */
.task-breakdown-container {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
}

.project-section {
    margin-bottom: 2rem;
}

.project-input {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.project-input input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.project-input input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(187, 134, 252, 0.1);
    outline: none;
}

.project-input button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

#add-project {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
    color: white;
}

#ai-breakdown {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #444;
}

.project-input button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Tree Node Styling */
.main-task-item,
.subtask-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s ease;
}

.main-task-item:hover,
.subtask-item:hover {
    background: white;
    border-color: var(--primary-light);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.main-task-item {
    background: #fff;
    border-left: 4px solid var(--primary-color);
    margin-top: 1rem;
}

.subtask-item {
    border-left: 4px solid #e0e0e0;
}

.task-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.task-text {
    font-weight: 500;
    color: #2c3e50;
    cursor: pointer;
}

.task-duration-badge {
    background: #e3f2fd;
    color: #1976d2;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.task-actions {
    display: flex;
    gap: 0.5rem;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.main-task-item:hover .task-actions,
.subtask-item:hover .task-actions {
    opacity: 1;
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    color: #666;
    transition: all 0.2s;
}

.action-btn:hover {
    background: #eee;
    color: var(--primary-color);
}

.add-step-form {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    padding-left: 1rem;
    border-left: 2px dashed #e0e0e0;
}

.add-step-form input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.add-step-form button {
    padding: 0.5rem 1rem;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.add-step-form button:hover {
    background: #e0e0e0;
}

.progress-container {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.progress-bar-container {
    flex: 1;
    height: 12px;
    background: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-light) 0%, var(--primary-color) 100%);
    width: 0%;
    transition: width 0.5s ease;
}

.progress-label {
    font-weight: 600;
    color: #495057;
}

.import-btn {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 4px;
    background: #e8f5e9;
    color: #2e7d32;
    padding: 4px 8px;
    border-radius: 4px;
}


/* Data Import Collision Modal */
.data-import-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.data-import-modal-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.data-import-modal h3 {
    margin-top: 0;
    color: #2c3e50;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.collision-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.collision-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
}

.collision-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #555;
}

.collision-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.collision-val {
    background: white;
    padding: 0.5rem;
    border: 1px solid #eee;
    border-radius: 4px;
}

.collision-val label {
    display: block;
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 2px;
    text-transform: uppercase;
}

.collision-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.collision-btn {
    padding: 0.4rem 0.8rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.collision-btn:hover {
    background: #f0f0f0;
}

.collision-btn.selected {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.modal-actions {
    margin-top: 2rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    border-top: 2px solid #f0f0f0;
    padding-top: 1rem;
}

/* Routine Editor Table Layout */
.routine-editor-table {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    overflow: hidden;
    background-color: var(--surface);
}

.routine-table-header {
    display: grid;
    grid-template-columns: 1fr 120px 140px;
    background-color: #f5f5f5;
    padding: 0.75rem 1rem;
    font-weight: bold;
    border-bottom: 1px solid #ddd;
    align-items: center;
}

.routine-task-list-container {
    display: flex;
    flex-direction: column;
}

.routine-row {
    display: grid;
    grid-template-columns: 1fr 120px 140px;
    padding: 0.75rem 1rem;
    align-items: center;
    border-bottom: 1px solid #eee;
    background-color: white;
    transition: background-color 0.2s;
}

.routine-row:last-child {
    border-bottom: none;
}

.routine-row:hover {
    background-color: #f9f9f9;
}

/* Insert Zone */
.routine-insert-zone {
    height: 10px;
    background-color: transparent;
    position: relative;
    cursor: pointer;
    transition: height 0.2s, background-color 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.routine-insert-zone:hover {
    height: 30px;
    background-color: #e3f2fd;
}

.routine-insert-zone::after {
    content: '+';
    font-size: 1.2rem;
    color: var(--primary-color);
    opacity: 0;
    transition: opacity 0.2s;
    font-weight: bold;
}

.routine-insert-zone:hover::after {
    opacity: 1;
}

/* Inline Editing Inputs */
.routine-row input {
    width: 100%;
    padding: 0.4rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.routine-row .col-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.routine-row .col-actions button {
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
}

/* New Task Input Row */
.routine-new-task-row {
    display: grid;
    grid-template-columns: 1fr 120px 140px;
    padding: 0.75rem 1rem;
    align-items: center;
    background-color: #e8f5e9;
    border-bottom: 1px solid #eee;
}

.routine-footer-stats {
    margin-top: 1rem;
    font-weight: bold;
    text-align: right;
}

/* Routine Editor Table Layout - Enhanced */
.routine-editor-table {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    overflow: hidden;
    background-color: var(--surface);
}

.routine-table-header {
    display: grid;
    grid-template-columns: 30px 85px 1fr 110px 65px;
    background-color: #f5f5f5;
    padding: 0.75rem 1rem;
    font-weight: bold;
    border-bottom: 1px solid #ddd;
    align-items: center;
    color: var(--primary-dark);
}

.routine-task-list-container {
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Visual Flow Line */
.routine-task-list-container::before {
    content: '';
    position: absolute;
    left: 15px;
    /* Center of grip column (30px/2) */
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: #e0e0e0;
    z-index: 0;
}

.routine-row {
    display: grid;
    grid-template-columns: 30px 85px 1fr 110px 65px;
    padding: 0.75rem 1rem;
    align-items: center;
    border-bottom: 1px solid #eee;
    background-color: white;
    transition: background-color 0.2s;
    position: relative;
    z-index: 1;
}

.routine-row:last-child {
    border-bottom: none;
}

.routine-row:hover {
    background-color: #f9f9f9;
}

/* Grip Column */
.col-grip {
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: grab;
    color: #bbb;
    font-size: 1.2rem;
}

.col-grip:hover {
    color: var(--primary-color);
}

.col-grip:active {
    cursor: grabbing;
}

/* Time Column */
.col-time {
    font-family: monospace;
    color: #666;
    font-size: 0.85rem;
}

/* Duration Column with Smart Controls */
.duration-control {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.duration-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    color: #666;
    cursor: pointer;
    font-size: 0.8rem;
}

.duration-btn:hover {
    background-color: #e0e0e0;
    color: var(--primary-color);
}

.routine-row input[type="number"] {
    width: 50px;
    text-align: center;
    padding: 0.3rem;
    -moz-appearance: textfield;
}

.routine-row input[type="number"]::-webkit-outer-spin-button,
.routine-row input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Insert Zone */
.routine-insert-zone {
    height: 10px;
    background-color: transparent;
    position: relative;
    cursor: pointer;
    transition: height 0.2s, background-color 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    margin-top: -5px;
    margin-bottom: -5px;
}

.routine-insert-zone:hover {
    height: 30px;
    background-color: #e3f2fd;
}

.routine-insert-zone::after {
    content: '+';
    font-size: 1.2rem;
    color: var(--primary-color);
    opacity: 0;
    transition: opacity 0.2s;
    font-weight: bold;
}

.routine-insert-zone:hover::after {
    opacity: 1;
}

/* Inline Editing Inputs */
.routine-row input[type="text"] {
    width: 100%;
    padding: 0.4rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.routine-row .col-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.routine-row .col-actions button {
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
}

.routine-row .col-actions button:hover {
    color: var(--error);
    background-color: #ffebee;
    border-radius: 4px;
}

/* New Task Input Row */
.routine-new-task-row {
    display: grid;
    grid-template-columns: 30px 85px 1fr 110px 65px;
    padding: 0.75rem 1rem;
    align-items: center;
    background-color: #e8f5e9;
    border-bottom: 1px solid #eee;
}
/* Overdue Flicker Animation */
@keyframes overdue-flicker {
    0% { background-color: rgba(0, 0, 255, 0.1); } /* Blue tint */
    50% { background-color: rgba(255, 0, 0, 0.1); } /* Red tint */
    100% { background-color: rgba(0, 0, 255, 0.1); } /* Blue tint */
}

.overdue-flicker {
    animation: overdue-flicker 0.5s infinite; /* 2Hz = 0.5s period */
}

/* Toggle Switch Styles */
.toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    gap: 0.5rem;
}

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

.slider {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
    background-color: #ccc;
    transition: .4s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Calendar Redesign */
.calendar-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    align-items: start;
}

.calendar-sidebar {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.calendar-sidebar h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    color: var(--primary-dark);
}

.calendar-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.btn-block {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.ics-url-input-group {
    display: flex;
    gap: 0.5rem;
}

.ics-url-input-group input {
    flex: 1;
    min-width: 0;
    font-size: 0.9rem;
}

.calendar-settings-panel {
    margin-bottom: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #dee2e6;
}

.calendar-settings-panel h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--secondary-dark);
}

.voice-options {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.voice-early-input {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.9rem;
}

.voice-early-input input {
    width: 60px;
    padding: 0.3rem;
}

.calendar-main {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
    overflow: hidden;
    min-height: 600px;
    display: flex;
    flex-direction: column;
}

.calendar-toolbar {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.voice-options {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.voice-early-input {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.9rem;
}

.voice-early-input input {
    width: 60px;
    padding: 0.3rem;
}
.settings-toggle {
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    background: #fff;
    padding: 0.25rem 0.75rem 0.75rem;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.03);
}

.settings-toggle summary {
    font-size: 1.05rem;
    font-weight: 700;
    padding: 0.5rem 0;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

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

.settings-toggle summary::before {
    content: '\25BA';
    font-size: 0.8rem;
    transition: transform 0.2s ease;
}

.settings-toggle[open] summary::before {
    transform: rotate(90deg);
}

.settings-content {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}


.tasks-table-container {
    overflow-x: auto;
}

.tasks-table-container table {
    min-width: 620px;
}

.data-management-note {
    font-size: 0.95rem;
    color: #4a4a4a;
    margin: 0 0 0.75rem 0;
}

@media (max-width: 640px) {
    .settings-form {
        padding: 1rem;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .settings-panel {
        padding: 0;
        background: transparent;
        border: none;
        box-shadow: none;
    }

    .settings-toggle {
        padding: 0.15rem 0.75rem 0.75rem;
    }
}
.calendar-header-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    min-width: 200px;
    text-align: center;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-color);
    border: 1px solid #dee2e6;
}

.btn-icon:hover {
    background: #f1f3f5;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.calendar-view-toggles {
    display: flex;
    background: #f1f3f5;
    padding: 4px;
    border-radius: 8px;
}

.calendar-view-btn {
    background: transparent;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #666;
    cursor: pointer;
}

.calendar-view-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.calendar-events-list {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

/* Guide Modal Styles */
.guide-modal-content {
    max-width: 700px;
    padding: 0;
    overflow: hidden;
}

.guide-modal-content h2 {
    padding: 1.5rem;
    margin: 0;
}

.guide-content li {
    margin-bottom: 0.5rem;
}

.guide-note {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #e3f2fd;
    border-radius: 8px;
    color: #0d47a1;
    font-size: 0.9rem;
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .calendar-layout {
        grid-template-columns: 1fr;
    }
    .calendar-main {
        order: 1;
        min-height: 500px;
    }
}

.guide-tab {
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 600;
    color: #6c757d;
}

.guide-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.guide-content {
    display: none;
    padding: 2rem;
}

.guide-content.active {
    display: block;
}

.guide-content ol {
    padding-left: 1.5rem;
    line-height: 1.8;
}

.guide-content li {
    margin-bottom: 0.5rem;
}

.guide-note {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #e3f2fd;
    border-radius: 8px;
    color: #0d47a1;
    font-size: 0.9rem;
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .calendar-layout {
        grid-template-columns: 1fr;
    }
    
    .calendar-sidebar {
        order: 2;
    }
    
    .calendar-main {
        order: 1;
        min-height: 500px;
    }
}
.settings-form {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.settings-panel {
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.settings-panel h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #333;
}

.settings-panel .setting-group label {
    font-weight: 600;
}

.settings-panel input[type="text"],
.settings-panel input[type="time"],
.settings-panel input[type="number"] {
    width: 100%;
    padding: 0.6rem;
    border-radius: 6px;
    border: 1px solid #ccc;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.coming-soon {
    color: #666;
    font-size: 0.9rem;
    margin: 0;
}

.settings-actions {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.settings-status {
    font-weight: 600;
    color: #388e3c;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.settings-status.visible {
    opacity: 1;
}
.calendar-header-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    min-width: 200px;
    text-align: center;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-color);
    border: 1px solid #dee2e6;
}

.btn-icon:hover {
    background: #f1f3f5;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.calendar-view-toggles {
    display: flex;
    background: #f1f3f5;
    padding: 4px;
    border-radius: 8px;
}

.calendar-view-btn {
    background: transparent;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;

@media (max-width: 820px) {
    .modal-content {
        width: 95%;
    }
}

/* User switching */
.user-switcher {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-compact {
    padding: 4px 8px;
    font-size: 0.85rem;
}
    cursor: pointer;
}

.calendar-view-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.calendar-events-list {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

/* Guide Modal Styles */
.guide-modal-content {
    max-width: 700px;
    padding: 0;
    overflow: hidden;
}

.guide-modal-content h2 {
    padding: 1.5rem;
    margin: 0;
    background: var(--primary-color);
    color: white;
}

.guide-tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 0 1rem;
}

.guide-tab {
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 600;
    color: #6c757d;
}

.guide-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.guide-content {
    display: none;
    padding: 2rem;
}

.guide-content.active {
    display: block;
}

.guide-content ol {
    padding-left: 1.5rem;
    line-height: 1.8;
}

.guide-content li {
    margin-bottom: 0.5rem;
}

.guide-note {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #e3f2fd;
    border-radius: 8px;
    color: #0d47a1;
    font-size: 0.9rem;
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .calendar-layout {
        grid-template-columns: 1fr;
    }
    
    .calendar-sidebar {
        order: 2;
    }
    
    .calendar-main {
        order: 1;
        min-height: 500px;
    }
}

/* ── Credentials Sync Panel ──────────────────────────────────────────────── */
.settings-panel--full {
  grid-column: 1 / -1; /* span all columns */
}

.creds-sync-wrap {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.creds-section h4 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.creds-hint {
  font-size: 0.85rem;
  color: var(--text-muted, #888);
  margin: 0 0 1rem;
  line-height: 1.5;
}

.creds-pw-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.creds-pw-row input {
  flex: 1;
}

.btn-icon {
  background: var(--surface);
  border: 1px solid var(--border-color, #ccc);
  border-radius: 6px;
  padding: 0 0.6rem;
  height: 36px;
  cursor: pointer;
  color: var(--text-color);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.btn-icon:hover { background: var(--primary-color); color: #fff; }

.creds-strength-bar {
  height: 4px;
  background: var(--border-color, #e0e0e0);
  border-radius: 2px;
  margin-top: 0.4rem;
  overflow: hidden;
}
.creds-strength-bar > div {
  height: 100%;
  width: 0;
  border-radius: 2px;
  transition: width 0.3s, background 0.3s;
}

.creds-strength-label {
  font-size: 0.75rem;
  color: var(--text-muted, #888);
}

.creds-key-preview {
  background: var(--surface);
  border: 1px solid var(--border-color, #e0e0e0);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
  font-size: 0.85rem;
}

.creds-key-preview ul {
  margin: 0.3rem 0 0;
  padding-left: 1rem;
  list-style: none;
}

.creds-key-preview li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0;
  color: var(--text-color);
}

.creds-key-preview .fa-key {
  color: var(--primary-color);
  font-size: 0.75rem;
}

.creds-preview-label {
  font-weight: 600;
  margin: 0;
  color: var(--text-color);
}

.creds-empty {
  color: var(--text-muted, #888);
  font-style: italic;
}

.creds-export-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.creds-divider {
  border: none;
  border-top: 1px solid var(--border-color, #e0e0e0);
  margin: 0;
}

.creds-status {
  display: block;
  font-size: 0.85rem;
  margin-top: 0.5rem;
  min-height: 1.2em;
  transition: color 0.2s;
}

.creds-status--ok   { color: #2ecc71; }
.creds-status--warn { color: #e67e22; }
.creds-status--err  { color: #e74c3c; }
.creds-status--info { color: var(--primary-color); }

#creds-import-ta {
  width: 100%;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 0.78rem;
  resize: vertical;
  background: var(--surface);
  color: var(--text-color);
  border: 1px solid var(--border-color, #ccc);
  border-radius: 6px;
  padding: 0.5rem;
}

@media (max-width: 600px) {
  .creds-export-actions { flex-direction: column; }
  .creds-export-actions .btn { width: 100%; }
}

#language-flags {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.lang-flag {
    background: none;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.5rem;
    padding: 0.2rem;
    transition: all 0.2s ease;
    opacity: 0.6;
}

.lang-flag:hover {
    opacity: 0.8;
}

.lang-flag.active {
    opacity: 1;
    border-color: var(--secondary-color);
}
