/* frontend/styles/economics.css v8.6 */
/* Premium Modal Design - Ultra Clean & Focused */

/* ========================================
   ECONOMICS CONTAINER
   ======================================== */

.economics-container {
    padding: 0;
    max-width: 440px;
    margin: 0 auto;
    background: transparent;
}

/* Header */
.economics-header {
    text-align: left;
    margin-bottom: 24px;
    padding: 0;
    border: none;
}

.economics-header h3 {
    font-size: 22px;
    font-weight: 700;
    color: #1d1d1f;
    margin: 0;
    letter-spacing: -0.02em;
}

.economics-subtitle {
    font-size: 13px;
    color: #86868b;
    margin: 4px 0 0 0;
    letter-spacing: -0.01em;
}

/* ========================================
   SEGMENTED CONTROL - iOS 26 Perfect
   ======================================== */

.economics-mode-selector {
    display: inline-flex;
    position: relative;
    margin: 0 0 28px 0;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 9px;
    padding: 2px;
    gap: 0;
}

.economics-mode-selector::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: calc(50% - 2px);
    height: calc(100% - 4px);
    background: white;
    border-radius: 12px;
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.12),
        0 1px 2px rgba(0, 0, 0, 0.08);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 0;
}

.economics-mode-selector[data-active="investor"]::before {
    transform: translateX(100%);
}

.economics-mode-btn {
    background: transparent;
    border: none;
    border-radius: 12px;
    padding: 7px 20px;
    cursor: pointer;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 130px;
    transition: opacity 0.2s ease;
    position: relative;
    z-index: 1;
}

.economics-mode-btn:hover {
    opacity: 0.7;
}

/* FIX: HTML uses .mode-label, not .economics-mode-label */
.mode-label {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.01em;
    transition: color 0.2s ease;
    color: #86868b;
}

.economics-mode-btn.active .mode-label {
    color: #1d1d1f;
}

/* FIX: HTML uses .mode-icon, not .economics-mode-icon */
.mode-icon {
    width: 16px;
    height: 16px;
    transition: color 0.2s ease;
    color: #86868b;
    stroke-width: 2.5;
}

.economics-mode-btn.active .mode-icon {
    color: #007AFF;
}

/* ========================================
   SAVED SCENARIOS - Modern Accordion
   ======================================== */

.saved-scenarios-section {
    margin-bottom: 20px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.saved-scenarios-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.saved-scenarios-header:hover {
    background: rgba(0, 0, 0, 0.02);
}

.saved-scenarios-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #424245;
}

/* SVG Icon for scenarios */
.scenarios-icon {
    width: 16px;
    height: 16px;
    color: #86868b;
    flex-shrink: 0;
}

.accordion-icon {
    font-size: 10px;
    color: #86868b;
    transition: transform 0.2s ease;
}

.saved-scenarios-section.open .accordion-icon {
    transform: rotate(180deg);
}

.saved-scenarios-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.saved-scenarios-section.open .saved-scenarios-content {
    max-height: 400px;
    padding: 0 10px 10px;
}

.saved-scenario-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: white;
    border-radius: 8px;
    margin-bottom: 6px;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.saved-scenario-item:last-child {
    margin-bottom: 0;
}

.scenario-info {
    flex: 1;
    min-width: 0;
}

.scenario-name {
    font-size: 13px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scenario-date {
    font-size: 11px;
    color: #86868b;
}

.btn-load-scenario {
    padding: 6px 14px;
    background: #007AFF;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-load-scenario:hover {
    background: #0051D5;
    transform: scale(1.05);
}

.btn-load-scenario:active {
    transform: scale(0.98);
}

/* ========================================
   FORM WRAPPER
   ======================================== */

.economics-form-wrapper {
    background: transparent;
    padding: 0;
    border: none;
    margin: 0;
}

/* ========================================
   SECTION CARDS - Ultra Minimal
   ======================================== */

.form-section {
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.form-section:hover {
    border-color: rgba(0, 0, 0, 0.12);
    background: rgba(0, 0, 0, 0.01);
}

.form-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #86868b;
    margin: 0 0 10px 0;
}


/* ========================================
   GRID SYSTEM - 2 Column Optimized
   ======================================== */

.form-row-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 0;
}

.form-row-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 6px;
    margin-bottom: 0;
}

@media (max-width: 400px) {
    .form-row-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .form-row-grid-3 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ========================================
   FORM FIELDS
   ======================================== */

.form-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.form-field label {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 600;
    color: #86868b;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.form-field-optional input {
    background: rgba(247, 247, 252, 0.4);
    color: #424245;
}

/* Required Indicator */
.required {
    color: #FF3B30;
    margin-left: 1px;
}

/* ========================================
   INPUT SIZING
   ======================================== */

.input-small {
    max-width: 100%;
    min-width: 0;
}

.input-medium {
    max-width: 140px;
}

.input-large {
    max-width: 100%;
}

/* ========================================
   INPUT FIELDS - Clean & Perfect
   ======================================== */

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-group input {
    width: 100%;
    padding: 9px 44px 9px 11px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    color: #1d1d1f;
    background: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    transition: all 0.2s ease;
    letter-spacing: -0.01em;
}

.input-group input:hover {
    border-color: rgba(0, 122, 255, 0.25);
}

.input-group input:focus {
    outline: none;
    border-color: #007AFF;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.08);
}

.input-group input::placeholder {
    color: #86868b;
    font-weight: 400;
}

/* Input Suffix */
.input-suffix {
    position: absolute;
    right: 11px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    font-weight: 600;
    color: #86868b;
    pointer-events: none;
}

/* ========================================
   SELECT DROPDOWNS - iOS Style
   ======================================== */

.form-row select,
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 100%;
    padding: 9px 32px 9px 11px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    color: #1d1d1f;
    background: white url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"><path fill="%2386868b" d="M6 9L1 4h10z"/></svg>') no-repeat right 11px center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    cursor: pointer;
    transition: all 0.2s ease;
}

select:hover {
    border-color: rgba(0, 122, 255, 0.25);
}

select:focus {
    outline: none;
    border-color: #007AFF;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.08);
}

/* ========================================
   FORM HINTS
   ======================================== */

.form-hint {
    font-size: 11px;
    color: #86868b;
    margin: 3px 0 0 0;
    padding: 4px 8px;
    background: rgba(0, 122, 255, 0.04);
    border-radius: 8px;
    border-left: 1.5px solid rgba(0, 122, 255, 0.25);
    letter-spacing: -0.01em;
    line-height: 1.4;
}

/* ========================================
   INFO ICONS WITH TOOLTIPS
   ======================================== */

.info-icon-svg {
    width: 13px;
    height: 13px;
    color: #007AFF;
    margin-left: 3px;
    opacity: 0.5;
    flex-shrink: 0;
    cursor: help;
    transition: opacity 0.2s ease;
    position: relative;
}

.info-icon-svg:hover {
    opacity: 0.8;
    cursor: help;
}

/* ========================================
   OPTIONAL FIELDS DISCLOSURE
   ======================================== */

.optional-section {
    margin-top: 12px;
}

.optional-header {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: #86868b;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: background 0.2s ease;
}

.optional-header:hover {
    background: rgba(0, 0, 0, 0.04);
}

.optional-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.optional-section.open .optional-content {
    max-height: 300px;
    padding-top: 12px;
}

.optional-section .accordion-icon {
    font-size: 14px;
    transition: transform 0.2s ease;
}

.optional-section.open .accordion-icon {
    transform: rotate(90deg);
}

/* ========================================
   RESULTS SECTION
   ======================================== */

.economics-results {
    background: rgba(0, 122, 255, 0.05);
    border-radius: 10px;
    padding: 16px;
    border: 1px solid rgba(0, 122, 255, 0.12);
    margin-top: 16px;
}

.economics-results h4 {
    font-size: 15px;
    font-weight: 700;
    color: #1d1d1f;
    margin: 0 0 12px 0;
    letter-spacing: -0.015em;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: white;
    border-radius: 12px;
    margin-bottom: 6px;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.result-item:last-child {
    margin-bottom: 0;
}

.result-label {
    font-size: 13px;
    font-weight: 600;
    color: #424245;
    letter-spacing: -0.01em;
}

.result-value {
    font-size: 15px;
    font-weight: 700;
    color: #1d1d1f;
    letter-spacing: -0.015em;
}

.result-value.positive {
    color: #34C759;
}

.result-value.negative {
    color: #FF3B30;
}

/* ========================================
   ACTION BUTTONS
   ======================================== */

.economics-actions,
.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 20px;
}

.btn-primary {
    flex: 1;
    padding: 11px 18px;
    background: linear-gradient(180deg, #007AFF 0%, #0051D5 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 2px 6px rgba(0, 122, 255, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.2s ease;
}

.btn-icon {
    width: 15px;
    height: 15px;
    stroke: currentColor;
}

.btn-text {
    display: inline;
}

.btn-primary:hover {
    background: linear-gradient(180deg, #0051D5 0%, #003D99 100%);
    transform: translateY(-1px);
    box-shadow:
        0 4px 10px rgba(0, 122, 255, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

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

.btn-secondary {
    flex: 1;
    padding: 11px 18px;
    background: white;
    color: #007AFF;
    border: 1px solid rgba(0, 122, 255, 0.2);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: -0.01em;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: rgba(0, 122, 255, 0.06);
    border-color: #007AFF;
}

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

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .economics-container {
        max-width: 100%;
    }

    .economics-mode-btn {
        min-width: 110px;
        padding: 7px 16px;
    }

    .form-section {
        padding: 12px;
    }
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-section {
    animation: fadeIn 0.25s ease-out;
}

.form-field {
    animation: fadeIn 0.25s ease-out;
}

/* Stagger delays */
.form-field:nth-child(1) { animation-delay: 0.02s; }
.form-field:nth-child(2) { animation-delay: 0.04s; }
.form-field:nth-child(3) { animation-delay: 0.06s; }
.form-field:nth-child(4) { animation-delay: 0.08s; }
.form-field:nth-child(5) { animation-delay: 0.1s; }
.form-field:nth-child(6) { animation-delay: 0.12s; }

/* ========================================
   TOOLTIP FOR INFO ICONS
   ======================================== */

.info-tooltip {
    position: fixed;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
    max-width: 220px;
    pointer-events: none;
    z-index: 10000;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.info-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}
