/* ===== Global Variables ===== */
:root {
    --primary-color: #e74c3c;
    --primary-dark: #c0392b;
    --primary-light: #ff6b6b;
    --secondary-color: #3498db;
    --background: #f5f7fa;
    --surface: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --success: #2ecc71;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-lg: rgba(0, 0, 0, 0.15);
}

/* ===== Theme Colors ===== */
body[data-theme="ocean"] {
    --primary-color: #3498db;
    --primary-dark: #2980b9;
    --primary-light: #5dade2;
}

body[data-theme="forest"] {
    --primary-color: #27ae60;
    --primary-dark: #229954;
    --primary-light: #58d68d;
}

body[data-theme="sunset"] {
    --primary-color: #e67e22;
    --primary-dark: #d35400;
    --primary-light: #f39c12;
}

body[data-theme="lavender"] {
    --primary-color: #9b59b6;
    --primary-dark: #8e44ad;
    --primary-light: #bb8fce;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background 0.3s ease;
}

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

/* ===== Header ===== */
header {
    text-align: center;
    margin-bottom: 30px;
    animation: fadeInDown 0.6s ease;
}

.title-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    position: relative;
    margin-bottom: 15px;
}

.tomato-icon {
    font-size: 3.5rem;
    animation: bounce 2s ease-in-out infinite;
    filter: drop-shadow(0 5px 15px rgba(231, 76, 60, 0.3));
}

.animated-title {
    font-size: 2.5rem;
    color: var(--text-primary);
    font-weight: 700;
    display: flex;
    gap: 2px;
}

.letter {
    display: inline-block;
    animation: wave 1.5s ease-in-out infinite;
    animation-delay: calc(var(--i) * 0.1s);
    background: linear-gradient(45deg, var(--primary-color), var(--primary-light), var(--secondary-color));
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: wave 1.5s ease-in-out infinite, gradient 3s ease infinite;
}

.letter:nth-child(1) { --i: 0; }
.letter:nth-child(2) { --i: 1; }
.letter:nth-child(3) { --i: 2; }
.letter:nth-child(4) { --i: 3; }
.letter:nth-child(5) { --i: 4; }
.letter:nth-child(6) { --i: 5; }
.letter:nth-child(7) { --i: 6; }
.letter:nth-child(8) { --i: 7; }

.sparkles {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.sparkle {
    position: absolute;
    font-size: 1.5rem;
    animation: sparkle 2s ease-in-out infinite;
    opacity: 0;
}

.sparkle:nth-child(1) {
    top: -10px;
    left: 10%;
    animation-delay: 0s;
}

.sparkle:nth-child(2) {
    top: 50%;
    right: 5%;
    animation-delay: 0.5s;
}

.sparkle:nth-child(3) {
    bottom: -10px;
    left: 15%;
    animation-delay: 1s;
}

.sparkle:nth-child(4) {
    top: 20%;
    right: 15%;
    animation-delay: 1.5s;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.2rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.subtitle-word {
    display: inline-block;
    animation: fadeInUp 0.6s ease;
    animation-fill-mode: both;
    font-weight: 600;
}

.subtitle-word:nth-child(1) { 
    animation-delay: 0.2s;
    color: var(--primary-color);
}

.subtitle-word:nth-child(3) { 
    animation-delay: 0.4s;
    color: var(--secondary-color);
}

.subtitle-word:nth-child(5) { 
    animation-delay: 0.6s;
    color: var(--success);
}

.subtitle-dot {
    color: var(--primary-color);
    font-weight: bold;
    animation: pulse 1.5s ease-in-out infinite;
}

.rocket {
    display: inline-block;
    animation: fly 2s ease-in-out infinite;
    font-size: 1.3rem;
}

/* ===== Timer Section ===== */
.timer-section {
    background: var(--surface);
    border-radius: 30px;
    padding: 40px;
    box-shadow: 0 10px 30px var(--shadow);
    margin-bottom: 30px;
    animation: fadeInUp 0.6s ease;
}

.mode-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.mode-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    background: var(--background);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--shadow);
}

.mode-btn.active {
    background: var(--primary-color);
    color: white;
}

/* ===== Timer Display ===== */
.timer-display {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 40px 0;
}

.time {
    font-size: 4rem;
    font-weight: 700;
    color: var(--primary-color);
    position: absolute;
    z-index: 2;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.progress-ring {
    position: relative;
}

.progress-ring-circle {
    fill: none;
    stroke: var(--background);
    stroke-width: 12;
}

.progress-ring-fill {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 12;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: center;
    transition: stroke-dashoffset 1s linear;
    filter: drop-shadow(0 0 10px var(--primary-light));
}

/* ===== Timer Controls ===== */
.timer-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

.control-btn {
    padding: 15px 40px;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 5px 15px var(--shadow);
}

.control-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px var(--shadow-lg);
}

.control-btn:active {
    transform: translateY(-1px);
}

.start {
    background: var(--primary-color);
    color: white;
}

.start.paused {
    background: var(--primary-dark);
}

.reset {
    background: var(--background);
    color: var(--text-primary);
}

.btn-icon {
    font-size: 1.2rem;
}

/* ===== Motivation Box ===== */
.motivation-box {
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    padding: 20px 30px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    animation: pulse 2s ease-in-out infinite;
}

.motivation-text {
    color: white;
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0;
}

/* ===== Stats Section ===== */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    animation: fadeInUp 0.6s ease 0.2s both;
}

.stat-card {
    background: var(--surface);
    padding: 25px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 5px 20px var(--shadow);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px var(--shadow-lg);
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===== Tasks Section ===== */
.tasks-section {
    background: var(--surface);
    border-radius: 30px;
    padding: 30px;
    box-shadow: 0 10px 30px var(--shadow);
    animation: fadeInUp 0.6s ease 0.4s both;
}

.tasks-section h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

.task-input-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#taskInput {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid var(--background);
    border-radius: 15px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

#taskInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

#addTaskBtn {
    padding: 15px 30px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

#addTaskBtn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.task-list {
    list-style: none;
    max-height: 400px;
    overflow-y: auto;
}

.task-item {
    background: var(--background);
    padding: 15px 20px;
    border-radius: 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
    animation: slideIn 0.3s ease;
}

.task-item:hover {
    transform: translateX(5px);
    box-shadow: 0 3px 10px var(--shadow);
}

.task-content {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.task-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.task-checkbox.checked {
    background: var(--primary-color);
    position: relative;
}

.task-checkbox.checked::after {
    content: '✓';
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
}

.task-text {
    flex: 1;
    color: var(--text-primary);
}

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

.task-delete {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px 10px;
    transition: all 0.3s ease;
}

.task-delete:hover {
    color: var(--primary-color);
    transform: scale(1.2);
}

/* ===== Settings Panel ===== */
.settings-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: var(--surface);
    box-shadow: -5px 0 20px var(--shadow-lg);
    transition: right 0.3s ease;
    z-index: 1000;
    padding: 30px;
    overflow-y: auto;
}

.settings-panel.active {
    right: 0;
}

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

.settings-header h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.close-btn:hover {
    color: var(--primary-color);
    transform: rotate(90deg);
}

.settings-content {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.setting-item input[type="number"] {
    width: 80px;
    padding: 10px;
    border: 2px solid var(--background);
    border-radius: 10px;
    font-size: 1rem;
    text-align: center;
}

.setting-item input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--background);
    transition: 0.3s;
    border-radius: 30px;
}

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

input:checked + .slider {
    background-color: var(--primary-color);
}

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

/* ===== Theme Selector ===== */
.theme-selector {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    background: var(--surface);
    padding: 10px;
    border-radius: 50px;
    box-shadow: 0 5px 20px var(--shadow);
    animation: fadeInDown 0.6s ease;
    z-index: 100;
}

.theme-btn {
    width: 45px;
    height: 45px;
    border: none;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--background);
}

.theme-btn:hover {
    transform: scale(1.15);
}

/* ===== Floating Settings Button ===== */
.floating-settings-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 5px 20px var(--shadow-lg);
    transition: all 0.3s ease;
    z-index: 100;
}

.floating-settings-btn:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 8px 30px var(--shadow-lg);
}

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

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-15px);
    }
}

@keyframes wave {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-10px) rotate(-5deg);
    }
    75% {
        transform: translateY(-5px) rotate(5deg);
    }
}

@keyframes gradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes sparkle {
    0%, 100% {
        opacity: 0;
        transform: scale(0) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: scale(1.2) rotate(180deg);
    }
}

@keyframes fly {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-8px) rotate(-10deg);
    }
    75% {
        transform: translateY(-4px) rotate(10deg);
    }
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .animated-title {
        font-size: 2rem;
    }

    .tomato-icon {
        font-size: 2.5rem;
    }

    .timer-section {
        padding: 25px 20px;
    }

    .time {
        font-size: 3rem;
    }

    .progress-ring svg {
        width: 250px;
        height: 250px;
    }

    .stats-section {
        grid-template-columns: 1fr;
    }

    .settings-panel {
        width: 100%;
        right: -100%;
    }

    .theme-selector {
        flex-wrap: wrap;
        justify-content: center;
    }

    .control-btn {
        padding: 12px 25px;
        font-size: 1rem;
    }

    .task-input-container {
        flex-direction: column;
    }

    #addTaskBtn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .animated-title {
        font-size: 1.5rem;
    }

    .tomato-icon {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .time {
        font-size: 2.5rem;
    }

    .progress-ring svg {
        width: 200px;
        height: 200px;
    }

    .mode-buttons {
        flex-direction: column;
        width: 100%;
    }

    .mode-btn {
        width: 100%;
    }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}