:root {
    --bg-color: #f0f2f5; /* Softer, more neutral background */
    --container-bg-color: #ffffff;
    --text-color: #2c3e50;
    --secondary-text-color: #95a5a6;
    --timer-bg-color: #f5f6fa;
    --primary-color: #ff6b6b; /* Pastel Red */
    --success-color: #2ecc71;
    --info-color: #3498db;
    --danger-color: #e74c3c;
    --button-bg-color: #ffffff;
    --button-shadow-color: rgba(0, 0, 0, 0.02);
    --border-color: #eceff1;
    --border-radius: 20px; /* Smooth rounded corners */
    --box-shadow: 0 8px 20px rgba(0, 0, 0, 0.03); /* Very soft shadow */
}

body.dark-mode {
    --bg-color: #121212;
    --container-bg-color: #1e1e1e;
    --text-color: #e0e0e0;
    --secondary-text-color: #a0a0a0;
    --timer-bg-color: #2a2a2a;
    --primary-color: #ff8787;
    --success-color: #27ae60;
    --info-color: #2980b9;
    --danger-color: #c0392b;
    --button-bg-color: #333333;
    --button-shadow-color: rgba(0, 0, 0, 0.3);
    --border-color: #333333;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    padding: 40px;
    box-sizing: border-box;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    display: flex;
    gap: 40px;
    max-width: 960px;
    width: 100%;
}

.timer-wrapper, .task-wrapper {
    flex: 1;
}

.timer-container, .task-container, .stats-container {
    background-color: var(--container-bg-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 40px;
    transition: all 0.3s ease;
    border: 1px solid transparent; /* Clean look */
}

/* Hover effect for containers to give depth */
.timer-container:hover, .task-container:hover, .stats-container:hover {
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.05);
}

.task-container {
    margin-bottom: 25px;
}

.header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.title {
    font-size: 1.1rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-color);
    opacity: 0.8;
}

.timer-settings {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 40px;
}

#time-input {
    width: 90px;
    font-size: 2rem;
    font-weight: 200;
    text-align: center;
    border: none; /* Remove border for minimalist look */
    border-bottom: 2px solid var(--border-color);
    border-radius: 0;
    background-color: transparent;
    color: var(--text-color);
    padding: 5px;
    transition: border-color 0.2s;
}

#time-input:focus {
    outline: none;
    border-color: var(--success-color);
}

/* Ring Style Timer - Simplified */
.timer {
    width: 260px;
    height: 260px;
    border-radius: 50%;
    position: relative;
    background-color: var(--timer-bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 40px;
    box-shadow: inset 0 4px 10px rgba(0,0,0,0.03); /* Subtle inner shadow */
}

/* Inner circle */
.timer::after {
    content: '';
    position: absolute;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background-color: var(--container-bg-color);
    z-index: 0;
}

.timer-display {
    font-size: 4.5rem;
    font-weight: 200; /* Lighter weight */
    color: var(--text-color);
    z-index: 1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -2px;
}

body.dark-mode .timer-display {
    color: var(--text-color);
}

.timer-controls {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 25px;
    margin-bottom: 15px;
}

.play-pause-btn, .reset-btn, .volume-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background-color: var(--button-bg-color);
    box-shadow: 0 4px 12px var(--button-shadow-color);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.play-pause-btn:hover, .reset-btn:hover, .volume-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.play-icon, .pause-icon, .reset-btn svg, .volume-btn svg {
    width: 24px;
    height: 24px;
    fill: var(--secondary-text-color);
    transition: fill 0.2s;
}

.play-pause-btn:hover svg, .reset-btn:hover svg, .volume-btn:hover svg {
    fill: var(--success-color);
}

/* Large play button emphasis */
.play-pause-btn {
    width: 72px;
    height: 72px;
    background-color: var(--success-color);
    box-shadow: 0 10px 20px rgba(46, 204, 113, 0.3);
}

.play-pause-btn svg {
    fill: white;
    width: 32px;
    height: 32px;
}

.play-pause-btn:hover {
    background-color: var(--success-color);
    opacity: 0.9;
}

.play-pause-btn:hover svg {
    fill: white;
}


.add-task-container {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    background-color: var(--bg-color);
    padding: 5px;
    border-radius: 12px;
}

#task-input {
    flex-grow: 1;
    padding: 15px;
    border: none;
    background-color: transparent;
    color: var(--text-color);
    font-size: 1rem;
}

#task-input:focus {
    outline: none;
    border-bottom: 2px solid var(--success-color);
}

#add-task-btn {
    padding: 0 25px;
    border: none;
    background-color: var(--container-bg-color);
    color: var(--success-color); /* Minimalist text button */
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin: 5px;
}

#add-task-btn:hover {
    background-color: var(--success-color);
    color: white;
}

#task-list {
    list-style: none;
    padding: 0;
    margin-top: 20px;
}

#task-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 10px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
    border-radius: 8px;
}

#task-list li:hover {
    background-color: var(--bg-color);
}

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

#task-list li.completed span {
    text-decoration: line-through;
    color: var(--secondary-text-color);
    opacity: 0.6;
}

#task-list .task-buttons {
    display: flex;
    gap: 10px;
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    transform: translateX(10px);
    transition: all 0.3s ease;
}

#task-list li:hover .task-buttons,
#task-list li:focus-within .task-buttons {
    opacity: 1;
    max-width: 200px; /* Sufficient space for buttons */
    transform: translateX(0);
}

/* Mobile support for task buttons */
@media (hover: none) {
    #task-list .task-buttons {
        opacity: 1;
        max-width: 200px;
        transform: none;
    }
}

#task-list button {
    border: none;
    border-radius: 50%; /* Circle buttons */
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    background-color: transparent; /* Transparent background */
}

#task-list button svg {
    width: 18px;
    height: 18px;
    fill: var(--secondary-text-color); /* Neutral icons */
}

#task-list button.complete-btn:hover svg { fill: var(--success-color); }
#task-list button.edit-btn:hover svg { fill: var(--info-color); }
#task-list button.delete-btn:hover svg { fill: var(--danger-color); }

#task-list button:hover {
    background-color: rgba(0,0,0,0.05);
    transform: scale(1.1);
}

.container-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.container-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.btn-secondary {
    padding: 8px 16px;
    border: none;
    background-color: transparent;
    color: var(--danger-color);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    width: fit-content;
    font-weight: 600;
    transition: all 0.2s;
    border: 1px solid var(--danger-color);
}

.btn-secondary:hover {
    background-color: var(--danger-color) !important;
    color: white !important;
}

.empty-state {
    text-align: center;
    color: var(--secondary-text-color);
    margin-top: 40px;
    font-weight: 300;
}

/* Theme & Lang Switcher Common */
.theme-switcher, .lang-switcher {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.theme-switcher input, .lang-switcher input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-switcher label, .lang-switcher label {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: .3s;
    border-radius: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.theme-switcher label:before, .lang-switcher label:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: var(--container-bg-color);
    transition: .3s;
    border-radius: 50%;
    z-index: 2; /* Above icons */
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

input:checked + label {
    background-color: var(--secondary-text-color);
}

.sun-icon, .moon-icon {
    font-size: 14px;
    line-height: 1;
    margin: 0;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    transition: opacity 0.3s;
}

.sun-icon { right: 6px; opacity: 1; }
.moon-icon { left: 6px; opacity: 0; }

input:checked + label .sun-icon { opacity: 0; }
input:checked + label .moon-icon { opacity: 1; filter: none; }

.lang-en, .lang-es {
    font-size: 10px;
    font-weight: 800;
    color: var(--text-color);
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    transition: opacity 0.3s;
}

.lang-en { right: 6px; opacity: 1; }
.lang-es { left: 6px; opacity: 0; }

input:checked + label .lang-en { opacity: 0; }
input:checked + label .lang-es { opacity: 1; color: white; }


input:checked + label:before {
    transform: translateX(22px);
}

/* Responsive Layout */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        gap: 20px;
        padding: 15px;
    }

    .timer-container, .task-container, .stats-container {
        padding: 20px;
    }

    .play-pause-btn {
        width: 64px;
        height: 64px;
    }

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

    .add-task-container {
        flex-direction: column;
        gap: 10px;
    }

    #add-task-btn {
        width: 100%;
        margin: 0;
        padding: 12px;
    }
}

.footer {
    width: 100%;
    text-align: center;
    margin-top: 30px;
    color: var(--secondary-text-color);
    font-size: 0.8em;
    opacity: 0.7;
}

.hidden {
    display: none !important;
}

/* Clear/Reset Button Expansion Logic */
.delete-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    max-width: 36px;
    width: auto;
    height: 36px;
    border-radius: 18px;
    padding: 0;
    padding-left: 8px;
    padding-right: 8px;
    background-color: transparent;
    border: 1px solid var(--danger-color);
}

.delete-action-btn .trash-icon {
    width: 18px;
    height: 18px;
    fill: var(--danger-color);
    min-width: 18px;
}

.delete-action-btn .btn-text {
    opacity: 0;
    width: 0;
    white-space: nowrap;
    transition: all 0.3s ease;
    font-size: 0;
    color: var(--danger-color);
}

/* Expanded State */
.delete-action-btn.expanded {
    max-width: 200px;
    gap: 8px;
    padding: 6px 16px;
    background-color: var(--danger-color);
}

.delete-action-btn.expanded .trash-icon {
    fill: white;
}

.delete-action-btn.expanded .btn-text {
    opacity: 1;
    width: auto;
    font-size: 0.8rem;
    margin-left: 0;
    color: white;
}

.delete-action-btn:hover {
    background-color: rgba(231, 76, 60, 0.1);
}
.delete-action-btn.expanded:hover {
    background-color: var(--danger-color);
    opacity: 0.9;
}

#reset-stats-btn {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.stats-container:hover #reset-stats-btn,
.stats-container:focus-within #reset-stats-btn {
    opacity: 1;
}

@media (hover: none) {
    #reset-stats-btn {
        opacity: 1;
    }
}

/* Quick Select Dropdown */
.quick-select-container {
    position: relative;
    display: inline-block;
}

#quick-select-btn {
    background: transparent;
    border: none;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    border-radius: 50%;
}

#quick-select-btn:hover {
    background-color: var(--bg-color);
    transform: scale(1.1);
}

.quick-select-menu {
    position: absolute;
    top: 110%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--container-bg-color);
    border: none;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    padding: 12px;
    z-index: 100;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    width: 160px;
    transition: opacity 0.2s, transform 0.2s;
}

.quick-select-menu.hidden {
    display: none;
}

.quick-option {
    background: var(--bg-color);
    border: none;
    border-radius: 8px;
    padding: 10px 0;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-color);
    transition: all 0.2s;
    text-align: center;
    width: 100%;
    font-weight: 600;
}

.quick-option:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* Pagination */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.pagination-btn {
    background-color: var(--button-bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.pagination-btn:hover {
    background-color: var(--bg-color);
    border-color: var(--secondary-text-color);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#page-info {
    font-size: 0.9rem;
    color: var(--secondary-text-color);
}

/* Task Selection & Active Styling */
.header-buttons {
    display: flex;
    gap: 10px;
}

.task-checkbox {
    margin-right: 10px;
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
    opacity: 0;
    transition: opacity 0.2s;
}

#task-list li:hover .task-checkbox,
.task-checkbox:checked,
.task-checkbox:focus {
    opacity: 1;
}

.active-task {
    background-color: rgba(46, 204, 113, 0.1) !important; /* Light success color bg */
    border-left: 4px solid var(--success-color);
}

.star-btn svg {
    fill: none;
    stroke: var(--secondary-text-color);
    stroke-width: 2;
    transition: all 0.2s;
}

.star-btn.active svg {
    fill: #f1c40f; /* Gold color */
    stroke: #f1c40f;
}

.star-btn:hover svg {
    stroke: #f1c40f;
}
