/* Сброс стилей */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Основные стили */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #1f2937;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Sidebar Menu */
.sidebar {
    position: fixed;
    top: 0;
    left: -300px;
    width: 300px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1);
    transition: left 0.3s ease;
    z-index: 2000;
    overflow-y: auto;
}

.sidebar.open {
    left: 0;
}

.sidebar-header {
    padding: 30px 20px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.sidebar-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 5px;
}

.sidebar-subtitle {
    font-size: 14px;
    opacity: 0.9;
}

.sidebar-nav {
    padding: 20px 0;
}

.nav-item {
    display: block;
    padding: 15px 20px;
    color: #374151;
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-item:hover {
    background: rgba(102, 126, 234, 0.1);
    border-left-color: #667eea;
    color: #667eea;
}

.nav-item.active {
    background: rgba(102, 126, 234, 0.15);
    border-left-color: #667eea;
    color: #667eea;
    font-weight: 600;
}

.nav-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.menu-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 12px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 2001;
    backdrop-filter: blur(10px);
}

.menu-toggle:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.menu-toggle svg {
    width: 20px;
    height: 20px;
    color: #6b7280;
    transition: transform 0.3s ease;
}

.menu-toggle.open svg {
    transform: rotate(90deg);
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1999;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Кнопка в главное меню */
.home-button {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    backdrop-filter: blur(10px);
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
}

.home-button:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.home-button svg {
    width: 20px;
    height: 20px;
}

/* Контейнер */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Заголовок */
.header {
    text-align: center;
    margin-bottom: 40px;
}

.title {
    font-size: 36px;
    font-weight: 700;
    color: white;
    margin-bottom: 24px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Переключатель режимов */
.mode-switcher {
    display: flex;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 4px;
    backdrop-filter: blur(10px);
}

.mode-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
}

.mode-btn.active {
    background: white;
    color: #667eea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mode-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
}

/* Контейнер таймера */
.timer-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    text-align: center;
    width: 100%;
    max-width: 500px;
}

/* Круговой прогресс */
.progress-circle {
    position: relative;
    width: 280px;
    height: 280px;
    margin: 0 auto 40px;
}

.progress-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.progress-bg {
    fill: none;
    stroke: #f1f5f9;
    stroke-width: 8;
}

.progress-bar {
    fill: none;
    stroke: url(#gradient);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 565.48;
    stroke-dashoffset: 565.48;
    transition: stroke-dashoffset 0.3s ease;
}

/* Градиент для прогресс-бара */
.progress-svg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.progress-svg defs {
    display: none;
}

.progress-bar {
    stroke: #667eea;
}

/* Отображение времени */
.time-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.time-text {
    font-size: 48px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 8px;
    font-variant-numeric: tabular-nums;
    letter-spacing: -1px;
}

.time-label {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

/* Настройка времени */
.time-controls {
    margin-bottom: 32px;
}

.time-input-group {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 24px;
}

.time-input {
    text-align: center;
}

.time-input label {
    display: block;
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 8px;
    font-weight: 500;
}

.time-input input {
    width: 80px;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s ease;
    background: white;
}

.time-input input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Предустановки */
.presets {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.preset-btn {
    padding: 8px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-btn:hover {
    border-color: #667eea;
    color: #667eea;
    background: #f8fafc;
}

.preset-btn:active {
    transform: scale(0.95);
}

/* Кнопки управления */
.controls {
    display: flex;
    gap: 16px;
    justify-content: center;
    align-items: center;
    margin-bottom: 24px;
}

.control-btn {
    padding: 16px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.control-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.control-btn:hover::before {
    left: 100%;
}

.control-btn.primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    min-width: 120px;
}

.control-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.control-btn.secondary {
    background: white;
    color: #6b7280;
    border: 2px solid #e5e7eb;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.control-btn.secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.control-btn:active {
    transform: scale(0.95);
}

.control-btn svg {
    transition: all 0.2s ease;
}

.hidden {
    display: none !important;
}

/* Статистика */
.stats {
    display: flex;
    gap: 24px;
    justify-content: center;
    margin-bottom: 24px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
}

.stat-item {
    text-align: center;
}

.stat-label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
    font-weight: 500;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
}

/* Кнопка круга */
.lap-btn {
    padding: 12px 20px;
    border: 2px solid #667eea;
    border-radius: 10px;
    background: white;
    color: #667eea;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto;
}

.lap-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Список кругов */
.laps-list {
    margin-top: 32px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 24px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 500px;
}

.laps-list h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 16px;
    text-align: center;
}

.laps-container {
    max-height: 200px;
    overflow-y: auto;
}

.lap-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 8px;
    background: #f8fafc;
    transition: all 0.2s ease;
}

.lap-item:hover {
    background: #f1f5f9;
}

.lap-item.best {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.lap-number {
    font-weight: 600;
    color: #6b7280;
}

.lap-item.best .lap-number {
    color: white;
}

.lap-time {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* Модальные окна */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.modal-overlay:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s ease;
    overflow: hidden;
}

.modal-overlay:not(.hidden) .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 32px 24px 16px;
    text-align: center;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
}

.completion-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.completion-icon svg {
    color: white;
}

.modal-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
}

.modal-body {
    padding: 24px;
    text-align: center;
}

.modal-body p {
    color: #6b7280;
    font-size: 16px;
    line-height: 1.6;
}

.modal-actions {
    padding: 16px 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: white;
    color: #6b7280;
    border: 2px solid #e5e7eb;
}

.btn-secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

/* Уведомления */
.notifications {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.notification {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-left: 4px solid #10b981;
    max-width: 300px;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

.notification.show {
    transform: translateX(0);
}

.notification.error {
    border-left-color: #ef4444;
}

.notification.warning {
    border-left-color: #f59e0b;
}

/* Анимации */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.timer-running .progress-circle {
    animation: pulse 2s infinite;
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% { transform: translate3d(0,0,0); }
    40%, 43% { transform: translate3d(0,-8px,0); }
    70% { transform: translate3d(0,-4px,0); }
    90% { transform: translate3d(0,-2px,0); }
}

.completion-icon {
    animation: bounce 1s ease-in-out;
}

/* Адаптивность */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .title {
        font-size: 28px;
    }
    
    .timer-container {
        padding: 24px;
    }
    
    .progress-circle {
        width: 240px;
        height: 240px;
    }
    
    .time-text {
        font-size: 36px;
    }
    
    .controls {
        flex-direction: column;
        gap: 12px;
    }
    
    .control-btn {
        width: 100%;
        justify-content: center;
    }
    
    .time-input-group {
        gap: 16px;
    }
    
    .time-input input {
        width: 70px;
        font-size: 16px;
    }
    
    .presets {
        gap: 8px;
    }
    
    .preset-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .stats {
        gap: 16px;
        padding: 16px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .back-button {
        top: 10px;
        left: 10px;
        width: 40px;
        height: 40px;
    }
    
    .home-button {
        top: 10px;
        right: 10px;
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .home-button span {
        display: none;
    }
    
    .progress-circle {
        width: 200px;
        height: 200px;
    }
    
    .time-text {
        font-size: 28px;
    }
    
    .mode-switcher {
        padding: 2px;
    }
    
    .mode-btn {
        padding: 8px 16px;
        font-size: 12px;
    }
}