/* Базовые стили и переменные */
:root {
    --bg-color: #f0f4f8; --card-bg-color: #ffffff; --text-color: #1c1c1e;
    --label-color: #8a8a8e; --placeholder-color: #c7c7cc; --border-color: #e5e5ea;
    --yellow-color: #ff9f0a; --red-color: #ff3b30;
}
body {
    margin: 0; font-family: 'Inter', -apple-system, sans-serif; background-color: var(--bg-color);
    color: var(--text-color); display: flex; justify-content: center; align-items: flex-start;
    padding: 20px; min-height: 100vh; box-sizing: border-box;
}
.screen-container { width: 100%; max-width: 400px; }

/* Форма */
.task-form { background-color: var(--card-bg-color); border-radius: 20px; padding: 16px; box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.form-header { display: flex; align-items: center; text-align: center; margin-bottom: 24px; position: relative; }
.form-header h1 { font-size: 18px; font-weight: 600; margin: 0; flex-grow: 1; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 14px; color: var(--text-color); margin-bottom: 8px; font-weight: 500; }
.form-group input, .form-group textarea {
    width: 100%; padding: 12px; border: 1px solid var(--border-color); border-radius: 10px;
    background-color: #f8f8f8; font-size: 16px; box-sizing: border-box; font-family: 'Inter', sans-serif;
}
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--placeholder-color); }
.form-group textarea { resize: vertical; }

/* Интерактивные строки списка */
.list-item { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--border-color); cursor: pointer; font-size: 16px; }
.list-item:last-of-type { border-bottom: none; }
.list-item .value { display: flex; align-items: center; gap: 8px; color: var(--label-color); }
.list-item .value.has-value span:not(.chevron) { color: var(--text-color); }
.chevron { font-size: 24px; color: var(--placeholder-color); font-weight: bold; }
.badge { background-color: #fff0db; color: var(--yellow-color); padding: 4px 12px; border-radius: 12px; font-size: 14px; font-weight: 500; }

/* Переключатели */
.segmented-control { display: flex; width: 100%; background-color: #f0f0f0; border-radius: 10px; padding: 3px; }
.segmented-control button { flex: 1; padding: 8px; border: none; background-color: transparent; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; transition: background-color 0.2s, color 0.2s; color: var(--text-color); }
#energy-control button.active { background-color: var(--yellow-color); color: white; }
#status-control button.active { background-color: var(--red-color); color: white; }

/* Общие стили для модальных окон */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.4); display: flex; justify-content: center; align-items: center; z-index: 1000; opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0.3s ease; }
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-content { background-color: var(--card-bg-color); border-radius: 20px; padding: 20px; width: 90%; max-width: 350px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); transform: translateY(20px); opacity: 0; transition: transform 0.3s ease, opacity 0.3s ease; }
.modal-overlay.active .modal-content { transform: translateY(0); opacity: 1; }
.modal-action-btn { width: 100%; padding: 16px; background-color: var(--yellow-color); color: white; border: none; border-radius: 16px; font-size: 18px; font-weight: 600; cursor: pointer; margin-top: 10px; }
.modal-header { text-align: center; margin-bottom: 20px; }
.modal-header h1 { font-size: 18px; font-weight: 600; margin: 0; }

/* Стили для экрана загрузки (SPLASH SCREEN) */
.splash-screen { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 10000; background-color: var(--tg-theme-bg-color); display: flex; justify-content: center; align-items: center; transition: opacity 0.5s ease, visibility 0.5s ease; opacity: 1; visibility: visible; }
.splash-screen img, .splash-screen video { max-width: 80%; max-height: 80%; object-fit: contain; }
.splash-screen.hidden { opacity: 0; visibility: hidden; }

/* Стили для модального окна КАЛЕНДАРЯ */
.calendar-header { display: flex; justify-content: space-between; align-items: center; font-size: 18px; font-weight: 600; }
.month-year-container { display: flex; gap: 8px; justify-content: center; flex-grow: 1; }
.month-trigger, .year-trigger { padding: 5px 10px; border-radius: 8px; cursor: pointer; transition: background-color 0.2s ease; }
.month-trigger:hover, .year-trigger:hover { background-color: #f0f0f0; }
.calendar-header .nav-arrow { font-size: 24px; color: var(--label-color); cursor: pointer; user-select: none; padding: 5px 10px; border-radius: 8px; transition: background-color 0.2s ease; }
.calendar-header .nav-arrow:hover { background-color: #f0f0f0; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; text-align: center; font-size: 15px; margin-top: 20px; }
.day-label { font-weight: 500; color: var(--label-color); }
.day { border-radius: 50%; cursor: pointer; transition: background-color 0.2s, color 0.2s; font-weight: 400; aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; }
.day.empty { visibility: hidden; }
.day.red { color: var(--red-color); }
.day.active { background-color: var(--yellow-color); color: white; font-weight: 500; }
.day:not(.empty):not(.active):hover { background-color: #f0f0f0; }
.day.disabled { color: #d1d1d6; cursor: not-allowed; pointer-events: none; }
.month-grid, .year-grid { grid-template-columns: repeat(3, 1fr); gap: 15px; }
.month, .year { padding: 12px 5px; border-radius: 8px; cursor: pointer; transition: background-color 0.2s ease; font-size: 16px; text-align: center; }
.month:hover, .year:hover { background-color: #f0f0f0; }
.month.active, .year.active { background-color: var(--yellow-color); color: white; font-weight: 500; }
.time-picker { display: flex; justify-content: center; align-items: center; margin: 30px 0; font-size: 36px; font-weight: 600; }
.time-col { display: flex; flex-direction: column; height: 120px; overflow-y: scroll; scrollbar-width: none; text-align: center; padding: 0 10px; mask-image: linear-gradient(to bottom, transparent 0%, black 35%, black 65%, transparent 100%); }
.time-col::-webkit-scrollbar { display: none; }
.time-hour, .time-minute { padding: 5px 0; opacity: 0.5; transition: opacity 0.2s; cursor: pointer; line-height: 1.2; }
.time-hour.selected, .time-minute.selected { opacity: 1; font-weight: 700; color: var(--yellow-color); }
.time-hour.disabled, .time-minute.disabled { color: #d1d1d6; cursor: not-allowed; pointer-events: none; }
.time-separator { margin: 0 10px; opacity: 0.5; }

/* Стили для модального окна НАПОМИНАНИЙ */
.reminders-list { list-style: none; padding: 0; margin: 0 0 20px 0; border-top: 1px solid var(--border-color); }
.reminders-list li { padding: 14px 10px; border-bottom: 1px solid var(--border-color); cursor: pointer; position: relative; transition: background-color 0.2s ease; font-size: 16px; }
.reminders-list li:hover { background-color: #f8f8f8; }
.reminders-list li.selected::after { content: '✔'; color: var(--yellow-color); position: absolute; right: 15px; font-weight: bold; }
.custom-reminder-form { margin-bottom: 25px; }
.custom-reminder-form label { display: block; font-size: 14px; color: var(--text-color); margin-bottom: 8px; font-weight: 500; }
.custom-reminder-input-group { display: flex; gap: 10px; }
.custom-reminder-input-group input, .custom-reminder-input-group select { padding: 10px; border: 1px solid var(--border-color); border-radius: 10px; background-color: #f8f8f8; font-size: 16px; font-family: 'Inter', sans-serif; }
.custom-reminder-input-group input { width: 60px; }
.custom-reminder-input-group select { flex-grow: 1; }
.custom-reminder-input-group button { padding: 10px 15px; border: none; background-color: var(--yellow-color); color: white; font-size: 14px; font-weight: 500; border-radius: 10px; cursor: pointer; }
.selected-reminders-container { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; min-height: 20px; }
.reminder-chip { display: flex; align-items: center; gap: 8px; background-color: #fff0db; color: var(--yellow-color); padding: 6px 12px; border-radius: 16px; font-size: 14px; font-weight: 500; }
.reminder-chip .remove-chip { cursor: pointer; font-weight: bold; }
#reminders-value { flex-grow: 1; justify-content: flex-end; flex-wrap: wrap; gap: 6px; margin-right: -8px; }
.reminder-tag { background-color: #fff0db; color: var(--yellow-color); padding: 4px 10px; border-radius: 12px; font-size: 14px; font-weight: 500; white-space: nowrap; }

/* Стили для модального окна ПОВТОРЕНИЯ */
.custom-repetition-form { border-top: 1px solid var(--border-color); padding-top: 20px; margin-top: 10px; display: flex; flex-direction: column; gap: 25px; }
.repetition-form-row { display: flex; align-items: center; justify-content: space-between; }
.repetition-form-row label { font-size: 16px; margin: 0; }
.interval-input-wrapper { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border-color); padding: 8px 12px; border-radius: 10px; background-color: #f8f8f8; }
.interval-input-wrapper input { border: none; background: none; width: 40px; text-align: center; font-size: 16px; font-family: 'Inter', sans-serif; padding: 0; }
.interval-input-wrapper input::-webkit-outer-spin-button, .interval-input-wrapper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.interval-input-wrapper input[type=number] { -moz-appearance: textfield; }
.repetition-form-row select { border: 1px solid var(--border-color); padding: 8px 12px; border-radius: 10px; background-color: #f8f8f8; font-size: 16px; font-family: 'Inter', sans-serif; }
.repetition-form-row.contextual { flex-direction: column; align-items: flex-start; gap: 15px; }
.repetition-week-days { display: flex; justify-content: space-between; gap: 5px; margin-top: 5px; width: 100%; }
.repetition-week-days button { flex: 1; aspect-ratio: 1 / 1; border-radius: 50%; border: 1px solid var(--border-color); background-color: transparent; cursor: pointer; font-weight: 500; transition: background-color 0.2s, color 0.2s, border-color 0.2s; }
.repetition-week-days button.active { background-color: var(--yellow-color); color: white; border-color: var(--yellow-color); }
.yearly-input-wrapper { display: flex; gap: 10px; }
.yearly-input-wrapper input { width: 60px; }

/* Стили для модального окна ВРЕМЕНИ НА ВЫПОЛНЕНИЕ */
.duration-form { display: flex; justify-content: center; gap: 20px; margin: 30px 0; }
.duration-input-group { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.duration-input-group input { width: 80px; padding: 12px; border: 1px solid var(--border-color); border-radius: 10px; background-color: #f8f8f8; font-size: 24px; text-align: center; font-weight: 500; }
.duration-input-group label { font-size: 14px; color: var(--label-color); }