/**
 * IRA Recommendations CSS
 * Phase 1: Account Suitability Analyzer
 * WCAG 2.1 AA Compliant
 * Matches dashboard.php design system (insights.css)
 */

/* Use the same design system as dashboard.php */
.ira-main-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header - matches insight-card-header style */
.ira-header {
    margin-bottom: 2rem;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    padding: 20px 24px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.ira-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary, #e2e8f0); /* WCAG AA: Light text on dark */
    font-weight: 700;
}

.ira-header .subtitle {
    color: var(--text-secondary, #94a3b8); /* WCAG AA: 4.5:1 contrast on dark */
    font-size: 1rem;
    margin-bottom: 1.5rem;
    font-weight: 400;
}

.header-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-refresh,
.btn-calculate {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    text-decoration: none; /* For links styled as buttons */
}

.btn-refresh {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white; /* WCAG AA: White on blue */
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-refresh:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.btn-calculate {
    background: linear-gradient(135deg, #029D6E 0%, #027a56 100%);
    color: white; /* WCAG AA: White on green */
    box-shadow: 0 4px 12px rgba(2, 157, 110, 0.3);
}

.btn-calculate:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(2, 157, 110, 0.4);
}

.btn-refresh:disabled,
.btn-calculate:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Account Columns Container */
.account-columns-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 3rem;
}

@media (max-width: 1200px) {
    .account-columns-container {
        grid-template-columns: 1fr;
    }
}

/* Account Column - matches insight-card style */
.account-column {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    padding: 20px 24px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border-top: 4px solid;
}

.roth-column {
    border-top-color: #ef4444; /* Red for aggressive growth */
}

.traditional-column {
    border-top-color: #3b82f6; /* Blue for balanced */
}

.brokerage-column {
    border-top-color: #029D6E; /* Green for tactical */
}

.account-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.account-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.account-icon {
    font-size: 1.5rem;
}

.account-title h2 {
    font-size: 1.5rem;
    margin: 0;
    color: var(--text-primary, #e2e8f0); /* WCAG AA: Light text on dark */
    font-weight: 600;
}

.account-info {
    text-align: right;
}

.cash-available {
    font-size: 0.9rem;
    color: var(--text-secondary, #94a3b8); /* WCAG AA: 4.5:1 contrast */
    font-weight: 600;
}

.strategy-note {
    font-size: 0.85rem;
    color: var(--text-secondary, #94a3b8); /* WCAG AA: 4.5:1 contrast */
    margin-bottom: 1.5rem;
    font-style: italic;
    font-weight: 400;
}

/* Recommendations List */
.recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 800px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.recommendations-list::-webkit-scrollbar {
    width: 6px;
}

.recommendations-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.recommendations-list::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 3px;
}

.recommendations-list::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5);
}

/* Recommendation Card - matches card style from insights.css */
.recommendation-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 8px;
    padding: 16px;
    transition: all 0.2s;
}

.recommendation-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(148, 163, 184, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.badges-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.foundation-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.stock-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.symbol {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--text-primary, #e2e8f0); /* WCAG AA: Light text on dark */
}

.company-name {
    font-size: 0.85rem;
    color: var(--text-secondary, #94a3b8); /* WCAG AA: 4.5:1 contrast */
}

/* Suitability Badge */
.suitability-badge {
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.suitability-badge.excellent {
    background: rgba(2, 157, 110, 0.2);
    color: #029D6E; /* WCAG AA: Light green on dark */
    border: 1px solid rgba(2, 157, 110, 0.4);
}

.suitability-badge.good {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa; /* WCAG AA: Light blue on dark */
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.suitability-badge.fair {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24; /* WCAG AA: Light yellow on dark */
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.suitability-badge.poor {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171; /* WCAG AA: Light red on dark */
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.suitability-badge.avoid {
    background: rgba(211, 47, 47, 0.3); /* Dark red background */
    color: #ffffff; /* White text for maximum contrast */
    border: 1px solid rgba(211, 47, 47, 0.6);
    font-weight: 700;
}

.recommendation-card.avoid {
    border-left: 4px solid #d32f2f;
    opacity: 0.8;
}

/* Card Price */
.card-price {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.price-label {
    font-size: 0.85rem;
    color: var(--text-secondary, #94a3b8); /* WCAG AA: 4.5:1 contrast */
    margin-right: 0.5rem;
}

.price-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary, #e2e8f0); /* WCAG AA: Light text on dark */
}

/* Card Metrics */
.card-metrics {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.metric {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.metric-label {
    font-size: 0.75rem;
    color: var(--text-secondary, #94a3b8); /* WCAG AA: 4.5:1 contrast */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.metric-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary, #e2e8f0); /* WCAG AA: Light text on dark */
}

/* Card Reasons */
.card-reasons {
    margin-bottom: 0.75rem;
}

.reasons-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.reasons-list li {
    font-size: 0.85rem;
    color: var(--text-secondary, #94a3b8); /* WCAG AA: 4.5:1 contrast */
    padding: 0.25rem 0;
    padding-left: 1.25rem;
    position: relative;
    font-weight: 400;
}

.reasons-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #029D6E; /* WCAG AA: Light green on dark */
    font-weight: bold;
}

/* Card Actions */
.card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.btn-research,
.btn-add-to-plan {
    flex: 1;
    padding: 0.5rem 1rem;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary, #e2e8f0); /* WCAG AA: Light text on dark */
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-research:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.4);
    color: #60a5fa;
}

.btn-add-to-plan:hover {
    background: rgba(2, 157, 110, 0.2);
    border-color: rgba(2, 157, 110, 0.4);
    color: #029D6E;
}

/* Comparison Section - matches insight-card style */
.comparison-section {
    margin-top: 3rem;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    padding: 20px 24px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.section-header {
    margin-bottom: 1.5rem;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.section-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary, #e2e8f0); /* WCAG AA: Light text on dark */
    font-weight: 600;
}

.section-header p {
    color: var(--text-secondary, #94a3b8); /* WCAG AA: 4.5:1 contrast */
    font-size: 0.95rem;
    font-weight: 400;
}

/* Comparison Table */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
}

.comparison-table thead {
    background: rgba(255, 255, 255, 0.05);
}

.comparison-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary, #e2e8f0); /* WCAG AA: Light text on dark */
    border-bottom: 2px solid rgba(148, 163, 184, 0.2);
    background: rgba(255, 255, 255, 0.05);
}

.comparison-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    color: var(--text-primary, #e2e8f0); /* WCAG AA: Light text on dark */
}

.comparison-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.account-col {
    text-align: center;
}

.roth-col {
    background: linear-gradient(to right, rgba(239, 68, 68, 0.1) 0%, transparent 20%);
}

.traditional-col {
    background: linear-gradient(to right, rgba(59, 130, 246, 0.1) 0%, transparent 20%);
}

.brokerage-col {
    background: linear-gradient(to right, rgba(2, 157, 110, 0.1) 0%, transparent 20%);
}

.score-badge {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

.score-badge.excellent {
    background: rgba(2, 157, 110, 0.2);
    color: #029D6E; /* WCAG AA: Light green on dark */
    border: 1px solid rgba(2, 157, 110, 0.4);
}

.score-badge.good {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa; /* WCAG AA: Light blue on dark */
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.score-badge.fair {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24; /* WCAG AA: Light yellow on dark */
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.score-badge.poor {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171; /* WCAG AA: Light red on dark */
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.score-badge.avoid {
    background: rgba(211, 47, 47, 0.3); /* Dark red background */
    color: #ffffff; /* White text for maximum contrast */
    border: 1px solid rgba(211, 47, 47, 0.6);
    font-weight: 700;
}

.no-data {
    color: var(--text-secondary, #94a3b8); /* WCAG AA: 4.5:1 contrast */
    font-style: italic;
}

.symbol-cell {
    font-weight: 600;
    color: var(--text-primary, #e2e8f0); /* WCAG AA: Light text on dark */
}

.best-fit-cell {
    font-weight: 600;
    color: var(--text-secondary, #94a3b8); /* WCAG AA: 4.5:1 contrast */
}

/* Loading States */
.loading-state,
.empty-state,
.error-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary, #94a3b8); /* WCAG AA: 4.5:1 contrast */
    background: transparent;
}

.loading-state .spinner {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
    animation: spin 2s linear infinite;
}

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

.empty-state p {
    margin-bottom: 1rem;
    color: var(--text-secondary, #94a3b8); /* WCAG AA: 4.5:1 contrast */
}

.error-state .error-message {
    font-size: 0.85rem;
    color: #f87171; /* WCAG AA: Light red on dark */
    margin-top: 0.5rem;
}

.btn-calculate-small,
.btn-retry {
    padding: 0.5rem 1rem;
    border: 1px solid rgba(59, 130, 246, 0.4);
    border-radius: 4px;
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa; /* WCAG AA: Light blue on dark */
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-calculate-small:hover,
.btn-retry:hover {
    background: rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.5);
}

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

.modal-content {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(148, 163, 184, 0.2);
    margin: 5% auto;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
    color: var(--text-primary, #e2e8f0); /* WCAG AA: Light text on dark */
    margin-bottom: 1rem;
}

.modal-content p,
.modal-content ul {
    color: var(--text-secondary, #94a3b8); /* WCAG AA: 4.5:1 contrast */
}

.modal-close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-secondary, #94a3b8); /* WCAG AA: 4.5:1 contrast */
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text-primary, #e2e8f0); /* WCAG AA: Light text on dark */
}

/* Warning Badge */
.warning-badge {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171; /* WCAG AA: Light red on dark */
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid rgba(239, 68, 68, 0.4);
    white-space: nowrap;
}

/* Earnings Warning Badge */
.earnings-warning {
    background: #ff9800;
    color: white; /* WCAG AA: White on orange */
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    margin-left: 4px;
    border: none;
}

/* Price Target Display */
.price-target-inline {
    font-size: 11px;
    margin-top: 6px;
    color: var(--text-secondary, #94a3b8); /* WCAG AA: 4.5:1 contrast */
}

.price-target-inline .upside {
    font-weight: 600;
    margin-left: 4px;
}

.upside.positive {
    color: #51cf66; /* WCAG AA: Light green on dark */
}

.upside.negative {
    color: #ff6b6b; /* WCAG AA: Light red on dark */
}

/* Insider Trading Display */
.insider-mini {
    font-size: 10px;
    color: var(--text-muted, #64748b); /* WCAG AA: Muted text */
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
}

.sentiment-positive {
    color: #51cf66; /* WCAG AA: Light green on dark */
    font-weight: 600;
}

.sentiment-negative {
    color: #ff6b6b; /* WCAG AA: Light red on dark */
    font-weight: 600;
}

.sentiment-neutral {
    color: var(--text-secondary, #94a3b8); /* WCAG AA: 4.5:1 contrast */
}

/* Comparison Matrix Container - Mobile Scrollable */
.comparison-matrix-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -24px;
    padding: 0 24px;
    width: calc(100% + 48px);
}

.comparison-matrix-container table {
    min-width: 800px;
    width: 100%;
}

/* Responsive */
@media (max-width: 768px) {
    .ira-main-content {
        padding: 1rem;
    }
    
    .account-columns-container {
        gap: 1rem;
    }
    
    .card-metrics {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .comparison-table {
        font-size: 0.85rem;
    }
    
    .comparison-table th,
    .comparison-table td {
        padding: 0.5rem;
    }
    
    /* Comparison Matrix Mobile Scrolling */
    #comparison-matrix {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        margin: 0 -16px !important;
        padding: 0 16px !important;
        width: calc(100% + 32px) !important;
        max-width: calc(100% + 32px) !important;
    }
    
    #comparison-matrix .comparison-table {
        min-width: 800px !important;
    }
    
    #comparison-matrix .comparison-table thead {
        position: sticky !important;
        top: 0 !important;
        background: #1e293b !important;
        z-index: 2 !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.2) !important;
    }
    
    /* Hide mobile-hide columns on mobile */
    .mobile-hide {
        display: none !important;
    }
}
