/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding-bottom: 80px;
}

/* Color Variables */
:root {
    --primary-color: #FF6B6B;
    --secondary-color: #4ECDC4;
    --accent-color: #45B7D1;
    --success-color: #96CEB4;
    --warning-color: #FFEAA7;
    --white: #ffffff;
    --light-gray: #f8f9fa;
    --gray: #6c757d;
    --dark-gray: #343a40;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --border-radius: 12px;
}

/* Header */
.app-header {
    background: var(--white);
    padding: 1rem;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.sync-btn {
    background: var(--accent-color);
    color: var(--white);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sync-btn:hover {
    background: #3a9bc1;
    transform: translateY(-1px);
}

.sync-btn:disabled {
    background: var(--gray);
    cursor: not-allowed;
    transform: none;
}

/* Main Content */
.app-main {
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.section {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.section.active {
    display: block;
}

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

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.action-btn {
    background: var(--white);
    border: none;
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--dark-gray);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.action-btn i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

/* Timers Container */
.timers-container {
    min-height: 200px;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--secondary-color);
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: var(--dark-gray);
}

/* Timer Card */
.timer-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.timer-card.running {
    border-left: 4px solid var(--success-color);
}

.timer-card.paused {
    border-left: 4px solid var(--warning-color);
}

.timer-card.finished {
    border-left: 4px solid var(--primary-color);
    background: #fff5f5;
}

.timer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.timer-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark-gray);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.timer-display {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin: 1rem 0;
    font-family: 'Courier New', monospace;
    color: var(--accent-color);
}

.timer-display.warning {
    color: var(--warning-color);
    animation: pulse 1s infinite;
}

.timer-display.danger {
    color: var(--primary-color);
    animation: pulse 0.5s infinite;
}

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

.timer-progress {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin: 1rem 0;
}

.timer-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--success-color), var(--secondary-color));
    transition: width 1s ease;
    border-radius: 4px;
}

.timer-controls {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.control-btn {
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-btn.play {
    background: var(--success-color);
    color: var(--white);
}

.control-btn.pause {
    background: var(--warning-color);
    color: var(--dark-gray);
}

.control-btn.stop {
    background: var(--primary-color);
    color: var(--white);
}

.control-btn:hover {
    transform: translateY(-1px);
    opacity: 0.9;
}

/* Timeline */
.timeline-container {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-top: 2rem;
}

.timeline-container h3 {
    margin-bottom: 1rem;
    color: var(--dark-gray);
}

.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline-item {
    position: relative;
    padding: 1rem 0;
    border-left: 2px solid var(--secondary-color);
    margin-left: 1rem;
    padding-left: 2rem;
}

.timeline-item:last-child {
    border-left: none;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 1.5rem;
    width: 10px;
    height: 10px;
    background: var(--secondary-color);
    border-radius: 50%;
}

.timeline-item.current::before {
    background: var(--primary-color);
    animation: pulse 2s infinite;
}

.timeline-time {
    font-weight: 600;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

.timeline-dish {
    color: var(--dark-gray);
}

/* Templates */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.template-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.template-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.template-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.template-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark-gray);
}

.template-dishes {
    list-style: none;
}

.template-dishes li {
    padding: 0.25rem 0;
    color: var(--gray);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.template-time {
    font-weight: 600;
    color: var(--accent-color);
    margin-top: 1rem;
    text-align: center;
}

/* Settings */
.settings-group {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.settings-group h3 {
    margin-bottom: 1rem;
    color: var(--dark-gray);
    border-bottom: 2px solid var(--light-gray);
    padding-bottom: 0.5rem;
}

.setting-item {
    margin-bottom: 1rem;
}

.setting-item label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
}

.setting-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

.setting-item input[type="range"] {
    flex: 1;
    margin: 0 0.5rem;
    accent-color: var(--primary-color);
}

.setting-item select {
    padding: 0.5rem;
    border: 2px solid var(--light-gray);
    border-radius: 8px;
    font-size: 1rem;
    width: 100%;
    margin-top: 0.5rem;
}

.danger-btn {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.danger-btn:hover {
    background: #e55555;
    transform: translateY(-1px);
}

/* FAQ */
.faq-container {
    max-width: 800px;
}

.faq-item {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
    overflow: hidden;
}

.faq-question {
    width: 100%;
    background: none;
    border: none;
    padding: 1.5rem;
    text-align: left;
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark-gray);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s ease;
}

.faq-question:hover {
    background: var(--light-gray);
}

.faq-question[aria-expanded="true"] {
    background: var(--light-gray);
}

.faq-question[aria-expanded="true"] .faq-icon {
    transform: rotate(45deg);
}

.faq-icon {
    font-size: 1.25rem;
    font-weight: 300;
    transition: transform 0.3s ease;
}

.faq-answer {
    padding: 0 1.5rem 1.5rem;
    color: var(--gray);
    line-height: 1.6;
    animation: slideDown 0.3s ease;
}

.faq-answer[hidden] {
    display: none;
}

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

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

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    padding: 1.5rem;
    border-bottom: 2px solid var(--light-gray);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: var(--dark-gray);
    margin: 0;
}

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

.close-btn:hover {
    color: var(--primary-color);
}

.modal-body {
    padding: 1.5rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark-gray);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--light-gray);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

.primary-btn {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.primary-btn:hover {
    background: #e55555;
    transform: translateY(-1px);
}

/* Template List */
.template-list {
    display: grid;
    gap: 1rem;
}

.template-option {
    background: var(--light-gray);
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.template-option:hover {
    border-color: var(--primary-color);
    background: var(--white);
}

.template-option-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.template-option-title {
    font-weight: 600;
    color: var(--dark-gray);
}

.template-option-dishes {
    font-size: 0.9rem;
    color: var(--gray);
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-top: 1px solid var(--light-gray);
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    text-decoration: none;
    color: var(--gray);
    transition: all 0.3s ease;
    border-radius: 8px;
    min-width: 60px;
}

.nav-item:hover,
.nav-item.active {
    color: var(--primary-color);
    background: rgba(255, 107, 107, 0.1);
}

.nav-item i {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.nav-item span {
    font-size: 0.75rem;
    font-weight: 600;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--white);
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-header h1 {
        font-size: 1.25rem;
    }
    
    .sync-btn {
        padding: 0.5rem;
    }
    
    .sync-btn span {
        display: none;
    }
    
    .quick-actions {
        grid-template-columns: 1fr;
    }
    
    .timer-display {
        font-size: 1.75rem;
    }
    
    .templates-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }
    
    .form-actions {
        justify-content: stretch;
    }
    
    .primary-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .app-main {
        padding: 0.5rem;
    }
    
    .timer-card {
        padding: 1rem;
    }
    
    .timer-controls {
        flex-wrap: wrap;
    }
    
    .control-btn {
        flex: 1;
        min-width: 80px;
        justify-content: center;
    }
    
    .settings-group,
    .faq-item {
        margin-bottom: 0.5rem;
    }
    
    .nav-item span {
        font-size: 0.7rem;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --shadow: 0 2px 10px rgba(0,0,0,0.3);
    }
    
    .timer-card {
        border: 2px solid var(--gray);
    }
    
    .nav-item.active {
        background: var(--primary-color);
        color: var(--white);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
