/* 
 * TODO-лист - Кастомные стили и темы
 * Использует CSS переменные для динамического переключения тем
 */

/* ========== БАЗОВЫЕ СТИЛИ ========== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Корневые переменные (фоллбек для accent RGB) */
:root {
    --accent-rgb: 2, 136, 209;
    /* fallback RGB (sea) */
}

body {
    font-family: 'Manrope', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-optical-sizing: auto;
    line-height: 1.6;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

/* Manrope utility classes: use .manrope or .manrope-<weight> to set font-weight */
.manrope {
    font-family: 'Manrope', sans-serif;
    font-optical-sizing: auto;
    font-style: normal;
}

.manrope-200 {
    font-family: 'Manrope', sans-serif;
    font-optical-sizing: auto;
    font-weight: 200;
}

.manrope-300 {
    font-family: 'Manrope', sans-serif;
    font-optical-sizing: auto;
    font-weight: 300;
}

.manrope-400 {
    font-family: 'Manrope', sans-serif;
    font-optical-sizing: auto;
    font-weight: 400;
}

.manrope-500 {
    font-family: 'Manrope', sans-serif;
    font-optical-sizing: auto;
    font-weight: 500;
}

.manrope-600 {
    font-family: 'Manrope', sans-serif;
    font-optical-sizing: auto;
    font-weight: 600;
}

.manrope-700 {
    font-family: 'Manrope', sans-serif;
    font-optical-sizing: auto;
    font-weight: 700;
}

.manrope-800 {
    font-family: 'Manrope', sans-serif;
    font-optical-sizing: auto;
    font-weight: 800;
}

/* Example usage:
   <h2 class="manrope manrope-600">Заголовок</h2>
   Body text uses Manrope by default.
*/

/* ========== ЦВЕТОВЫЕ ТЕМЫ ========== */

/* Тема: Морская */
body[data-theme="sea"] {
    --bg-primary: #e0f2f7;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #0d47a1;
    --text-secondary: #1565c0;
    --accent: #0288d1;
    --accent-rgb: 2, 136, 209;
    --accent-hover: #0277bd;
    --border: #81d4fa;
    --shadow: rgba(2, 136, 209, 0.1);
    --success: #00897b;
    --danger: #d32f2f;
    --warning: #f57c00;
}

/* Тема: Orange Juice */
body[data-theme="orange"] {
    /* Dark-gray + Orange accent theme (matches contrast of dark/purple theme) */
    --bg-primary: #1a1a1a;
    /* dark page background */
    --bg-secondary: #262626;
    /* slightly lighter surface */
    --bg-card: #2d2d2d;
    /* card background */
    --text-primary: #e6e6e6;
    /* main readable text */
    --text-secondary: #bdbdbd;
    /* secondary text */
    --accent: #ff6d00;
    --accent-rgb: 255, 109, 0;
    /* orange accent */
    --accent-hover: #ff7f2a;
    /* accent on hover */
    --border: #3f3f3f;
    /* muted border */
    --shadow: rgba(0, 0, 0, 0.5);
    --success: #66bb6a;
    --danger: #ef5350;
    --warning: #ffb74d;
}

/* Тема: Тиффани */
body[data-theme="tiffany"] {
    --bg-primary: #e0f2f1;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #004d40;
    --text-secondary: #00695c;
    --accent: #00897b;
    --accent-rgb: 0, 137, 123;
    --accent-hover: #00796b;
    --border: #80cbc4;
    --shadow: rgba(0, 137, 123, 0.1);
    --success: #43a047;
    --danger: #e53935;
    --warning: #fb8c00;
}

/* Тема: Тёмная */
body[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-card: #2d2d2d;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --accent: #bb86fc;
    --accent-rgb: 187, 134, 252;
    --accent-hover: #a56de2;
    --border: #404040;
    --shadow: rgba(0, 0, 0, 0.5);
    --success: #4caf50;
    --danger: #ef5350;
    --warning: #ffa726;
}

/* Тема: Светлая */
body[data-theme="light"] {
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #212121;
    --text-secondary: #424242;
    --accent: #2196f3;
    --accent-rgb: 33, 150, 243;
    --accent-hover: #1976d2;
    --border: #e0e0e0;
    --shadow: rgba(0, 0, 0, 0.08);
    --success: #4caf50;
    --danger: #f44336;
    --warning: #ff9800;
}

/* Тема: Пшеница */
body[data-theme="wheat"] {
    --bg-primary: #faf8f3;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #5d4037;
    --text-secondary: #6d4c41;
    --accent: #8d6e63;
    --accent-rgb: 141, 110, 99;
    --accent-hover: #795548;
    --border: #d7ccc8;
    --shadow: rgba(141, 110, 99, 0.1);
    --success: #7cb342;
    --danger: #e64a19;
    --warning: #ffa000;
}

/* ========== КОМПОНЕНТЫ ========== */

/* Карточки */
.card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px var(--shadow);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 8px 12px var(--shadow);
    transform: translateY(-2px);
}

/* Заголовок */
.title-text {
    color: var(--accent);
    text-shadow: 2px 2px 4px var(--shadow);
}

/* Поля ввода */
.input-field {
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    color: var(--text-primary);
    transition: all 0.3s ease;
    font-size: 1rem;
}

.input-field:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.1);
}

.input-field::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

/* Кнопки */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

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

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

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

.btn-success:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* Переключатель тем */
.theme-selector {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.theme-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.theme-btn:hover {
    transform: scale(1.1);
    border-color: var(--accent);
}

.theme-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: scale(1.15);
}

/* Задачи */
.task-item {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.5rem;
    border: 2px solid var(--border);
    transition: all 0.3s ease;
    animation: slideIn 0.3s ease;
}

.task-item:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px var(--shadow);
}

.task-item.completed {
    opacity: 0.7;
}

.task-item.completed .task-title {
    text-decoration: line-through;
    opacity: 0.6;
}

.task-title {
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.task-description {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.task-meta {
    color: var(--text-secondary);
    font-size: 0.875rem;
    opacity: 0.8;
}

/* Бейджи статуса */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

.status-badge.pending {
    background: var(--warning);
    color: white;
}

.status-badge.completed {
    background: var(--success);
    color: white;
}

/* Статистика */
.stat-badge {
    background: var(--bg-card);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
}

/* Модальное окно */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

/* Уведомления */
.notification {
    background: var(--bg-card);
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    padding: 1rem;
    min-width: 300px;
    box-shadow: 0 4px 12px var(--shadow);
    animation: slideInRight 0.3s ease;
    margin-bottom: 0.5rem;
}

.notification.success {
    border-left-color: var(--success);
}

.notification.error {
    border-left-color: var(--danger);
}

.notification.warning {
    border-left-color: var(--warning);
}

/* ========== АНИМАЦИИ ========== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========== АДАПТИВНОСТЬ ========== */

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .card {
        padding: 1rem;
    }

    .task-item {
        padding: 1rem;
    }

    .modal-content {
        padding: 1.5rem;
    }

    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
}

/* ========== ДОПОЛНИТЕЛЬНЫЕ УТИЛИТЫ ========== */

.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(100px);
    }
}

/* Скроллбар */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 5px;
}

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

/* ========== CALENDAR HEATMAP ========== */
.calendar {
    display: flex;
    gap: 6px;
    align-items: flex-start;
    overflow-x: auto;
    padding-bottom: 6px;
}

.calendar .week {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.calendar .day {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
}

.calendar .day:hover {
    transform: scale(1.15);
    transition: transform 0.12s ease;
}

.legend-item {
    margin-right: 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px
}

.legend-box {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid var(--border);
    vertical-align: middle
}

.heat-1 {
    background: rgba(var(--accent-rgb), 0.18) !important;
}

.heat-2 {
    background: rgba(var(--accent-rgb), 0.32) !important;
}

.heat-3 {
    background: rgba(var(--accent-rgb), 0.56) !important;
}

.heat-4 {
    background: rgba(var(--accent-rgb), 0.85) !important;
}