/* 
 * Enhanced Pomodoro Timer CSS
 * A modern, clean, responsive design for the Pomodoro Timer application
 */

/* ===== Variables ===== */
:root {
    /* Main colors */
    --primary-color: #e05d55;
    --primary-gradient: linear-gradient(135deg, #e05d55, #ff7b7b);
    --progress-percent: 100%;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    
    /* Text colors */
    --text-color: #2d3436;
    --text-secondary: #636e72;
    
    /* UI elements */
    --border-color: #eaeaea;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    
    /* Animations */
    --transition-speed: 0.25s;
    --transition-function: cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    
    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;
}

/* Dark mode variables */
.dark-mode {
    --primary-color: #ff6b6b;
    --primary-gradient: linear-gradient(135deg, #ff6b6b, #ff8e8e);
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    
    --text-color: #f5f5f5;
    --text-secondary: #b0b0b0;
    
    --border-color: #333333;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* ===== Base Styles ===== */
* {
    box-sizing: border-box;
    transition: background-color var(--transition-speed) var(--transition-function),
               color var(--transition-speed) var(--transition-function),
               border-color var(--transition-speed) var(--transition-function),
               box-shadow var(--transition-speed) var(--transition-function);
}

body {
    font-family: 'Inter', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding-bottom: 60px; /* Add space for the fixed attribution footer */
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    text-align: center;
    background-color: var(--card-bg);
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    width: 420px;
    max-width: 95vw;
    position: relative;
    transition: transform 0.3s var(--transition-function);
}

.container:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

h1 {
    color: var(--primary-color);
    margin-top: 0;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: var(--space-lg);
    padding: 0 calc(var(--space-xl) * 2);
}

/* ===== Buttons and Controls ===== */
.stats-button, .settings-button {
    position: absolute;
    top: var(--space-xl);
    background: var(--card-bg);
    color: var(--text-color);
    width: 42px;
    height: 42px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s var(--transition-function);
    z-index: 10;
    overflow: hidden;
}

.stats-button::before, .settings-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity 0.2s var(--transition-function);
    z-index: -1;
}

.stats-button:hover, .settings-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: white;
    border-color: transparent;
}

.stats-button:hover::before, .settings-button:hover::before {
    opacity: 1;
}

.stats-button:active, .settings-button:active {
    transform: translateY(0);
}

.stats-button {
    right: var(--space-md);
}

.settings-button {
    right: calc(var(--space-md) + 48px);
}

.stats-button .icon, .settings-button .icon {
    stroke: currentColor;
    transition: all 0.2s var(--transition-function);
}

.controls {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-lg);
}

.toggle-btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s var(--transition-function);
    min-width: 120px;
    box-shadow: var(--shadow-sm);
    font-size: 1rem;
    letter-spacing: 0.5px;
}

.reset-icon {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 30px;
    background: transparent;
    color: var(--text-color);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s var(--transition-function);
    opacity: 0.6;
}

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

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

.reset-icon:hover {
    opacity: 1;
}

.reset-icon:active {
    transform: translateX(-50%) scale(0.95);
}

.toggle-btn {
    background: var(--primary-gradient);
    color: white;
}

.toggle-btn.pause {
    background: #f0f0f0;
    color: #333333;
}

.dark-mode .toggle-btn.pause {
    background: #3a3a3a;
    color: #f5f5f5;
}



.modes {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.mode {
    padding: 10px 18px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--card-bg);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s var(--transition-function);
    font-weight: 500;
}

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

.mode.active {
    background: var(--primary-gradient);
    color: white;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

/* ===== Timer Display ===== */
.timer-container {
    position: relative;
    width: 260px;
    height: 260px;
    margin: 0 auto var(--space-lg);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.progress-ring {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.progress-ring__circle {
    fill: transparent;
    stroke-linecap: round;
    stroke-dasharray: 730;
    stroke-dashoffset: 730; /* Start with full offset (empty circle) */
    transform-origin: center;
    transform: rotate(-90deg); /* Start at top */
    transition: stroke-dashoffset 0.5s var(--transition-function);
    filter: drop-shadow(0 0 4px rgba(224, 93, 85, 0.5));
}

.progress-ring__background {
    stroke: var(--border-color);
    fill: transparent;
    opacity: 0.3;
}

.timer {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--text-color);
    letter-spacing: -1px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Add this to the HTML head section */
.svg-defs {
    position: absolute;
    width: 0;
    height: 0;
}

/* ===== Task Input ===== */
.task-input {
    width: 100%;
    padding: 14px 16px;
    margin-bottom: var(--space-lg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--card-bg);
    color: var(--text-color);
    font-size: 1rem;
    transition: all 0.2s var(--transition-function);
    box-shadow: var(--shadow-sm);
}

.task-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(224, 93, 85, 0.2);
}

.task-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

/* ===== Dark Mode Toggle ===== */
.toggle-container {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: var(--space-lg);
    gap: var(--space-sm);
}

.toggle-container span {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 26px;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .3s var(--transition-function);
    border-radius: var(--radius-full);
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.1);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s var(--transition-function);
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

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

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

/* ===== Sound Selector ===== */
.sound-selector {
    margin-top: var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: rgba(0, 0, 0, 0.03);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
}



.sound-selector select {
    padding: 8px 12px;
    border-radius: var(--radius-md);
    background-color: var(--card-bg);
    color: var(--text-color);
    border: 2px solid var(--border-color);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s var(--transition-function);
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23666666%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 12px top 50%;
    background-size: 10px auto;
    padding-right: 30px;
    min-width: 120px;
}

.sound-selector select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(224, 93, 85, 0.2);
}

.dark-mode .sound-selector select {
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23b0b0b0%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
}

/* ===== Modal Styles ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s var(--transition-function);
}

.modal.show {
    opacity: 1;
}

.modal-content {
    background-color: var(--card-bg);
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    max-width: 90%;
    width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    color: var(--text-color);
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.3s var(--transition-function), opacity 0.3s var(--transition-function);
}

.modal.show .modal-content {
    transform: translateY(0);
    opacity: 1;
}

.close-button {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    transition: all 0.2s var(--transition-function);
}

.close-button:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--primary-color);
}

/* ===== Statistics Styles ===== */
.stats-container {
    display: flex;
    justify-content: space-around;
    margin: var(--space-lg) 0;
    gap: var(--space-md);
}

.stat {
    text-align: center;
    background-color: rgba(0, 0, 0, 0.03);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    flex: 1;
    transition: transform 0.2s var(--transition-function);
}

.stat:hover {
    transform: translateY(-2px);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: var(--space-xs);
}

.stat-label {
    margin-top: var(--space-xs);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
}

.history-content {
    max-height: 300px;
    overflow-y: auto;
    margin-top: var(--space-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.history-item {
    padding: var(--space-md);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    transition: background-color 0.2s var(--transition-function);
}

.history-item:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.history-item:last-child {
    border-bottom: none;
}

.history-date {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ===== Settings Styles ===== */
.range-container, .toggle-setting-container {
    margin-bottom: var(--space-xl);
    background-color: rgba(0, 0, 0, 0.03);
    padding: var(--space-md);
    border-radius: var(--radius-md);
}

.range-container h3, .toggle-setting-container h3 {
    margin-top: 0;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-color);
}

.time-display {
    font-size: 2rem;
    font-weight: 700;
    margin: var(--space-sm) 0 var(--space-md);
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.range-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-xs);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.range-slider {
    width: 100%;
    cursor: pointer;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border-color);
    border-radius: var(--radius-full);
    outline: none;
    transition: all 0.2s var(--transition-function);
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-gradient);
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.2s var(--transition-function);
}

.range-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-gradient);
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.2s var(--transition-function);
    border: none;
}

.range-slider::-webkit-slider-thumb:hover,
.range-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
}

.settings-button-container {
    margin-top: var(--space-xl);
    text-align: center;
}

.settings-save {
    background: var(--primary-gradient);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s var(--transition-function);
    font-size: 1rem;
    letter-spacing: 0.5px;
}

.settings-save:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.settings-save:active {
    transform: translateY(0);
}

/* Toggle setting styles */
.toggle-setting {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-md);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-color);
}

.toggle-setting span, .sound-selector span {
    font-size: 0.95rem;
    color: var(--text-color);
}

.setting-row {
    margin-top: var(--space-md);
}

/* ===== Attribution Footer ===== */
.attribution {
    text-align: center;
    padding: var(--space-md) 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    opacity: 0.8;
    transition: opacity 0.2s var(--transition-function);
    width: 100%;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--bg-color);
}

.attribution:hover {
    opacity: 1;
}

.attribution a {
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.2s var(--transition-function);
    position: relative;
}

.attribution a:hover {
    text-decoration: underline;
}

.attribution a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--primary-gradient);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s var(--transition-function);
}

.attribution a:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* ===== Responsive Styles ===== */
@media (max-width: 480px) {
    body {
        padding-bottom: 50px; /* Add space for the fixed attribution footer */
    }
    
    .container {
        padding: var(--space-md);
        width: 100%;
        border-radius: 0;
        box-shadow: none;
    }
    
    .timer-container {
        width: 220px;
        height: 220px;
    }
    
    .timer {
        font-size: 2.8rem;
    }
    
    .controls {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .toggle-btn {
        width: 100%;
    }
    
    .reset-icon {
        bottom: 50px;
    }
    
    .modes {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: var(--space-xs);
        margin-bottom: var(--space-md);
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
    }
    
    .modes::-webkit-scrollbar {
        display: none; /* Chrome, Safari, Edge */
    }
    
    .mode {
        flex: 0 0 auto;
        white-space: nowrap;
    }
    
    .stats-container {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .stat {
        padding: var(--space-sm);
    }
    
    .modal-content {
        max-width: 100%;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .attribution {
        padding: var(--space-sm) 0;
        font-size: 0.8rem;
    }
}
