/* ===================================
   CALCULATOR SPECIFIC STYLES - COMPACT VERSION
   =================================== */

/* Prevenir scroll horizontal en toda la sección de la calculadora */
#analisis-financiero {
    overflow-x: hidden;
}

#analisis-financiero * {
    box-sizing: border-box;
}

.calc-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1.5rem 0;
    text-align: center;
    box-shadow: var(--shadow-md);
}

.calc-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

.calc-header .subtitle {
    font-size: 0.95rem;
    opacity: 0.9;
    margin-bottom: 0.75rem;
}

.btn-back {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: var(--transition);
    font-size: 0.9rem;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.3);
}

.calc-main {
    padding: 1.5rem 0;
}

/* ===================================
   SCENARIO SELECTOR - COMPACT
   =================================== */
.scenario-selector {
    background: white;
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}

.scenarios-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.scenarios-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.scenario-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.scenarios-list {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.scenario-chip {
    padding: 0.4rem 0.8rem;
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: 2rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
}

.scenario-chip:hover {
    background: #e0e7ff;
    border-color: var(--primary-color);
}

.scenario-chip.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.scenario-chip .delete-scenario {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0;
    margin-left: 0.4rem;
}

/* ===================================
   COMPARISON TOGGLE
   =================================== */
.comparison-toggle {
    background: white;
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

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

.slider-switch {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.4s;
    border-radius: 28px;
}

.slider-switch:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

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

input:checked + .slider-switch:before {
    transform: translateX(22px);
}

/* ===================================
   CALC CONTENT
   =================================== */
.calc-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.calc-content.comparison-mode {
    grid-template-columns: 1fr 1fr;
}

.scenario-panel {
    background: white;
    border-radius: var(--radius-md);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.panel-header {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.75rem;
    margin-bottom: 1.25rem;
}

.panel-header h3 {
    font-size: 1.3rem;
    margin-bottom: 0.4rem;
}

.scenario-name {
    width: 100%;
    padding: 0.4rem 0.6rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    transition: var(--transition);
}

.scenario-name:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* ===================================
   CALC SECTIONS - COMPACT
   =================================== */
.calc-section {
    margin-bottom: 1.25rem;
    padding: 1rem;
    background: var(--bg-light);
    border-radius: var(--radius-md);
}

.calc-section-title {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
}

.calc-section-title i {
    color: var(--primary-color);
    font-size: 1rem;
}

/* ===================================
   INGRESOS Y EGRESOS LAYOUT
   =================================== */
.financial-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.income-section {
    background: #ecfdf5;
    border: 2px solid #10b981;
    border-radius: var(--radius-md);
    padding: 1rem;
}

.expense-section {
    background: #fef2f2;
    border: 2px solid #ef4444;
    border-radius: var(--radius-md);
    padding: 1rem;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid currentColor;
}

.income-section .section-header {
    color: #059669;
}

.expense-section .section-header {
    color: #dc2626;
}

.section-header h4 {
    font-size: 1rem;
    margin: 0;
    font-weight: 600;
}

.section-header i {
    font-size: 1.1rem;
}

/* ===================================
   PARAMETERS GRID - 4 COLUMNS
   =================================== */
.params-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.param-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.param-item label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.8rem;
}

.param-item input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 5px;
    background: var(--border-color);
    outline: none;
    -webkit-appearance: none;
}

.param-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

.param-item input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
}

.param-item output {
    text-align: center;
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.95rem;
}

/* ===================================
   INPUT HEADERS
   =================================== */
.input-headers {
    display: grid;
    grid-template-columns: 1fr 80px 80px 40px;
    gap: 0.4rem;
    padding: 0.4rem 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: #064e3b;
    text-transform: uppercase;
}

.expense-headers {
    grid-template-columns: 1fr 100px 40px;
    color: #7f1d1d;
}

.input-headers span {
    text-align: left;
}

.input-headers span:nth-child(2),
.input-headers span:nth-child(3) {
    text-align: center;
}

/* ===================================
   DYNAMIC LISTS - COMPACT
   =================================== */
.dynamic-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.dynamic-item {
    display: grid;
    grid-template-columns: 1fr 100px 40px;
    gap: 0.4rem;
    align-items: center;
    padding: 0.5rem;
    background: white;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.dynamic-item input[type="text"],
.dynamic-item input[type="number"] {
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.dynamic-item input[type="text"]:focus,
.dynamic-item input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

.dynamic-item .btn-remove {
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.4rem;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.75rem;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dynamic-item .btn-remove:hover {
    background: #dc2626;
}

.revenue-item {
    display: grid;
    grid-template-columns: 1fr 80px 80px 40px;
    gap: 0.4rem;
    align-items: center;
    padding: 0.5rem;
    background: white;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

/* ===================================
   BUTTONS - COMPACT
   =================================== */
.btn {
    padding: 0.4rem 0.8rem;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #64748b;
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

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

.btn-success:hover {
    background: #059669;
}

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

.btn-info:hover {
    background: var(--primary-color);
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

/* ===================================
   TOTAL BOX - COMPACT
   =================================== */
.total-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: white;
    border: 2px solid currentColor;
    border-radius: var(--radius-sm);
    margin-top: 0.75rem;
    font-size: 0.95rem;
}

.income-section .total-box {
    border-color: #10b981;
}

.expense-section .total-box {
    border-color: #ef4444;
}

.total-box strong {
    font-size: 0.9rem;
}

.total-box span {
    font-weight: 700;
    font-size: 1.1rem;
}

.income-section .total-box span {
    color: #059669;
}

.expense-section .total-box span {
    color: #dc2626;
}

/* ===================================
   RESULTS SECTION - COMPACT
   =================================== */
.results-section {
    background: linear-gradient(135deg, var(--bg-light) 0%, #e0e7ff 100%);
    padding: 1.25rem;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.result-card {
    background: white;
    padding: 1rem;
    border-radius: var(--radius-md);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.result-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    font-weight: 600;
}

.result-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}

.result-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 1rem;
    display: inline-block;
}

.result-status.positive {
    background: #d1fae5;
    color: #065f46;
}

.result-status.negative {
    background: #fee2e2;
    color: #991b1b;
}

.result-status.neutral {
    background: #fef3c7;
    color: #92400e;
}

/* ===================================
   MONTHLY SUMMARY - COMPACT
   =================================== */
.monthly-summary {
    background: white;
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
}

.monthly-summary h4 {
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-size: 1rem;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
}

.summary-item {
    text-align: center;
    padding: 0.75rem;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
}

.summary-item.positive {
    background: #d1fae5;
}

.summary-item.negative {
    background: #fee2e2;
}

.summary-item span {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    font-weight: 600;
}

.summary-item strong {
    font-size: 1.1rem;
    color: var(--text-primary);
}

/* ===================================
   CHARTS - COMPACT
   =================================== */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.chart-box {
    background: white;
    padding: 1rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.chart-box h4 {
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-size: 0.95rem;
}

/* ===================================
   CASH FLOW TABLE - COMPACT
   =================================== */
.table-container {
    background: white;
    padding: 1rem;
    border-radius: var(--radius-md);
}

.table-container h4 {
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.table-responsive {
    overflow-x: auto;
}

.cash-flow-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.cash-flow-table th,
.cash-flow-table td {
    padding: 0.5rem;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
}

.cash-flow-table th {
    background: var(--bg-light);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.75rem;
}

.cash-flow-table th:first-child,
.cash-flow-table td:first-child {
    text-align: left;
}

.cash-flow-table tbody tr:hover {
    background: var(--bg-light);
}

.cash-flow-table .positive-value {
    color: var(--success-color);
    font-weight: 600;
}

.cash-flow-table .negative-value {
    color: var(--danger-color);
    font-weight: 600;
}

.cash-flow-table .total-row {
    background: #e0e7ff;
    font-weight: 700;
}

/* ===================================
   MODAL
   =================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    width: 80%;
    max-width: 600px;
    box-shadow: var(--shadow-xl);
}

.close {
    color: var(--text-secondary);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: var(--text-primary);
}

#modalScenariosList {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.75rem;
}

.modal-scenario-item {
    padding: 0.75rem;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.modal-scenario-item:hover {
    background: #e0e7ff;
}

/* ===================================
   RESPONSIVE
   =================================== */
@media (max-width: 1200px) {
    .calc-content.comparison-mode {
        grid-template-columns: 1fr;
    }

    .financial-layout {
        grid-template-columns: 1fr;
    }

    .params-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .charts-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    /* Asegurar que todo use el mismo ancho del container */
    .scenario-selector,
    .calc-content,
    .scenario-panel,
    .calc-section {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .calc-header h1 {
        font-size: 1.3rem;
    }

    .scenarios-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .scenario-actions {
        width: 100%;
        flex-direction: column;
    }

    .scenario-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .params-grid {
        grid-template-columns: 1fr;
    }

    .financial-layout {
        grid-template-columns: 1fr;
    }

    .income-section,
    .expense-section {
        padding: 0.75rem;
    }

    .input-headers {
        display: none;
    }

    .dynamic-item {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .dynamic-item input[type="text"],
    .dynamic-item input[type="number"] {
        width: 100%;
    }

    .revenue-item {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .revenue-item input[type="text"],
    .revenue-item input[type="number"] {
        width: 100%;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .charts-container {
        grid-template-columns: 1fr;
    }

    .chart-box {
        min-width: 0;
        width: 100%;
    }

    .table-responsive {
        width: 100%;
        overflow-x: auto;
    }

    .cash-flow-table {
        font-size: 0.7rem;
        min-width: 500px;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 1rem;
    }

    /* Ajustar botones en móviles */
    .btn {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }

    .total-box {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    /* Ajustar padding del container en móviles */
    #analisis-financiero .container {
        padding: 0 1rem;
    }

    /* Asegurar que las fórmulas también sean responsive */
    .formulas-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Media query para pantallas muy pequeñas */
@media (max-width: 480px) {
    .scenario-selector {
        padding: 0.75rem;
    }

    .scenarios-header h2 {
        font-size: 1rem;
    }

    .scenario-panel {
        padding: 1rem;
    }

    .calc-section {
        padding: 0.75rem;
    }

    .calc-section-title {
        font-size: 1rem;
    }

    .result-card {
        padding: 0.75rem;
    }

    .result-value {
        font-size: 1.25rem;
    }

    .monthly-summary {
        padding: 0.75rem;
    }

    .chart-box {
        padding: 0.75rem;
    }

    .table-container {
        padding: 0.75rem;
    }

    /* Mejorar legibilidad de inputs en móviles pequeños */
    .dynamic-item input[type="text"],
    .dynamic-item input[type="number"],
    .revenue-item input[type="text"],
    .revenue-item input[type="number"] {
        font-size: 14px; /* Prevenir zoom en iOS */
    }
}

/* ===================================
   HIDE HERO IMAGE IN CALCULATOR
   =================================== */
.hero-image-section {
    display: none;
}

/* ===================================
   CHAT CON EXPERTO IA
   =================================== */
.ai-expert-container {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.ai-expert-header h3 {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin: 0 0 0.5rem 0;
}

.ai-expert-header p {
    color: var(--text-secondary);
    margin: 0 0 1.5rem 0;
    line-height: 1.6;
}

.chat-container {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.chat-messages {
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
    padding: 1.5rem;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ai-message,
.user-message {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.user-message {
    flex-direction: row-reverse;
}

.message-avatar {
    min-width: 40px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.ai-message .message-avatar {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.user-message .message-avatar {
    background: #64748b;
    color: white;
}

.message-content {
    flex: 1;
    padding: 0.875rem 1.125rem;
    border-radius: 1rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.ai-message .message-content {
    background: white;
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 0.25rem;
}

.user-message .message-content {
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.chat-input-area {
    padding: 1rem;
    background: white;
    border-top: 2px solid var(--border-color);
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.chat-input-area textarea {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    min-height: 60px;
    max-height: 150px;
}

.chat-input-area textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.chat-input-area .btn {
    padding: 0.75rem 1.5rem;
    white-space: nowrap;
}

/* ===================================
   CALCULATOR ACCORDION
   =================================== */
.calculator-section {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-top: 2rem;
}

.calculator-toggle {
    width: 100%;
    padding: 1.5rem 2rem;
    background: white;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 2px solid var(--border-color);
}

.calculator-toggle:hover {
    background: #f8fafc;
}

.toggle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.toggle-header > div {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

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

.toggle-header .fa-calculator {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.toggle-icon {
    color: var(--text-secondary);
    font-size: 1.25rem;
    transition: transform 0.3s ease;
}

.toggle-subtitle {
    margin: 0.5rem 0 0 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.calculator-content {
    padding: 2rem;
    animation: slideDown 0.3s ease-out;
}

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

/* Scenario Management within Calculator */
.scenario-management {
    background: #f8fafc;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    border: 2px solid var(--border-color);
}

.scenario-management .scenario-actions {
    margin-bottom: 1rem;
}

/* ===================================
   MODAL STYLES
   =================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
    margin-top: 0;
    color: var(--text-primary);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #000;
}

#modalScenariosList {
    max-height: 400px;
    overflow-y: auto;
}

.modal-scenario-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    background: white;
}

.modal-scenario-item:hover {
    border-color: var(--primary-color);
    background: #f8fafc;
}

.modal-scenario-item > div:first-child {
    flex: 1;
}

.modal-scenario-item > div:last-child {
    display: flex;
    gap: 0.5rem;
}

.modal-scenario-item strong {
    display: block;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.modal-scenario-item small {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ===================================
   RESPONSIVE - CHAT & ACCORDION
   =================================== */
@media (max-width: 768px) {
    .ai-expert-container {
        padding: 1.5rem 1rem;
    }

    .chat-messages {
        min-height: 250px;
        max-height: 400px;
        padding: 1rem;
    }

    .message-avatar {
        min-width: 36px;
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }

    .message-content {
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
    }

    .chat-input-area {
        flex-direction: column;
        gap: 0.5rem;
    }

    .chat-input-area .btn {
        width: 100%;
    }

    .calculator-toggle {
        padding: 1.25rem 1rem;
    }

    .toggle-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .toggle-header h3 {
        font-size: 1.15rem;
    }

    .calculator-content {
        padding: 1.5rem 1rem;
    }

    .modal-content {
        width: 95%;
        padding: 1.5rem 1rem;
    }

    .modal-scenario-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .modal-scenario-item > div:last-child {
        width: 100%;
    }

    .modal-scenario-item > div:last-child .btn {
        flex: 1;
    }
}
