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

:root {
    /* Светлая тема */
    --bg-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-secondary: #ffffff;
    --bg-tertiary: #f8f9fa;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-white: #ffffff;
    --border-color: #e1e5e9;
    --shadow-color: rgba(0,0,0,0.1);
    --card-shadow: 0 8px 32px rgba(0,0,0,0.1);
    --card-hover-shadow: 0 12px 40px rgba(0,0,0,0.15);
    --input-bg: #f8f9fa;
    --input-border: #e1e5e9;
    --input-focus-border: #667eea;
    --input-focus-bg: #ffffff;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    --gradient-overlay: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

[data-theme="dark"] {
    /* Темная тема */
    --bg-primary: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    --bg-secondary: #2c3e50;
    --bg-tertiary: #34495e;
    --text-primary: #ffffff;
    --text-secondary: #bdc3c7;
    --text-white: #ffffff;
    --border-color: #4a5568;
    --shadow-color: rgba(0,0,0,0.3);
    --card-shadow: 0 8px 32px rgba(0,0,0,0.3);
    --card-hover-shadow: 0 12px 40px rgba(0,0,0,0.4);
    --input-bg: #34495e;
    --input-border: #4a5568;
    --input-focus-border: #667eea;
    --input-focus-bg: #2d3748;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    --gradient-overlay: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    transition: background 0.3s ease, color 0.3s ease;
    padding-top: 0; /* Убираем отступ, так как шапка фиксированная */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: calc(100vh - 70px); /* Учитываем высоту компактной шапки */
    display: flex;
    flex-direction: column;
    margin-top: 70px; /* Увеличенный отступ под компактную шапку */
}

/* Фиксированная шапка */
.top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color);
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(10px);
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(0);
}

/* Скрытое состояние шапки */
.top-header.header-hidden {
    transform: translateY(-100%);
    box-shadow: none;
}

/* Дополнительные эффекты при скрытии */
.top-header.header-hidden .top-header-content {
    opacity: 0.8;
}



.top-header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 5px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    transition: opacity 0.2s ease;
}

/* Информация о приложении */
.app-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.app-title h1 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
}

.app-title p {
    font-size: 0.7rem;
    margin: 0;
    color: var(--text-secondary);
    font-weight: 400;
    line-height: 1;
}

/* Раздел ставок */
.rates-section {
    flex-shrink: 0;
    min-width: 260px;
}

.rates-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3px;
}

.rates-header h3 {
    font-size: 0.8rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.rates-update-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.65rem;
    color: var(--text-secondary);
}

.refresh-btn {
    background: var(--gradient-primary);
    border: none;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.6rem;
    color: var(--text-white);
}

.refresh-btn:hover {
    transform: rotate(180deg) scale(1.1);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.refresh-btn.spinning {
    animation: spin 1s linear infinite;
}

.rates-grid {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.rate-item {
    background: var(--bg-tertiary);
    border-radius: 4px;
    padding: 4px 6px;
    min-width: 100px;
}

.rate-label {
    display: flex;
    align-items: center;
    gap: 3px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.6rem;
    margin-bottom: 1px;
}

.rate-icon {
    font-size: 0.7rem;
}

.rate-value {
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--input-focus-border);
}

.cb-rate .rate-value {
    color: #e74c3c;
    font-size: 0.85rem;
}

.bank-rates {
    background: var(--bg-tertiary);
    border-radius: 4px;
    padding: 4px 6px;
    min-width: 120px;
}

.bank-rates-title {
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

.bank-rates-list {
    display: flex;
    flex-direction: column;
    gap: 0px;
}

.bank-rate-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0px;
}

.bank-info {
    display: flex;
    align-items: center;
    gap: 3px;
}

.bank-icon {
    font-size: 0.6rem;
}

.bank-name {
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--text-primary);
}

.bank-rate-item .rate-value {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--input-focus-border);
}

/* Кнопка использования текущих ставок */
.use-rates-btn {
    background: var(--gradient-primary);
    color: var(--text-white);
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 12px;
    width: 100%;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.use-rates-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    background: linear-gradient(135deg, #7c8cea 0%, #8659c4 100%);
}

.use-rates-btn:active {
    transform: translateY(0);
}

/* Переключатель темы в шапке */
.theme-toggle {
    flex-shrink: 0;
}

.theme-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-btn:hover {
    background: var(--gradient-primary);
    border-color: transparent;
    transform: scale(1.1);
}

.theme-btn:hover .theme-icon {
    color: var(--text-white);
}

.theme-icon {
    font-size: 1rem;
    transition: all 0.3s ease;
    color: var(--text-primary);
}

.theme-btn:hover .theme-icon {
    transform: rotate(180deg);
}

.main {
    flex: 1;
}

/* Шаги */
.step-section {
    margin-bottom: 30px;
}

.step-section:first-child {
    margin-top: 20px; /* Дополнительный отступ для первой секции */
}

.step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    color: var(--text-primary);
    flex-wrap: wrap;
    gap: 15px;
}

.step-info {
    display: flex;
    align-items: center;
    flex: 1;
}

/* Заголовок секции выровненный по левому краю */
.step-header-left {
    justify-content: flex-start !important;
}

.step-number {
    background: var(--gradient-primary);
    color: var(--text-white);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.2rem;
    margin-right: 15px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.step-header h2 {
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0;
}

/* Кнопка редактирования в заголовке */
.edit-btn-header {
    background: var(--gradient-primary);
    color: var(--text-white);
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
    flex-shrink: 0;
}

.edit-btn-header:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    background: linear-gradient(135deg, #7c8cea 0%, #8659c4 100%);
}

.edit-btn-header:active {
    transform: translateY(0);
}

/* Карточки */
.card {
    background: var(--bg-secondary);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-hover-shadow);
}

.card-header {
    padding: 20px;
    background: var(--gradient-primary);
    color: var(--text-white);
}

.card-header h2, .card-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.card-content {
    padding: 20px;
}

/* Информация об ипотеке */
.mortgage-summary {
    display: grid;
    gap: 15px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border-left: 4px solid #667eea;
    transition: background 0.3s ease;
}

.summary-item.highlight {
    background: var(--gradient-primary);
    color: var(--text-white);
    border-left-color: #4CAF50;
}

/* Вычисляемые поля */
.summary-item.calculated {
    position: relative;
    background: var(--bg-tertiary);
    border-left: 4px solid #9b59b6;
    border-style: dashed;
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(155, 89, 182, 0.05) 10px,
        rgba(155, 89, 182, 0.05) 20px
    );
}

.summary-item.calculated.highlight {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    border-left-color: #f39c12;
    background-image: none;
}



/* Разделитель для расчетных данных */
.calculated-section-divider {
    margin: 20px 0 15px 0;
    text-align: center;
    position: relative;
}

.calculated-section-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        to right, 
        transparent, 
        #9b59b6 20%, 
        #9b59b6 80%, 
        transparent
    );
    transform: translateY(-50%);
}

.divider-text {
    background: var(--bg-secondary);
    padding: 0 15px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #9b59b6;
    position: relative;
    z-index: 1;
}

.summary-label {
    font-weight: 500;
    color: inherit;
}

.summary-value {
    font-weight: 600;
    font-size: 1.1rem;
    color: inherit;
}



/* Форма редактирования */
.input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group.large {
    margin-bottom: 30px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--input-border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
    background: var(--input-bg);
    color: var(--text-primary);
}

.input-group input:focus {
    outline: none;
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: var(--input-focus-bg);
}

/* Стили для бегунка */
.range-input {
    position: relative;
}

.period-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--input-bg);
    outline: none;
    border: 2px solid var(--input-border);
    margin: 12px 0;
}

.period-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--gradient-primary);
    cursor: pointer;
    border: 2px solid var(--bg-secondary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: transform 0.2s ease;
}

.period-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.period-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--gradient-primary);
    cursor: pointer;
    border: 2px solid var(--bg-secondary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: transform 0.2s ease;
}

.period-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
}

.range-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

#period-display,
#strategy-period-display,
#amount-display,
#rate-display {
    font-weight: 600;
    color: var(--input-focus-border);
}

/* Дополнительные стили для ползунков */
.amount-slider,
.rate-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--input-bg);
    outline: none;
    border: 2px solid var(--input-border);
    margin: 12px 0;
}

.amount-slider::-webkit-slider-thumb,
.rate-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--gradient-primary);
    cursor: pointer;
    border: 2px solid var(--bg-secondary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: transform 0.2s ease;
}

.amount-slider::-webkit-slider-thumb:hover,
.rate-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.amount-slider::-moz-range-thumb,
.rate-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--gradient-primary);
    cursor: pointer;
    border: 2px solid var(--bg-secondary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: transform 0.2s ease;
}

.amount-slider::-moz-range-thumb:hover,
.rate-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
}

/* Стили для кнопки расчета */
.calculate-section {
    margin-top: 30px;
    text-align: center;
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
}

.calculate-btn {
    background: var(--gradient-primary);
    color: var(--text-white);
    border: none;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
    min-width: 220px;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.calculate-btn:active {
    transform: translateY(0);
}

.calculate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.calculation-status {
    margin-top: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.status-icon {
    animation: spin 2s linear infinite;
}

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

.input-hint {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 8px;
    font-style: italic;
}

.save-btn {
    background: var(--gradient-success);
    color: var(--text-white);
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.4);
}





/* Сравнение */
.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.comparison-card {
    text-align: center;
}



.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    font-size: 0.9rem;
    transition: background 0.3s ease;
}

/* Стратегии */
.strategy-details {
    display: grid;
    gap: 12px;
}

.strategy-immediate {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.strategy-delayed {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
}

.detail-item.highlight {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 600;
}

[data-theme="dark"] .detail-item.highlight {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-white);
}

/* Рекомендация */
.recommendation-section {
    margin-top: 30px;
}

.recommendation-card {
    background: var(--gradient-success);
    color: var(--text-white);
}

.recommendation-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.recommendation-icon {
    font-size: 3rem;
    opacity: 0.9;
}

.recommendation-text {
    flex: 1;
}

.recommendation-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.recommendation-description {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 12px;
}

.recommendation-benefits {
    display: grid;
    gap: 10px;
    margin-top: 15px;
}

.benefit-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.15);
    padding: 10px 15px;
    border-radius: 8px;
}

.benefit-label {
    font-size: 0.95rem;
    opacity: 0.9;
}

.benefit-value {
    font-size: 1.1rem;
    font-weight: 600;
}

.recommendation-difference {
    font-size: 1.1rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    display: inline-block;
}

.footer {
    text-align: center;
    color: var(--text-white);
    opacity: 0.9;
    font-size: 0.9rem;
    margin-top: auto;
}

/* Мобильные устройства */
@media (max-width: 768px) {
    body {
        padding-top: 0;
    }
    
    .container {
        padding: 15px;
        margin-top: 90px; /* Увеличенный отступ для мобильной шапки */
        min-height: calc(100vh - 90px);
    }
    
    /* Мобильная шапка */
    .top-header-content {
        flex-direction: column;
        gap: 8px;
        padding: 6px 15px 8px;
    }
    
    .app-info {
        width: 100%;
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }
    
    .app-title h1 {
        font-size: 1rem;
        text-align: center;
    }
    
    .app-title p {
        font-size: 0.65rem;
        text-align: center;
    }
    
    .theme-toggle {
        align-self: center;
    }
    
    .theme-btn {
        width: 25px;
        height: 25px;
    }
    
    .theme-icon {
        font-size: 0.8rem;
    }
    
    /* Мобильные ставки */
    .rates-section {
        width: 100%;
        min-width: auto;
    }
    
    .rates-grid {
        flex-direction: column;
        gap: 12px;
    }
    
    .rate-item {
        padding: 8px 10px;
        min-width: auto;
    }
    
    .rates-header h3 {
        font-size: 0.9rem;
    }
    
    .rates-update-info {
        font-size: 0.7rem;
    }
    
    .refresh-btn {
        width: 18px;
        height: 18px;
        font-size: 0.6rem;
    }
    
    .bank-rates {
        padding: 6px 10px;
        min-width: auto;
    }
    
    .bank-rates-title {
        font-size: 0.75rem;
        margin-bottom: 4px;
    }
    
    .bank-name {
        font-size: 0.75rem;
    }
    
    .bank-rate-item .rate-value {
        font-size: 0.8rem;
    }
    
    .rate-value {
        font-size: 1rem;
    }
    
    .cb-rate .rate-value {
        font-size: 1.1rem;
    }
    
    /* Остальные мобильные стили */
    .step-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .step-info {
        justify-content: center;
    }
    
    .step-header h2 {
        font-size: 1.5rem;
    }
    
    .edit-btn-header {
        width: 100%;
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    .comparison-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .input-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .payment-type-options {
        grid-template-columns: 1fr;
    }
    
    .option-content {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .recommendation-content {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .recommendation-icon {
        font-size: 2.5rem;
    }
    
    .result-value {
        font-size: 1.5rem;
    }
    
    .card-content {
        padding: 15px;
    }
    
    .card-header {
        padding: 15px;
    }
}

/* Планшеты */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        margin-top: 80px;
        min-height: calc(100vh - 80px);
    }
    
    .top-header-content {
        padding: 6px 20px;
        gap: 15px;
    }
    
    .app-title h1 {
        font-size: 1.2rem;
    }
    
    .rates-section {
        min-width: 280px;
    }
    
    .rates-grid {
        gap: 15px;
    }
    
    .comparison-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .input-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.step-section {
    animation: fadeIn 0.6s ease-out;
}

.step-section:nth-child(2) {
    animation-delay: 0.1s;
}

.step-section:nth-child(3) {
    animation-delay: 0.2s;
}

/* Улучшения для доступности */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Автоматическое определение темы системы */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --bg-primary: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
        --bg-secondary: #2c3e50;
        --bg-tertiary: #34495e;
        --text-primary: #ffffff;
        --text-secondary: #bdc3c7;
        --text-white: #ffffff;
        --border-color: #4a5568;
        --shadow-color: rgba(0,0,0,0.3);
        --card-shadow: 0 8px 32px rgba(0,0,0,0.3);
        --card-hover-shadow: 0 12px 40px rgba(0,0,0,0.4);
        --input-bg: #34495e;
        --input-border: #4a5568;
        --input-focus-border: #667eea;
        --input-focus-bg: #2d3748;
        --gradient-overlay: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
    }
}

/* Карточки сравнения стратегий */
.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.comparison-card {
    background: var(--card-bg);
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.comparison-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.comparison-card .card-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.comparison-card .card-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Кнопка показа расчетов */
.show-calculations-btn {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.show-calculations-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.show-calculations-btn.active {
    background: var(--gradient-secondary);
}

/* Детальные расчеты */
.calculation-breakdown {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 20px;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.breakdown-header {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--gradient-primary);
}

.breakdown-header h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
}

.breakdown-steps {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.breakdown-step {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: var(--card-bg);
    border-radius: 10px;
    border-left: 4px solid var(--gradient-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.step-number {
    width: 30px;
    height: 30px;
    background: var(--gradient-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 1rem;
}

.step-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.calc-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: 0.9rem;
}

.calc-item span:first-child {
    color: var(--text-secondary);
    font-weight: 500;
}

.calc-item span:last-child {
    color: var(--text-primary);
    font-weight: 600;
    text-align: right;
}

.calc-item.highlight {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.1), rgba(75, 0, 130, 0.1));
    padding: 8px 12px;
    border-radius: 8px;
    margin: 5px 0;
    border-left: 3px solid var(--gradient-primary);
}

.calc-item.highlight span:last-child {
    color: var(--gradient-primary);
    font-size: 1rem;
}

/* Адаптивность для детальных расчетов */
@media (max-width: 768px) {
    .comparison-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .comparison-card .card-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .show-calculations-btn {
        align-self: stretch;
        text-align: center;
    }
    
    .breakdown-step {
        flex-direction: column;
        gap: 10px;
    }
    
    .step-number {
        align-self: flex-start;
    }
    
    .calc-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .calc-item span:last-child {
        text-align: left;
        font-weight: 700;
    }
}

@media (max-width: 480px) {
    .calculation-breakdown {
        padding: 15px;
    }
    
    .breakdown-step {
        padding: 12px;
    }
    
    .step-title {
        font-size: 0.95rem;
    }
    
    .calc-item {
        font-size: 0.85rem;
    }
}

/* Стили для шаринга */
.recommendation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.recommendation-header h3 {
    margin: 0;
}

.share-btn {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Модальное окно */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--card-bg);
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.2rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-body {
    padding: 25px;
}

.share-options {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.share-option {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.share-option label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
}

.url-input-group {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.url-input-group input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: 'Courier New', monospace;
}

.url-input-group input:focus {
    outline: none;
    border-color: var(--gradient-primary);
}

.copy-btn {
    background: var(--gradient-secondary);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.copy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.copy-btn.copied {
    background: #10b981;
}

.share-hint {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-style: italic;
}

.share-summary {
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 20px;
    border-left: 4px solid var(--gradient-primary);
}

.share-summary h4 {
    margin: 0 0 15px 0;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.summary-grid .summary-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.summary-grid .summary-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.summary-grid .summary-value {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.summary-grid .summary-item.highlight .summary-value {
    color: var(--gradient-primary);
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    justify-content: center;
}

.social-share-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 25px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.whatsapp-btn {
    background: #25d366;
    color: white;
}

.whatsapp-btn:hover {
    background: #128c7e;
    transform: translateY(-2px);
}

.telegram-btn {
    background: #0088cc;
    color: white;
}

.telegram-btn:hover {
    background: #006699;
    transform: translateY(-2px);
}

.email-btn {
    background: #ea4335;
    color: white;
}

.email-btn:hover {
    background: #d32f2f;
    transform: translateY(-2px);
}

/* Адаптивность для модального окна */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-footer {
        padding: 15px 20px;
        flex-direction: column;
    }
    
    .url-input-group {
        flex-direction: column;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
    }
    
    .recommendation-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .share-btn {
        align-self: stretch;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .modal-content {
        width: 98%;
        margin: 10px;
    }
    
    .modal-header h3 {
        font-size: 1.1rem;
    }
    
    .social-share-btn {
        padding: 10px 16px;
        font-size: 0.85rem;
    }
}

/* Анимации для уведомлений */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Стили для уведомления о сохранении */
.save-notification {
    font-family: 'Inter', sans-serif;
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.notification-icon {
    font-size: 1.2rem;
}

.notification-text {
    font-size: 0.9rem;
}

/* Улучшенные стили для кнопки редактирования */
.edit-btn-header {
    background: var(--gradient-secondary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
}

.edit-btn-header:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.edit-btn-header:active {
    transform: translateY(0);
}
