﻿/* ============================================================
   ГРИД КАЛЬКУЛЯТОРОВ
============================================================ */
.calc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.8rem;
}

.calc-card-input,
.calc-card-result {
    background: #f8fafc;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
}

/* ============================================================
   ФОРМЫ
============================================================ */
.form-group {
    margin-bottom: 1rem;
}

    .form-group label {
        display: block;
        font-weight: 500;
        font-size: 0.9rem;
        color: #1e293b;
        margin-bottom: 0.25rem;
    }

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #ffffff;
}

    .form-control:focus {
        border-color: #6366f1;
        outline: none;
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    }

    .form-control:disabled {
        background: #f1f5f9;
        cursor: not-allowed;
        opacity: 0.6;
    }

select.form-control {
    appearance: auto;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

    .checkbox input[type="checkbox"] {
        width: 18px;
        height: 18px;
        accent-color: #6366f1;
        cursor: pointer;
    }

    .checkbox label {
        font-weight: 400;
        font-size: 0.95rem;
        color: #1e293b;
        cursor: pointer;
        margin-bottom: 0;
    }

/* ============================================================
   ДЕНЕЖНЫЙ ИНПУТ
============================================================ */
.input-with-currency {
    position: relative;
    display: flex;
    align-items: center;
}

    .input-with-currency .currency-symbol {
        position: absolute;
        left: 12px;
        font-weight: 600;
        color: #64748b;
        font-size: 0.95rem;
    }

    .input-with-currency .money-input {
        padding-left: 32px;
        text-align: right;
        font-weight: 500;
        font-size: 1rem;
    }

        .input-with-currency .money-input:focus {
            border-color: #6366f1;
            box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
        }

/* ============================================================
   ПОДСКАЗКИ
============================================================ */
.form-hint {
    display: block;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 0.2rem;
}

/* ============================================================
   КНОПКА
============================================================ */
.btn-calculate {
    width: 100%;
    padding: 0.7rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.3rem;
    letter-spacing: 0.3px;
}

    .btn-calculate:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 25px rgba(99, 102, 241, 0.35);
    }

    .btn-calculate:active {
        transform: translateY(0);
    }

/* ============================================================
   РЕЗУЛЬТАТЫ
============================================================ */
.result-container {
    padding: 0.2rem 0;
}

    .result-container h3 {
        color: #0f172a;
        font-size: 1.1rem;
        border-bottom: 2px solid #e2e8f0;
        padding-bottom: 0.6rem;
        margin-bottom: 1rem;
    }

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px solid #f1f5f9;
}

    .result-row:last-child {
        border-bottom: none;
    }

.result-label {
    color: #64748b;
    font-weight: 500;
    font-size: 0.95rem;
}

.result-value {
    font-weight: 600;
    color: #0f172a;
    font-size: 0.95rem;
}

    .result-value.highlight {
        color: #6366f1;
        font-size: 1.2rem;
    }

.result-formula {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid #f1f5f9;
}

    .result-formula h4 {
        color: #1e293b;
        font-size: 0.95rem;
        margin-bottom: 0.4rem;
    }

.formula-box {
    background: #ffffff;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #0f172a;
    border: 1px solid #e2e8f0;
    line-height: 1.6;
    overflow-x: auto;
    white-space: nowrap;
}

/* ============================================================
   ПЛЕЙСХОЛДЕР
============================================================ */
.placeholder-result {
    text-align: center;
    padding: 2.5rem 0;
    color: #94a3b8;
}

    .placeholder-result .placeholder-icon {
        font-size: 3.5rem;
        margin-bottom: 0.6rem;
    }

    .placeholder-result p {
        font-size: 0.95rem;
        margin: 0;
    }

/* ============================================================
   ГРАФИКИ
============================================================ */
.chart-container {
    margin-top: 1.8rem;
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #f1f5f9;
}

    .chart-container h3 {
        color: #0f172a;
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }

.chart-wrapper {
    position: relative;
    width: 100%;
    height: 350px;
    min-height: 250px;
}

    .chart-wrapper canvas {
        width: 100% !important;
        height: 100% !important;
        max-height: 350px;
    }

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 0.8rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: #475569;
}

.legend-color {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

/* ============================================================
   ТАБЛИЦА
============================================================ */
.comparison-table {
    margin-top: 1.8rem;
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #f1f5f9;
    overflow-x: auto;
}

    .comparison-table h3 {
        color: #0f172a;
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }

.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

    .table thead th {
        background: #f8fafc;
        color: #475569;
        font-weight: 600;
        padding: 0.6rem 1rem;
        text-align: left;
        border-bottom: 2px solid #e2e8f0;
    }

    .table tbody td {
        padding: 0.5rem 1rem;
        border-bottom: 1px solid #f1f5f9;
        color: #1e293b;
    }

    .table tbody tr:hover {
        background: #f8fafc;
    }

    .table tbody tr:last-child td {
        border-bottom: none;
    }

    .table tfoot td {
        font-weight: 700;
        background: #f1f5f9;
        border-top: 2px solid #e2e8f0;
    }

/* ============================================================
   ТИП АННУИТЕТА
============================================================ */
.annuity-type-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
}

    .annuity-type-label.active,
    .annuity-type-label:has(input:checked) {
        border-color: #6366f1;
        background: rgba(99, 102, 241, 0.08);
    }

/* ============================================================
   АДАПТИВ
============================================================ */
@media (max-width: 992px) {
    .calc-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }
}

@media (max-width: 768px) {
    .finance-page {
        padding: 0.5rem 0 2rem;
    }

    .finance-section {
        padding: 1rem 0.8rem;
    }

        .finance-section h2 {
            font-size: 1.15rem;
        }

    .calc-card-input,
    .calc-card-result {
        padding: 1rem;
    }

    .result-value.highlight {
        font-size: 1rem;
    }

    .formula-box {
        font-size: 0.8rem;
        white-space: normal;
        word-break: break-all;
    }

    .chart-container {
        padding: 0.8rem;
    }

    .chart-wrapper {
        height: 280px;
        min-height: 200px;
    }

        .chart-wrapper canvas {
            max-height: 280px;
        }

    .comparison-table {
        padding: 0.8rem;
    }

    .table {
        font-size: 0.8rem;
    }

        .table thead th,
        .table tbody td {
            padding: 0.4rem 0.6rem;
        }
}

@media (max-width: 480px) {
    .finance-header h1 {
        font-size: 1.4rem;
    }

    .finance-header .finance-desc {
        font-size: 0.9rem;
    }

    .finance-section h2 {
        font-size: 1rem;
    }

    .form-group label {
        font-size: 0.8rem;
    }

    .form-control {
        font-size: 0.85rem;
        padding: 0.4rem 0.6rem;
    }

    .btn-calculate {
        font-size: 0.9rem;
        padding: 0.6rem;
    }

    .result-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.2rem;
        padding: 0.4rem 0;
    }

    .result-value.highlight {
        font-size: 1.1rem;
    }

    .table {
        font-size: 0.7rem;
    }

        .table thead th,
        .table tbody td {
            padding: 0.3rem 0.4rem;
        }

    .input-with-currency .money-input {
        padding-left: 28px;
        font-size: 0.85rem;
    }

    .input-with-currency .currency-symbol {
        font-size: 0.8rem;
        left: 8px;
    }

    .chart-wrapper {
        height: 220px;
        min-height: 180px;
    }

        .chart-wrapper canvas {
            max-height: 220px;
        }
}


/* ============================================================
   3 страница planing
============================================================ */

.planning-table td input[readonly] {
    background-color: #f1f5f9;
    cursor: not-allowed;
}

.planning-table .header-row {
    background-color: #e2e8f0;
    font-weight: 600;
}

    .planning-table .header-row td {
        font-weight: 600;
    }

.planning-table .total-row {
    background-color: #f8fafc;
    font-weight: 600;
}

.planning-table .calculated-row {
    background-color: #f1f5f9;
}

.planning-table .profit-row {
    background-color: #d1fae5;
    font-weight: 700;
}

.planning-table .section-total-row {
    background-color: #fef3c7;
    font-weight: 600;
}

.level-0 {
    padding-left: 0px;
}

.level-1 {
    padding-left: 20px;
}

.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.8);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

    .loading-overlay.active {
        display: flex;
    }

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.btn-compact-recalculate {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    border: none;
    padding: 0.5rem 1.75rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

    .btn-compact-recalculate:hover:not(:disabled) {
        background: linear-gradient(135deg, #1d4ed8, #1e40af);
        box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
    }

    .btn-compact-recalculate:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

.npv-block {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 2rem;
}

    .npv-block.error {
        background: #fef2f2;
        border-color: #ef4444;
    }

        .npv-block.error h3 {
            color: #991b1b;
        }

        .npv-block.error p {
            color: #991b1b;
        }

.npv-warning {
    display: none;
    color: #ef4444;
    font-size: 0.9rem;
}