/* ==========================================================================
   ЕДИНЫЙ ФАЙЛ СТИЛЕЙ ДЛЯ FIN-ANALYZE
   Версия 1.1 (с улучшенной мобильной адаптацией)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. ГЛОБАЛЬНЫЕ СТИЛИ И ПЕРЕМЕННЫЕ
   -------------------------------------------------------------------------- */
:root {
    --primary-color: #ffffff;
    --text-color: #d0d2d6;
    --bg-color: #0f172a;
    --card-bg-color: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --accent-gradient: linear-gradient(90deg, #38bdf8, #34d399);
    --accent-color-start: #38bdf8;
    --accent-color-end: #34d399;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

input, select, textarea, button {
    font-size: 16px; /* Фикс для iOS */
    font-family: inherit;
}

/* --------------------------------------------------------------------------
   2. МАКЕТ И ФОН
   -------------------------------------------------------------------------- */
#particles-js {
    position: fixed;
    width: 100%;
    height: 100%;
    z-index: -1;
    top: 0;
    left: 0;
}

.card-container {
    position: relative;
    z-index: 1;
    padding: 2rem 1rem;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding-top: 5vh;
}

.card {
    width: 100%;
    max-width: 960px;
    background: var(--card-bg-color);
    border-radius: 20px;
    padding: 30px 40px;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    text-align: center;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.card > main {
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 15px;
    margin-right: -15px;
    -webkit-overflow-scrolling: touch;
}

/* --------------------------------------------------------------------------
   3. ТИПОГРАФИЯ
   -------------------------------------------------------------------------- */
h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 20px;
}

h2 {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--primary-color);
    text-align: left;
    margin-top: 30px;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.subtitle {
    font-size: 1rem;
    font-weight: 300;
    margin-bottom: 30px;
    line-height: 1.6;
}

/* --------------------------------------------------------------------------
   4. КОМПОНЕНТЫ ИНТЕРФЕЙСА
   -------------------------------------------------------------------------- */

/* --- Навигатор по шагам (Stepper) --- */
.stepper-container {
    width: 100%;
    max-width: 700px;
    margin: 0 auto 20px auto;
    padding: 0 20px;
}
.stepper { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    text-decoration: none; 
}
.stepper-item { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    color: var(--text-color); 
    opacity: 0.5; 
    transition: opacity 0.3s ease; 
    text-decoration: none;
}
.stepper-item.active { opacity: 1; }
.step-counter { 
    width: 40px; 
    height: 40px; 
    border-radius: 50%; 
    background-color: var(--card-bg-color); 
    border: 1px solid var(--border-color); 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-weight: 600; 
    margin-bottom: 8px; 
    transition: all 0.3s ease; 
}
.stepper-item.active .step-counter { 
    background: var(--accent-gradient); 
    color: var(--primary-color); 
    border: 1px solid transparent; 
}
.step-name { 
    font-size: 0.8rem; 
    font-weight: 300; 
}
.stepper-line { 
    flex-grow: 1; 
    height: 2px; 
    background-color: var(--border-color); 
    margin: 0 10px; 
    margin-bottom: 28px; 
}

/* --- Формы --- */
.form-step { 
    margin-bottom: 30px; 
    text-align: left; 
}
.form-step h3 { 
    font-size: 1.1rem; 
    font-weight: 600; 
    color: var(--primary-color); 
    margin-bottom: 15px; 
}
.bank-selector { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); 
    gap: 10px; 
}
.bank-selector input[type="radio"] { 
    display: none; 
}
.bank-selector label { 
    display: inline-block; 
    width: 100%; 
}
.bank-selector span { 
    display: block; 
    padding: 12px; 
    border: 1px solid var(--border-color); 
    border-radius: 8px; 
    cursor: pointer; 
    text-align: center; 
    font-size: 0.9rem; 
    transition: all 0.2s ease-in-out; 
}
.bank-selector span:hover { 
    background-color: rgba(255, 255, 255, 0.1); 
    border-color: var(--accent-color-start); 
}
.bank-selector input[type="radio"]:checked + span { 
    background: var(--accent-gradient); 
    color: var(--primary-color); 
    border-color: transparent; 
    font-weight: 600; 
}
.file-upload-wrapper { 
    display: flex; 
    align-items: center; 
    gap: 15px; 
    padding: 15px; 
    border: 2px dashed var(--border-color); 
    border-radius: 12px; 
    transition: all 0.2s ease; 
}
.file-upload-wrapper:hover { 
    border-color: var(--accent-color-start); 
}
input[type="file"] { 
    display: none; 
}
.file-upload-button { 
    display: inline-flex; 
    align-items: center; 
    gap: 10px; 
    background: rgba(255, 255, 255, 0.1); 
    color: var(--primary-color); 
    padding: 10px 20px; 
    border-radius: 8px; 
    cursor: pointer; 
    transition: background-color 0.2s; 
}
.file-upload-button:hover { 
    background: rgba(255, 255, 255, 0.2); 
}
.file-name-display { 
    font-size: 0.9rem; 
    font-style: italic; 
    flex-grow: 1; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
}

/* --- Кнопки --- */
button[type="submit"] { 
    width: 100%; 
    padding: 15px; 
    font-size: 1.1rem; 
    font-weight: 600; 
    color: var(--primary-color); 
    background: var(--accent-gradient); 
    border: none; 
    border-radius: 10px; 
    cursor: pointer; 
    transition: all 0.3s ease; 
    margin-top: 10px; 
}
button[type="submit"]:hover { 
    transform: translateY(-3px); 
    box-shadow: 0 10px 20px -10px var(--accent-color-end); 
}
.nav-buttons { 
    display: flex; 
    justify-content: space-between; 
    margin-top: 30px; 
    border-top: 1px solid var(--border-color); 
    padding-top: 20px; 
}
.btn { 
    padding: 10px 25px; 
    font-size: 0.9rem; 
    font-weight: 600; 
    border: none; 
    border-radius: 8px; 
    cursor: pointer; 
    transition: all 0.3s ease; 
    text-decoration: none; 
    display: inline-block; 
    text-align: center; 
}
.btn-secondary { 
    background-color: rgba(255, 255, 255, 0.1); 
    color: var(--primary-color); 
}
.btn-secondary:hover { 
    background-color: rgba(255, 255, 255, 0.2); 
}

/* --- Таблицы --- */
.table-wrapper { 
    overflow-x: auto; 
    -webkit-overflow-scrolling: touch;
}
.transactions { 
    width: 100%; 
    border-collapse: collapse; 
    margin-bottom: 20px; 
    min-width: 600px;
}
.transactions th, .transactions td { 
    padding: 12px 15px; 
    text-align: left; 
    border-bottom: 1px solid var(--border-color); 
}
.transactions thead th { 
    font-weight: 600; 
    color: var(--primary-color); 
    font-size: 0.9rem; 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
}
.transactions tbody tr { 
    transition: background-color 0.2s ease-in-out; 
}
.transactions tbody tr:hover { 
    background-color: rgba(255, 255, 255, 0.05); 
}
.transactions tbody td { 
    font-size: 0.95rem; 
}
.text-right { 
    text-align: right !important; 
}
.amount-credit { 
    color: #34d399; 
    font-weight: 600; 
}
.amount-debit { 
    color: #f87171; 
    font-weight: 600; 
}

/* --- Сообщения --- */
.status-message { 
    padding: 15px; 
    margin: 20px 0; 
    border-radius: 8px; 
    border: 1px solid transparent; 
    text-align: center; 
}
.success { 
    background-color: rgba(52, 211, 153, 0.1); 
    border-color: rgba(52, 211, 153, 0.5); 
    color: #a7f3d0; 
}
.error { 
    background-color: rgba(248, 113, 113, 0.1); 
    border-color: rgba(248, 113, 113, 0.5); 
    color: #fecaca; 
}
.info { 
    background-color: rgba(96, 165, 250, 0.1); 
    border-color: rgba(96, 165, 250, 0.5); 
    color: #bfdbfe; 
}

.info-section {
    background: var(--card-bg-color);
    border-radius: 20px;
    padding: 30px 40px;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(15px);
    margin-top: 40px;
}
/* --------------------------------------------------------------------------
   5. ФУТЕР
   -------------------------------------------------------------------------- */
.site-footer {
    width: 100%;
    padding: 20px;
    text-align: center;
    color: var(--text-color);
    font-size: 0.8rem;
    position: relative;
    z-index: 2;
}
.site-footer a {
    color: var(--primary-color);
    text-decoration: none;
    margin: 0 10px;
    transition: color 0.2s;
}
.site-footer a:hover {
    color: var(--accent-color-start);
}

/* --------------------------------------------------------------------------
   6. АДАПТИВНОСТЬ
   -------------------------------------------------------------------------- */
@media (min-width: 768px) {
   .lang-switcher {
    position: absolute;
    top: 20px;
    right: 30px;
    z-index: 10;
}}


@media (max-width: 768px) {
    /* Общие стили */
    .card-container {
        padding: 1rem 0;
        padding-top: 1rem;
    }
    
    .card {
        width: 100%;
        max-width: 100%;
        border-radius: 0;
        padding: 15px;
        max-height: none;
        min-height: 55vh;
    }
    
    /* Типография */
    h1 {
        font-size: 1.8rem;
        margin-bottom: 15px;
    }
    
    h2 {
        font-size: 1.4rem;
        margin-top: 20px;
        margin-bottom: 10px;
    }
    
    .subtitle {
        font-size: 0.9rem;
        margin-bottom: 20px;
    }
    
    /* Навигатор */
    .stepper-container {
        padding: 0 5px;
        max-width: 100%;
    }
    
    .step-name {
        display: none;
    }
    
    .stepper-line {
        margin-bottom: 20px;
    }
    
    .step-counter {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
    
    /* Формы */
    .bank-selector {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .file-upload-wrapper {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        padding: 10px;
    }
    
    .file-upload-button {
        width: 100%;
        justify-content: center;
    }
    
    /* Кнопки */
    button[type="submit"] {
        padding: 12px;
        font-size: 1rem;
    }
    
    .btn {
        padding: 8px 15px;
        font-size: 0.85rem;
    }
    
    /* Таблицы */
    .transactions th, 
    .transactions td {
        padding: 8px 5px;
        font-size: 0.8rem;
    }
    
    .amount-credit, 
    .amount-debit {
        font-size: 0.85rem;
    }
    
    /* Диаграммы */
    .charts-row {
        flex-direction: column;
        gap: 25px;
    }
    
    .chart-container {
        height: 250px;
    }
    
    /* Аналитика */
    .analysis-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    /* Следующие шаги */
    .steps-buttons {
        flex-direction: column;
    }
    
    .next-steps-container {
        margin: 20px -15px -20px -15px;
        padding: 20px 15px;
    }
    
    /* Футер */
    .site-footer {
        padding: 15px 10px;
        font-size: 0.7rem;
    }
    
    /* Переключатель языка */
    .lang-switcher {
        top: 10px;
        right: 15px;
    }
}

/* === НОВЫЕ СТИЛИ ДЛЯ ГЛАВНОЙ СТРАНИЦЫ === */
.intro-text {
    text-align: left;
    line-height: 1.7;
    font-size: 1.05rem;
    font-weight: 300;
    margin-bottom: 40px;
}

.how-it-works {
    text-align: left;
    margin-top: 40px;
    border-top: 1px solid var(--border-color);
    padding-top: 30px;
}

.how-it-works h2 {
    text-align: center;
    border-bottom: none;
    margin-bottom: 30px;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 30px;
    text-align: center;
}

.step-item .icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
    display: inline-block;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.step-item h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.step-item p {
    font-size: 0.9rem;
    font-weight: 300;
    line-height: 1.5;
}

/* === СТИЛИ ДЛЯ СВОДНОЙ ПАНЕЛИ === */
.summary-dashboard {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
    text-align: left;
}

.summary-card {
    background-color: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 12px;
}

.summary-card .label {
    font-size: 0.9rem;
    color: var(--text-color);
    margin-bottom: 8px;
}

.summary-card .value {
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* === СТИЛИ ДЛЯ ИНТЕРАКТИВНОЙ КАТЕГОРИЗАЦИИ === */
.category-select {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 0.9rem;
    width: 100%;
    min-width: 140px;
}

.category-select:focus {
    outline: none;
    border-color: var(--accent-color-start);
}

#save-status {
    color: var(--text-color);
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

/* === СТИЛИ ДЛЯ ПЕРЕКЛЮЧАТЕЛЯ ЯЗЫКОВ === */


.lang-switcher a, .lang-switcher span {
    color: var(--text-color);
    text-decoration: none;
    margin-left: 15px;
    font-weight: 600;
    font-size: 0.9rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.lang-switcher a:hover {
    opacity: 1;
}

.lang-switcher span.active {
    color: var(--primary-color);
    opacity: 1;
}

/* === СТИЛИ ДЛЯ ДИАГРАММЫ === */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
    margin-bottom: 20px;
}

.charts-row {
    display: flex;
    gap: 20px;
    width: 100%;
    margin-top: 20px;
}

.chart-wrapper {
    flex: 1;
    min-width: 0;
}

.chart-wrapper h3 {
    text-align: center;
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-color);
    margin-bottom: 15px;
}

/* Стили для кнопки удаления транзакции */
.actions-cell {
    text-align: center;
    width: 40px;
}

.delete-tx-btn {
    background: transparent;
    border: none;
    color: #ef4444;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    padding: 0 10px;
    line-height: 1;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.delete-tx-btn:hover {
    opacity: 1;
}

/* Стили для блока "Следующие шаги" */
.next-steps-container {
    background-color: rgba(15, 23, 42, 0.5);
    margin: 20px -40px -30px -40px;
    padding: 30px 40px;
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 20px 20px;
}

.next-steps-container h2 {
    text-align: center;
    border-bottom: none;
    margin-top: 0;
    margin-bottom: 20px;
}

.steps-buttons { 
    display: flex; 
    gap: 20px; 
}

.step-button {
    flex: 1; 
    display: block; 
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color); 
    border-radius: 12px; 
    padding: 20px;
    text-decoration: none; 
    transition: all 0.2s ease-in-out;
}

.step-button:hover { 
    transform: translateY(-3px); 
    background-color: rgba(255, 255, 255, 0.1); 
    border-color: var(--accent-color-start); 
}

.step-button-title { 
    display: block; 
    font-size: 1.1rem; 
    font-weight: 600; 
    color: var(--primary-color); 
    margin-bottom: 8px; 
}

.step-button-desc { 
    font-size: 0.9rem; 
    color: var(--text-color); 
    line-height: 1.5; 
}

/* Стиль для заблокированных кнопок */
.step-button.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.step-button.disabled:hover {
    transform: none;
    background-color: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color);
}

/* Стили для страницы управления финансами */
.analysis-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    text-align: left;
}

.category-item {
    margin-bottom: 25px;
}

.category-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 1rem;
}

.category-name {
    font-weight: 600;
    color: var(--primary-color);
}

.category-amount {
    font-weight: 600;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 4px;
}

.advice-tip {
    background-color: rgba(30, 41, 59, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 15px;
    margin-top: 10px;
    font-size: 0.9rem;
    line-height: 1.5;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Поддержка банков */
.supported-banks {
    width: 100%;
    max-width: 960px;
    margin-top: 40px;
    text-align: center;
}

.supported-banks h2 {
    text-align: center;
    border-bottom: none;
    font-weight: 400;
    font-size: 1.2rem;
    color: var(--text-color);
}

.logos-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin-top: 20px;
}

.logos-container span {
    font-size: 1.5rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    transition: color 0.2s;
}

/* Адаптация для средних экранов */
@media (max-width: 900px) {
    .analysis-grid {
        grid-template-columns: 1fr;
    }
    
    .summary-dashboard {
        grid-template-columns: 1fr 1fr;
    }
}

/* Дополнительные мелкие экраны */
@media (max-width: 480px) {
    .summary-dashboard {
        grid-template-columns: 1fr;
    }
    
    .steps-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .bank-selector {
        grid-template-columns: 1fr;
    }
}