/* ===========================
   Your-Plan - Main Styles
   Telegram Mini App
   =========================== */

/* CSS Variables */
:root {
    /* Colors */
    --color-primary-bg: #1c1b1c;
    --color-secondary-bg: #292929;
    --color-card-bg: #292929;
    --color-border: #2A2A2E;
    --color-text-primary: #EDEDED;
    --color-text-secondary: #B0B0B0;
    --color-gold: #daff62;
    
    /* Spacing */
    --spacing-xs: 8px;
    --spacing-sm: 12px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    
    /* Avatar */
    --avatar-size: 44px;
    
    /* Border Radius */
    --radius-full: 50%;
    --radius-md: 8px;
    
    /* Shadows */
    --shadow-subtle: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--color-primary-bg);
    color: var(--color-text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Предотвращение скролла при загрузке */
body.loading {
    overflow: hidden;
}

/* Блокировка скролла при открытой модалке */
body.modal-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* ===========================
   Page Loader / Full Screen Loader
   =========================== */

.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--color-primary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.page-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Spinner Animation */
.loader-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(201, 162, 77, 0.2);
    border-top-color: var(--color-gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* App Container */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    opacity: 1;
    visibility: visible;
}

/* ===========================
   Hero Header / User Identity Block
   =========================== */

.hero-header {
    padding: var(--spacing-md) var(--spacing-lg);
    position: sticky;
    top: 0;
    z-index: 100;
}

.user-identity {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    max-width: 1200px;
    margin: 0 auto;
}

/* User Avatar */
.user-avatar {
    width: var(--avatar-size);
    height: var(--avatar-size);
    border-radius: var(--radius-full);
    background-color: var(--color-card-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-letter {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-gold);
    text-transform: uppercase;
    user-select: none;
}

/* User Name */
.user-name {
    font-size: 16px;
    font-weight: 500;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: var(--spacing-lg);
    padding-bottom: calc(var(--spacing-lg) + 70px); /* Отступ для bottom-nav */
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* ===========================
   Bottom Navigation / Primary App Navigation
   =========================== */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background-color: var(--color-secondary-bg);
    border-top: 1px solid var(--color-border);
    border-radius: 20px 20px 0 0;
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
    z-index: 1000;
}

.nav-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    min-width: 60px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

/* Иконки */
.nav-item i {
    width: 24px;
    height: 24px;
    color: var(--color-text-secondary);
    transition: color 0.15s ease;
}

.nav-item.active i {
    color: var(--color-gold);
}

/* SVG иконки Lucide */
.nav-item svg {
    width: 24px;
    height: 24px;
    stroke: var(--color-text-secondary);
    fill: none;
    transition: stroke 0.15s ease;
}

.nav-item.active svg {
    stroke: var(--color-gold);
}

/* Текст для активного пункта меню */
.nav-item .nav-label {
    display: none;
}

.nav-item.active {
    background-color: var(--color-gold);
    border-radius: 12px;
    padding: 10px 20px;
    flex-direction: row;
    gap: 8px;
    min-width: auto;
}

.nav-item.active .nav-label {
    display: block;
    color: var(--color-primary-bg);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.nav-item.active svg {
    stroke: var(--color-primary-bg);
    width: 20px;
    height: 20px;
}

/* ===========================
   Secondary Header / Page Header
   =========================== */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-lg);
    background-color: var(--color-primary-bg);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Заголовок страницы */
.page-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: center;
}

.page-title i,
.page-title svg {
    width: 20px;
    height: 20px;
    color: var(--color-gold);
    stroke: var(--color-gold);
    flex-shrink: 0;
}

.page-title h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Спейсер для симметрии */
.header-spacer {
    width: 40px;
    flex-shrink: 0;
}

/* ===========================
   Calendar Widget
   =========================== */

.calendar-widget {
    background-color: var(--color-secondary-bg);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    border: 1px solid var(--color-border);
}

/* Calendar Header */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-lg);
}

.calendar-month {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text-primary);
    text-align: center;
    flex: 1;
    margin: 0;
}

.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.calendar-nav:hover {
    background-color: rgba(201, 162, 77, 0.1);
}

.calendar-nav i,
.calendar-nav svg {
    width: 20px;
    height: 20px;
    stroke: var(--color-text-primary);
    fill: none;
}

/* Calendar Grid */
.calendar-grid {
    width: 100%;
}

/* Days of Week */
.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: var(--spacing-sm);
}

.weekday {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    padding: 8px 0;
}

/* Days Grid */
.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.calendar-day:hover {
    background-color: rgba(201, 162, 77, 0.1);
}

/* Inactive days (other months) */
.calendar-day.inactive {
    color: var(--color-text-secondary);
    opacity: 0.3;
    cursor: default;
}

.calendar-day.inactive:hover {
    background-color: transparent;
}

/* Today */
.calendar-day.today {
    background-color: var(--color-gold);
    color: var(--color-primary-bg);
    font-weight: 600;
}

.calendar-day.today:hover {
    background-color: var(--color-gold);
    opacity: 0.9;
}

/* Selected day */
.calendar-day.selected {
    background-color: rgba(201, 162, 77, 0.2);
    border: 1px solid var(--color-gold);
}

/* ===========================
   Reminder Bottom Sheet / Day Reminder Panel
   =========================== */

/* Overlay */
.bottom-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 500;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.bottom-sheet-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Bottom Sheet */
.bottom-sheet {
    position: fixed;
    top: 30px;
    left: 0;
    right: 0;
    bottom: 45px;
    background-color: var(--color-card-bg);
    border-radius: 20px 20px 0 0;
    overflow: hidden;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 501;
    outline: none;
    display: flex;
    flex-direction: column;
}

.bottom-sheet-overlay.active .bottom-sheet {
    transform: translateY(0);
}

/* Sheet Header */
.sheet-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--color-border);
    background-color: var(--color-card-bg);
    z-index: 10;
}

/* Sheet Content - Scrollable */
.sheet-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--spacing-lg);
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
    position: relative;
}

/* Custom Scrollbar для sheet-content */
.sheet-content::-webkit-scrollbar {
    width: 4px;
}

.sheet-content::-webkit-scrollbar-track {
    background: transparent;
}

.sheet-content::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

.sheet-content::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.25);
}

/* Для Firefox */
.sheet-content {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.sheet-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
}

.sheet-btn-close,
.sheet-btn-close,
.sheet-btn-confirm {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    transition: opacity 0.15s ease, background-color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.sheet-btn-close {
    background: none;
}

.sheet-btn-confirm {
    background: var(--color-gold);
}

.sheet-btn-close:hover {
    background-color: rgba(176, 176, 176, 0.1);
}

.sheet-btn-confirm:hover {
    opacity: 0.9;
}

.sheet-btn-close i,
.sheet-btn-close svg {
    width: 20px;
    height: 20px;
    stroke: var(--color-text-secondary);
    fill: none;
}

.sheet-btn-confirm i,
.sheet-btn-confirm svg {
    width: 20px;
    height: 20px;
    stroke: var(--color-primary-bg);
    fill: none;
    stroke-width: 2.5;
}

/* Input Block */
.input-block {
    background-color: var(--color-secondary-bg);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: var(--spacing-md);
}

.input-field {
    width: 100%;
    background: none;
    border: none;
    padding: var(--spacing-md);
    font-size: 16px;
    color: var(--color-text-primary);
    font-family: inherit;
    outline: none;
}

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

.input-textarea {
    resize: none;
    min-height: 80px;
}

.input-divider {
    height: 1px;
    background-color: var(--color-border);
}

/* Разделитель между блоками */
.block-divider {
    height: 1px;
    background-color: var(--color-border);
    margin: var(--spacing-md) 0;
}

/* Card Block */
.card-block {
    background-color: var(--color-secondary-bg);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: var(--spacing-md);
}

.card-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    min-height: 52px;
}

.card-item.clickable {
    cursor: pointer;
    transition: background-color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.card-item.clickable:active {
    background-color: rgba(255, 255, 255, 0.05);
}

.card-item-clickable {
    cursor: pointer;
    transition: background-color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.card-item-clickable:active {
    background-color: rgba(255, 255, 255, 0.05);
}

.card-label {
    font-size: 16px;
    color: var(--color-text-primary);
}

.card-value {
    font-size: 16px;
    color: var(--color-gold);
    font-weight: 500;
}

.card-value-secondary {
    color: var(--color-text-secondary);
    font-weight: 400;
}

.card-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.card-divider {
    height: 1px;
    background-color: var(--color-border);
    margin: 0 var(--spacing-md);
}

.card-chevron {
    width: 16px;
    height: 16px;
    stroke: var(--color-text-secondary);
    fill: none;
    margin-left: var(--spacing-xs);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 28px;
    cursor: pointer;
}

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

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 28px;
    transition: background-color 0.2s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: var(--color-text-secondary);
    border-radius: 50%;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: rgba(201, 162, 77, 0.2);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
    background-color: var(--color-gold);
}

/* Expandable Sections */
.expandable-section {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    background-color: var(--color-secondary-bg);
}

.expandable-section.expanded {
    max-height: 500px;
    opacity: 1;
}

/* Time Picker */
.time-picker-grid {
    display: flex;
    align-items: stretch;
    padding: var(--spacing-md);
    gap: var(--spacing-md);
}

.time-column {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.time-label {
    font-size: 12px;
    color: var(--color-text-secondary);
    text-align: center;
    margin-bottom: var(--spacing-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.time-divider {
    font-size: 24px;
    color: var(--color-gold);
    font-weight: 600;
    display: flex;
    align-items: center;
    padding-top: 24px;
}

.time-options {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 240px;
    overflow-y: auto;
    padding: var(--spacing-sm);
    background-color: var(--color-secondary-bg);
    border-radius: var(--radius-md);
}

.time-option {
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: center;
    font-size: 16px;
    color: var(--color-text-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.time-option:hover {
    background-color: rgba(201, 162, 77, 0.1);
}

.time-option.selected {
    background-color: var(--color-gold);
    color: var(--color-primary-bg);
    font-weight: 600;
}

/* Repeat Options */
.repeat-options {
    display: flex;
    flex-direction: column;
    padding: var(--spacing-sm) var(--spacing-md);
    gap: 2px;
}

.repeat-option {
    padding: var(--spacing-md);
    font-size: 16px;
    color: var(--color-text-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.repeat-option:hover {
    background-color: rgba(201, 162, 77, 0.1);
}

.repeat-option.selected {
    color: var(--color-gold);
    font-weight: 500;
}

.repeat-option.selected::after {
    content: '✓';
    position: absolute;
    right: var(--spacing-md);
    color: var(--color-gold);
    font-weight: 600;
}

/* Scrollbar для time options */
.time-options::-webkit-scrollbar {
    width: 3px;
}

.time-options::-webkit-scrollbar-track {
    background: transparent;
}

.time-options::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

.time-options::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.25);
}

/* Для Firefox */
.time-options {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

/* ===========================
   Reminders List
   =========================== */

.reminders-list {
    margin-top: var(--spacing-lg);
    margin-bottom: 80px;
}

/* Empty State */
.reminders-empty {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
    text-align: center;
    min-height: 200px;
}

.reminders-empty i {
    width: 48px;
    height: 48px;
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-md);
}

.reminders-empty p {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-xs);
}

.reminders-empty span {
    font-size: 14px;
    color: var(--color-text-secondary);
}

/* Reminders Groups */
.reminders-groups {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

/* Reminder Group */
.reminder-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

.reminder-group-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-sm);
    padding: 0 var(--spacing-xs);
}

.reminder-group-date {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.reminder-group.overdue .reminder-group-date {
    color: #FF6B6B;
}

.overdue-icon {
    width: 16px;
    height: 16px;
    color: #FF6B6B;
}

/* Reminder Group Items */
.reminder-group-items {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

/* Reminder Item */
.reminder-item {
    position: relative;
    background-color: var(--color-secondary-bg);
    border-radius: var(--radius-md);
    overflow: visible; /* Изменено с hidden на visible для показа кнопок */
    margin-bottom: var(--spacing-sm);
}

.reminder-item-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background-color: var(--color-secondary-bg);
    position: relative;
    z-index: 2;
    border-radius: var(--radius-md);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

.reminder-item.swiped .reminder-item-content {
    box-shadow: -4px 0 8px rgba(0, 0, 0, 0.15);
}

/* Checkbox для выполнения */
.reminder-checkbox {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.reminder-checkbox .checkbox-empty {
    width: 24px;
    height: 24px;
    color: var(--color-text-secondary);
    transition: all 0.15s ease;
}

.reminder-checkbox .checkbox-filled {
    display: none;
    width: 24px;
    height: 24px;
    color: var(--color-gold);
}

.reminder-checkbox:hover .checkbox-empty {
    color: var(--color-gold);
    transform: scale(1.1);
}

/* Reminder Info */
.reminder-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.reminder-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--color-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reminder-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.reminder-time {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.reminder-time i {
    width: 6px !important;
    height: 6px !important;
    flex-shrink: 0;
}

.reminder-description {
    font-size: 12px;
    color: var(--color-text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.7;
    margin-top: 2px;
    padding-left: 0;
}

/* Overdue State */
.reminder-item.overdue .reminder-item-content {
    border-left: 3px solid #FF6B6B;
}

.reminder-item.overdue .reminder-title {
    color: #FF6B6B;
}

.reminder-item.overdue .reminder-time {
    color: #FF6B6B;
}

/* Completing Animation */
.reminder-item.completing .reminder-checkbox .checkbox-empty {
    display: none;
}

.reminder-item.completing .reminder-checkbox .checkbox-filled {
    display: block;
    animation: checkPulse 0.5s ease;
}

@keyframes checkPulse {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.reminder-item.completing .reminder-title,
.reminder-item.completing .reminder-time {
    opacity: 0.5;
    text-decoration: line-through;
}

/* Swipe Actions */
.reminder-actions {
    position: absolute;
    top: 50%;
    right: var(--spacing-md);
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    z-index: 1;
    pointer-events: auto;
}

.reminder-action {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.reminder-action i {
    width: 18px;
    height: 18px;
}

.reminder-action.edit {
    background-color: var(--color-gold);
    color: var(--color-primary-bg);
}

.reminder-action.edit:hover {
    background-color: #B89542;
}

.reminder-action.edit:active {
    transform: scale(0.95);
}

.reminder-action.delete {
    background-color: #FF6B6B;
    color: white;
}

.reminder-action.delete:hover {
    background-color: #E65555;
}

.reminder-action.delete:active {
    transform: scale(0.95);
}

/* Overdue Section */
.reminders-overdue-section {
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--color-border);
}


/* ===========================
   Calendar Widget
   Responsive Design
   =========================== */

@media (max-width: 768px) {
    .hero-header {
        padding: var(--spacing-sm) var(--spacing-md);
    }
    
    .page-header {
        padding: var(--spacing-sm) var(--spacing-md);
    }
    
    .main-content {
        padding: var(--spacing-md);
        padding-bottom: calc(var(--spacing-md) + 70px);
    }
    
    .calendar-widget {
        padding: var(--spacing-md);
    }
    
    .calendar-month {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .avatar-letter {
        font-size: 16px;
    }
    
    .loader-spinner {
        width: 50px;
        height: 50px;
    }
    
    .main-content {
        padding: var(--spacing-sm);
        padding-bottom: calc(var(--spacing-sm) + 70px);
    }
    
    .calendar-widget {
        padding: var(--spacing-sm);
    }
    
    .calendar-month {
        font-size: 16px;
    }
    
    .calendar-day {
        font-size: 13px;
    }
    
    .weekday {
        font-size: 11px;
    }
    
    .sheet-content {
        padding: var(--spacing-md);
    }
    
    .sheet-title {
        font-size: 16px;
    }
    
    .input-field,
    .card-label,
    .card-value {
        font-size: 15px;
    }
    
    .page-header {
        padding: var(--spacing-sm);
    }
    
    .page-title h1 {
        font-size: 16px;
    }
    
    .page-title i,
    .page-title svg {
        width: 18px;
        height: 18px;
    }
    
    .header-spacer {
        width: 36px;
    }
    
    .bottom-nav {
        padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
    }
    
    .nav-item {
        padding: 6px 12px;
        min-width: 50px;
    }
    
    .nav-item i {
        width: 22px;
        height: 22px;
    }
    
    .nav-item svg {
        width: 22px;
        height: 22px;
    }
}

/* ===========================
   Initial Loader / App Loader
   =========================== */

.app-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--color-primary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.6s ease-out;
}

.app-loader.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* Spinner */
.loader-spinner {
    width: 60px;
    height: 60px;
    border: 3px solid rgba(201, 162, 77, 0.1);
    border-top-color: var(--color-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===========================
   Loading State
   =========================== */

.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Skeleton Animation for Loading */
@keyframes skeleton-loading {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-card-bg) 0%,
        rgba(255, 255, 255, 0.05) 50%,
        var(--color-card-bg) 100%
    );
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

/* ===========================
   Toast Notifications
   =========================== */

.toast-container {
    position: fixed;
    top: 70px;
    right: var(--spacing-md);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    max-width: 400px;
    width: calc(100% - 32px);
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background-color: var(--color-secondary-bg);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    transform: translateX(calc(100% + 20px));
    opacity: 0;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-success {
    border-left-color: #4CAF50;
}

.toast-error {
    border-left-color: #f44336;
}

.toast-info {
    border-left-color: var(--color-gold);
}

.toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-success .toast-icon {
    color: #4CAF50;
}

.toast-error .toast-icon {
    color: #f44336;
}

.toast-info .toast-icon {
    color: var(--color-gold);
}

.toast-icon i,
.toast-icon svg {
    width: 24px;
    height: 24px;
}

.toast-message {
    flex: 1;
    font-size: 15px;
    color: var(--color-text-primary);
    line-height: 1.4;
}

.toast-close {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.toast-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--color-text-primary);
}

.toast-close i,
.toast-close svg {
    width: 18px;
    height: 18px;
}

/* Адаптив для мобильных */
@media (max-width: 768px) {
    .toast-container {
        top: 60px;
        right: var(--spacing-sm);
        left: var(--spacing-sm);
        width: auto;
        max-width: none;
    }
}

/* ===========================
   Training Section
   =========================== */

/* Header with Plus Button */
.section-header-with-action {
    position: relative;
    height: 60px; /* Даем высоту чтобы не схлопывалась */
}

.header-plus-button {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: var(--color-gold);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(218, 255, 98, 0.3);
    z-index: 100;
}

.header-plus-button i {
    width: 24px;
    height: 24px;
    stroke: #1c1b1c;
    stroke-width: 2.5;
}

.header-plus-button:active {
    transform: scale(0.95);
    box-shadow: 0 1px 4px rgba(218, 255, 98, 0.3);
}

.training-section {
    min-height: 60vh;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-md);
    min-height: 50vh;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    background: rgba(218, 255, 98, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--spacing-md);
}

.empty-state-icon i,
.empty-state-icon svg {
    width: 40px;
    height: 40px;
    color: var(--color-gold);
    stroke: var(--color-gold);
}

.empty-state-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-sm);
}

.empty-state-text {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-lg);
    max-width: 300px;
}

/* FAB Button */
.fab-button {
    position: fixed;
    bottom: calc(80px + var(--spacing-md));
    right: var(--spacing-md);
    width: 56px;
    height: 56px;
    background: var(--color-gold);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 900;
    transition: transform 0.2s ease;
}

.fab-button:active {
    transform: scale(0.95);
}

.fab-button svg {
    width: 24px;
    height: 24px;
    stroke: var(--color-primary-bg);
}

/* Workouts List */
.workouts-list {
    display: grid;
    gap: var(--spacing-md);
}

/* Workout Card */
.workout-card {
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: var(--spacing-md);
    transition: all 0.2s ease;
    cursor: pointer;
}

.workout-card:active {
    transform: scale(0.98);
}

.workout-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--spacing-sm);
}

.workout-card-info {
    flex: 1;
}

.workout-card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 4px;
}

.workout-card-description {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.workout-card-menu {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
}

.workout-card-menu:active {
    background: rgba(255, 255, 255, 0.05);
}

.workout-card-menu svg {
    width: 20px;
    height: 20px;
    stroke: var(--color-text-secondary);
}

.workout-card-meta {
    display: flex;
    gap: var(--spacing-md);
}

.workout-card-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.workout-card-meta-item svg {
    width: 16px;
    height: 16px;
    stroke: var(--color-text-secondary);
}

/* ===========================
   Bottom Sheet Modal
   =========================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: flex-end;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.bottom-sheet {
    width: 100%;
    max-height: 96vh;
    background: var(--color-secondary-bg);
    border-radius: 24px 24px 0 0;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.modal-overlay.active .bottom-sheet {
    transform: translateY(0);
}

/* Sheet Header */
.sheet-header {
    position: relative;
    padding: var(--spacing-sm) var(--spacing-md) var(--spacing-md);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.sheet-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text-primary);
    text-align: center;
    padding-right: 32px;
}

.sheet-close {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-md);
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.sheet-close:active {
    background: rgba(255, 255, 255, 0.1);
}

.sheet-close svg {
    width: 20px;
    height: 20px;
    stroke: var(--color-text-secondary);
}

/* Sheet Content */
.sheet-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md);
    overscroll-behavior: contain;
}

/* Sheet Footer */
.sheet-footer {
    padding: var(--spacing-md);
    padding-bottom: calc(var(--spacing-md) + 25px); /* Отступ для панели Telegram */
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
    background: var(--color-secondary-bg);
}

/* Form Elements */
.form-section {
    margin-bottom: var(--spacing-lg);
}

.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-xs);
}

.form-label.required::after {
    content: ' *';
    color: #ff4444;
}

.form-label-small {
    display: block;
    font-size: 13px;
    font-weight: 400;
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-xs);
}

.form-hint {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-top: 4px;
    margin-bottom: 8px;
    line-height: 1.4;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--color-primary-bg);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    color: var(--color-text-primary);
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-gold);
}

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

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.section-divider {
    height: 1px;
    background: var(--color-border);
    margin: var(--spacing-lg) 0;
}

/* Days Selector */
.days-selector {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
}

.day-chip {
    flex: 1;
    min-width: 44px;
    padding: 10px 12px;
    background: var(--color-primary-bg);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    color: var(--color-text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.day-chip .day-full {
    display: none;
}

.day-chip:active {
    transform: scale(0.95);
}

.day-chip.active {
    background: var(--color-gold);
    border-color: var(--color-gold);
    color: var(--color-primary-bg);
}

/* Exercises Empty State */
.exercises-empty {
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-md);
    background: var(--color-primary-bg);
    border-radius: 16px;
    border: 1px dashed var(--color-border);
}

.exercises-empty-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto var(--spacing-sm);
    opacity: 0.4;
}

.exercises-empty-icon svg {
    width: 100%;
    height: 100%;
    stroke: var(--color-text-secondary);
}

.exercises-empty-text {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-md);
}

/* Exercises List */
.exercises-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.exercise-card {
    background: var(--color-primary-bg);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: var(--spacing-md);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.exercise-card:active {
    transform: scale(0.98);
}

.exercise-card-icon {
    width: 40px;
    height: 40px;
    background: rgba(218, 255, 98, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.exercise-card-icon svg {
    width: 20px;
    height: 20px;
    stroke: var(--color-gold);
}

.exercise-card-content {
    flex: 1;
}

.exercise-card-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--color-text-primary);
    margin-bottom: 4px;
}

.exercise-card-params {
    font-size: 13px;
    color: var(--color-text-secondary);
}

.exercise-card-drag {
    width: 24px;
    height: 24px;
    opacity: 0.3;
}

.exercise-card-drag svg {
    width: 100%;
    height: 100%;
    stroke: var(--color-text-secondary);
}

/* Exercise Types */
.exercise-types {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm);
}

.exercise-type-card {
    padding: var(--spacing-md);
    background: var(--color-primary-bg);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
    cursor: pointer;
    transition: all 0.2s ease;
}

.exercise-type-card:active {
    transform: scale(0.95);
}

.exercise-type-card.active {
    background: rgba(218, 255, 98, 0.1);
    border-color: var(--color-gold);
}

.exercise-type-card svg {
    width: 24px;
    height: 24px;
    stroke: var(--color-text-secondary);
}

.exercise-type-card.active svg {
    stroke: var(--color-gold);
}

.exercise-type-card span {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
}

.exercise-type-card.active span {
    color: var(--color-gold);
}

/* Set Cards (для подходов) */
.set-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    position: relative;
}

.set-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-sm);
}

.set-card-number {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-gold);
}

.set-card-remove {
    width: 28px;
    height: 28px;
    background: rgba(255, 59, 48, 0.1);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
}

.set-card-remove svg {
    width: 16px;
    height: 16px;
    stroke: #ff3b30;
}

.set-card-remove:active {
    transform: scale(0.95);
    background: rgba(255, 59, 48, 0.2);
}

.set-card-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--spacing-sm);
}

.set-card-field {
    display: flex;
    flex-direction: column;
}

.set-card-field label {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-bottom: 4px;
}

.set-card-field input {
    padding: 8px 12px;
    background: var(--color-primary-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text-primary);
    font-size: 14px;
    transition: border-color 0.15s;
}

.set-card-field input:focus {
    outline: none;
    border-color: var(--color-gold);
}

/* Кнопка добавления подхода */
.btn-add-set {
    width: 100%;
    padding: 14px 24px;
    background: transparent;
    border: 1px solid var(--color-gold);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    color: var(--color-gold);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: var(--spacing-sm);
}

.btn-add-set svg {
    width: 18px;
    height: 18px;
    stroke: var(--color-gold);
}

.btn-add-set:active {
    transform: scale(0.97);
}

.btn-add-set:active {
    transform: scale(0.98);
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-add-more {
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--color-gold);
    color: var(--color-primary-bg);
}

.btn-primary:active:not(:disabled) {
    transform: scale(0.97);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-secondary {
    background: transparent;
    color: var(--color-gold);
    border: 1px solid var(--color-gold);
}

.btn-secondary:active {
    transform: scale(0.97);
}

.btn-add-more {
    width: 100%;
    background: var(--color-primary-bg);
    color: var(--color-text-secondary);
    border: 1px dashed var(--color-border);
    margin-top: var(--spacing-sm);
}

.btn-add-more:active {
    transform: scale(0.98);
}

.btn-full {
    width: 100%;
}

.btn-primary svg,
.btn-secondary svg,
.btn-add-more svg {
    width: 18px;
    height: 18px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-sm);
}
