/* ========== МОДАЛЬНЫЕ ОКНА ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
}

/* ========== ФОРМЫ ========== */
input, select, textarea {
    width: 100%;
    padding: 12px;
    background: var(--surface-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    margin-bottom: 12px;
}

button {
    background: var(--accent);
    border: none;
    padding: 12px;
    border-radius: var(--radius-md);
    color: white;
    font-weight: 600;
    font-size: var(--font-size-base);
    cursor: pointer;
    width: 100%;
    margin-top: 8px;
}

/* ========== TOAST ========== */
.demo-toast {
    position: fixed;
    bottom: 100px;
    left: 16px;
    right: 16px;
    background: var(--surface);
    border-radius: var(--radius-full);
    padding: 12px 20px;
    text-align: center;
    font-size: var(--font-size-small);
    box-shadow: var(--shadow);
    z-index: 200;
    border: 0.5px solid var(--border);
    transition: opacity 0.2s;
    pointer-events: none;
}

/* ========== ПЕРЕКЛЮЧАТЕЛЬ ========== */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border);
    transition: 0.2s;
    border-radius: 28px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: 0.2s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

/* ========== ПРИВЫЧКИ ========== */
.habit-item {
    background: var(--surface-secondary);
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ========== ГОЛОСОВОЙ ВВОД ========== */
.voice-wave {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 60px;
}

.wave-bar {
    width: 4px;
    height: 20px;
    background: var(--accent);
    border-radius: 2px;
    animation: wave 0.5s ease infinite alternate;
}

@keyframes wave {
    0% { height: 10px; }
    100% { height: 40px; }
}

.voice-hint {
    text-align: center;
    font-size: var(--font-size-small);
    color: var(--text-secondary);
    margin-top: 8px;
}

/* ========== КАРТОЧКА ЗАДАЧИ (ДЕТАЛИ) ========== */
.task-details-modal .task-detail-field {
    margin-bottom: 16px;
}

.task-details-modal label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.task-details-modal input,
.task-details-modal select {
    margin-bottom: 0;
}

.task-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.task-action-btn {
    flex: 1;
    min-width: 100px;
    padding: 10px;
    font-size: 14px;
}

.task-action-btn.save {
    background: var(--accent);
}

.task-action-btn.copy {
    background: var(--surface-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.task-action-btn.share {
    background: var(--success);
}

.task-action-btn.delete {
    background: var(--danger);
}

.task-action-btn.close {
    background: var(--surface-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.event-card {
    cursor: pointer;
    transition: transform 0.1s, opacity 0.1s;
}

.event-card:active {
    transform: scale(0.98);
    opacity: 0.8;
}

.empty-slot {
    cursor: pointer;
}

/* ========== BOTTOM SHEET (ВЫЕЗЖАЮЩАЯ ШТОРКА) ========== */
.bottom-sheet {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    visibility: hidden;
    display: flex;
    align-items: flex-end;
}

.bottom-sheet.open {
    visibility: visible;
}

.bottom-sheet-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.bottom-sheet.open .bottom-sheet-overlay {
    opacity: 1;
}

.bottom-sheet-container {
    position: relative;
    width: 100%;
    background: var(--surface);
    border-radius: 28px 28px 0 0;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
}

.bottom-sheet.open .bottom-sheet-container {
    transform: translateY(0);
}

.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 12px auto 8px;
    cursor: grab;
}

.bottom-sheet-handle:active {
    cursor: grabbing;
}

.bottom-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px 8px;
    border-bottom: 0.5px solid var(--border);
}

.bottom-sheet-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.bottom-sheet-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 8px;
    margin: -8px;
    width: auto;
}

.bottom-sheet-body {
    padding: 20px;
}

.form-field {
    margin-bottom: 16px;
}

.form-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-field label i {
    margin-right: 6px;
    width: 16px;
}

.form-field input,
.form-field select {
    margin-bottom: 0;
}

.bottom-sheet-footer {
    padding: 16px 20px 24px;
    border-top: 0.5px solid var(--border);
}

.task-actions-sheet {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.sheet-btn {
    flex: 1;
    padding: 12px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    text-align: center;
    margin-top: 0;
}

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

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

.copy-btn {
    background: var(--surface-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

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

.cancel-btn {
    background: var(--surface-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    width: 100%;
}

/* Стили для полей ввода даты и времени */
input[type="date"],
input[type="time"] {
    font-family: var(--font-family);
}

/* Адаптация под маленькие экраны */
@media (max-width: 480px) {
    .bottom-sheet-container {
        max-height: 90vh;
    }
    
    .task-actions-sheet {
        flex-direction: column;
    }
    
    .sheet-btn {
        width: 100%;
    }
}

/* Стили для bottom sheet выбора даты (календарь) */
.calendar-picker-modal .month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    text-align: center;
}
.calendar-picker-modal .cal-day {
    padding: 10px 0;
    border-radius: 30px;
    cursor: pointer;
}
.calendar-picker-modal .cal-day.selected {
    background: var(--accent);
    color: white;
}