:root {
    --bg-primary: #000000;
    --bg-secondary: #1c1c1e;
    --text-primary: #ffffff;
    --text-secondary: #8e8e93;
    --accent: #0a84ff;
    --danger: #ff453a;
    --weekend-color: #ff453a; /* Красный для выходных */
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0; padding: 0;
    overflow: hidden; height: 100vh;
    user-select: none; -webkit-tap-highlight-color: transparent;
}

#app {
    position: relative; height: 100%; width: 100%;
    display: flex; flex-direction: column;
}

/* --- HEADER --- */
.custom-calendar-header {
    padding: 15px 20px 10px 20px;
    background: var(--bg-primary);
}
.custom-calendar-header h2 {
    margin: 0; font-size: 22px; font-weight: 700; text-transform: capitalize;
}

/* --- CALENDAR GRID --- */
.calendar-wrapper {
    background: var(--bg-primary);
    padding: 0 10px 10px 10px;
    flex-shrink: 0;
    overflow: hidden;
    transition: all 0.3s ease; /* Плавность сворачивания */
}

.weekdays-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    margin-bottom: 5px;
}
.weekdays-row div {
    font-size: 12px; font-weight: 500; color: var(--text-secondary); text-transform: uppercase;
}
.weekdays-row div.weekend { color: var(--weekend-color); opacity: 0.8; }

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    /* Уменьшили отступы между строками */
    row-gap: 2px; 
}

/* Ячейка дня */
.day-cell {
    height: 42px; /* Компактная высота */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    border-radius: 8px;
}

.day-number {
    font-size: 19px; /* Крупные цифры */
    font-weight: 500;
    z-index: 2;
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
}

/* Цвета дней */
.day-cell.weekend .day-number { color: var(--weekend-color); }
.day-cell.other-month { opacity: 0.3; }

/* Сегодня */
.day-cell.today .day-number {
    background-color: rgba(10, 132, 255, 0.2);
    color: var(--accent);
    font-weight: 700;
}

/* Выбранный день */
.day-cell.selected .day-number {
    background-color: var(--accent);
    color: white !important; /* Перекрываем красный цвет выходных */
    box-shadow: 0 2px 8px rgba(10, 132, 255, 0.5);
}

/* Точки событий */
.dots-container {
    display: flex; gap: 3px; position: absolute; bottom: 3px;
}
.dot { width: 4px; height: 4px; border-radius: 50%; }


/* --- ЛОГИКА СВОРАЧИВАНИЯ (COLLAPSE) --- */
/* Когда календарь свернут, мы скрываем "лишние" недели через JS-классы */
.calendar-grid.collapsed .week-row-hidden {
    display: none;
}


/* --- TASKS SHEET --- */
.tasks-sheet {
    background-color: var(--bg-secondary);
    flex-grow: 1;
    border-top-left-radius: 24px; border-top-right-radius: 24px;
    padding: 0 16px;
    display: flex; flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative; z-index: 2;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
    margin-top: 5px;
}
.sheet-header {
    position: sticky; top: 0; background: var(--bg-secondary);
    padding-top: 12px; padding-bottom: 10px; z-index: 3;
}
.drag-handle {
    width: 36px; height: 4px; background-color: #3a3a3c;
    border-radius: 2px; margin: 0 auto 15px auto;
}
.sheet-header h2 { font-size: 20px; font-weight: 700; margin: 0; }

.task-list { list-style: none; padding: 0; margin: 0; padding-bottom: 20px; }
.task-item {
    background-color: #2c2c2e; border-radius: 16px; padding: 14px 16px;
    margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between;
}
.task-time { color: var(--text-secondary); font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.task-text { font-size: 16px; font-weight: 400; }
.check-btn {
    width: 26px; height: 26px; border: 2px solid #48484a;
    border-radius: 50%; background: transparent; cursor: pointer; flex-shrink: 0;
}

/* Кнопка внизу */
.bottom-actions { margin-top: 10px; margin-bottom: 20px; display: flex; justify-content: center; }
.simple-btn {
    background: transparent; color: var(--text-secondary); border: none;
    padding: 10px 24px; font-size: 14px; font-weight: 500; cursor: pointer;
    display: flex; align-items: center; gap: 8px; opacity: 0.8;
}
.safe-area-bottom { height: 40px; }

/* Animation Classes */
.slide-next-enter { animation: slideInRight 0.25s forwards; }
.slide-prev-enter { animation: slideInLeft 0.25s forwards; }
@keyframes slideInRight { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideInLeft { from { transform: translateX(-20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* --- SETTINGS STYLES --- */

.view {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-primary);
    display: none; flex-direction: column;
    /* Для анимации слайда */
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); 
    z-index: 10;
}
.view.active { display: flex; transform: translateX(0); }
/* Класс для скрытого справа экрана (перед показом) */
.view.next-screen { display: flex; transform: translateX(100%); }

.header {
    padding: 12px 8px;
    display: flex; align-items: center; justify-content: space-between;
    background: var(--bg-primary);
    z-index: 20;
}
.icon-btn {
    background: none; border: none; color: var(--accent);
    padding: 10px; cursor: pointer; display: flex;
}

.settings-scroll-container {
    flex-grow: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
}

.settings-header-label {
    padding: 20px 16px 8px 16px;
    font-size: 13px; color: var(--text-secondary);
    text-transform: uppercase; font-weight: 500;
}

.settings-group {
    background-color: var(--bg-secondary);
    margin: 0 16px; border-radius: 12px; overflow: hidden;
}

.setting-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 16px; border-bottom: 1px solid var(--separator);
    font-size: 17px; color: var(--text-primary);
    position: relative;
}
.setting-item:last-child { border: none; }

/* Inputs & Selects */
.setting-item input[type="time"],
.setting-item select {
    background: transparent; border: none; color: var(--accent);
    font-size: 17px; font-family: inherit; text-align: right;
    outline: none;
}

.link-btn {
    background: none; border: none; color: var(--accent);
    font-size: 15px; font-weight: 600; cursor: pointer;
}

/* Checkboxes iOS Style */
.checkbox-item { cursor: pointer; }
.checkbox-item input { display: none; } /* Hide native checkbox */
.checkmark {
    width: 20px; height: 20px;
    border-radius: 50%; border: 2px solid var(--text-secondary);
    position: relative; transition: all 0.2s;
}
.checkbox-item input:checked + .checkmark {
    background-color: var(--accent); border-color: var(--accent);
}
.checkbox-item input:checked + .checkmark::after {
    content: ''; position: absolute;
    left: 6px; top: 2px; width: 5px; height: 10px;
    border: solid white; border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.setting-info {
    padding: 20px; color: var(--text-secondary);
    font-size: 13px; text-align: center;
}