/* ===================================
   PORTFOLIO TRACKER - CSS STYLESHEET
   Version: 1.0 MVP
   =================================== */

/* ============ RESET & BASE ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette */
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --neutral-color: #6b7280;
    
    /* Backgrounds */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-card: #ffffff;
    --bg-header: #1f2937;
    
    /* Text Colors */
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    
    /* Borders */
    --border-color: #e5e7eb;
    --border-radius: 8px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============ HEADER & NAVIGATION ============ */
.header {
    background: linear-gradient(135deg, var(--bg-header) 0%, #0f172a 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-lg);
    flex-wrap: wrap;
}

.header-brand h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}

.header-tagline {
    margin: 0.25rem 0 0 0;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 400;
    letter-spacing: 0.1em;
}

/* Main Navigation */
.main-nav {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    justify-content: center;
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-width: 120px;
}

.nav-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    color: white;
    transform: translateY(-2px);
}

.nav-btn.active {
    background: rgba(37, 99, 235, 0.3);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.3);
}

.nav-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.nav-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.nav-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-coming-soon {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--warning-color);
    color: white;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Header Actions */
.header-actions {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: all 0.3s ease;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* Responsive Navigation */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    
    .main-nav {
        width: 100%;
        justify-content: space-around;
    }
    
    .nav-btn {
        min-width: auto;
        padding: 0.5rem 1rem;
    }
    
    .nav-icon {
        font-size: 1.25rem;
    }
    
    .nav-label {
        font-size: 0.625rem;
    }
}

/* ============ CONTAINER ============ */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
    width: 100%;
}

main.container {
    flex: 1;
    padding: var(--spacing-lg) var(--spacing-md);
}

/* ============ CARDS ============ */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    border: 1px solid var(--border-color);
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

/* ============ SUMMARY SECTION ============ */
.summary-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.summary-card {
    background: var(--bg-card);
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    text-align: center;
    cursor: default;
    transition: all 0.3s ease;
}

.summary-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.summary-card h3 {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--spacing-sm);
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: var(--spacing-xs) 0;
}

.metric-value:hover {
    color: var(--primary-color);
}

.metric-change {
    font-size: 0.875rem;
    font-weight: 500;
    margin-top: var(--spacing-xs);
}

.metric-change.positive {
    color: var(--success-color);
}

.metric-change.negative {
    color: var(--danger-color);
}

.metric-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: var(--spacing-xs);
}

.metric-change {
    font-size: 0.875rem;
    font-weight: 500;
    margin-top: var(--spacing-xs);
}

.metric-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: var(--spacing-xs);
}

/* Performance cards */
.performance-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
}

.performer-ticker {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: var(--spacing-xs) 0;
}

.performer-change {
    font-size: 1.25rem;
    font-weight: 600;
}

.performer-change.positive {
    color: var(--success-color);
}

.performer-change.negative {
    color: var(--danger-color);
}

.day-change-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin: var(--spacing-xs) 0;
}

.day-change-value.positive {
    color: var(--success-color);
}

.day-change-value.negative {
    color: var(--danger-color);
}

.day-change-pct {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Badge styles */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-winner {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.badge-loser {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

/* ============ CHARTS SECTION ============ */
.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.chart-container {
    position: relative;
    height: 300px;
    padding: var(--spacing-sm);
}

/* ============ FORM SECTION ============ */
.add-position-section {
    margin-bottom: var(--spacing-lg);
}

.position-form {
    margin-top: var(--spacing-md);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.form-group input,
.form-group select {
    padding: 0.625rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ============ BUTTONS ============ */
.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn-danger:hover {
    background-color: #dc2626;
}

/* ============ HOLDINGS TABLE ============ */
.holdings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.last-updated {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: var(--spacing-xs);
    font-style: italic;
}

/* Auto-refresh info */
.update-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.next-refresh {
    font-size: 0.75rem;
    color: var(--success-color);
    font-style: italic;
    animation: pulse 2s ease-in-out infinite;
}

.next-refresh span {
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

/* Auto-refresh button states */
.btn-auto-refresh-active {
    background-color: var(--success-color) !important;
    border-color: var(--success-color) !important;
}

.btn-auto-refresh-active:hover {
    background-color: #059669 !important;
}

/* Refresh notification */
.refresh-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    background: var(--success-color);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.refresh-notification.fade-out {
    animation: fadeOut 0.3s ease-out forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(400px);
    }
}

.holdings-actions {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    align-items: center;
}

.holdings-actions .btn {
    padding: 0.6rem 1rem;
    font-size: 0.875rem;
    white-space: nowrap;
}

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

.holdings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.holdings-table thead {
    background-color: var(--bg-secondary);
}

.holdings-table th {
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.holdings-table td {
    padding: 0.875rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.holdings-table tbody tr {
    transition: background-color 0.2s ease;
}

.holdings-table tbody tr:hover {
    background-color: var(--bg-secondary);
}

.holdings-table .ticker-cell {
    font-weight: 600;
    color: var(--primary-color);
}

.holdings-table .positive {
    color: var(--success-color);
    font-weight: 500;
}

.holdings-table .negative {
    color: var(--danger-color);
    font-weight: 500;
}

/* ============ EMPTY STATE ============ */
.empty-state {
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-md);
    color: var(--text-secondary);
}

.empty-state p:first-child {
    font-size: 2rem;
    margin-bottom: var(--spacing-sm);
}

.empty-state-subtitle {
    font-size: 0.875rem;
    color: var(--text-light);
}

.empty-state.hidden {
    display: none;
}

/* ============ FOOTER ============ */
.footer {
    background-color: var(--bg-header);
    color: #d1d5db;
    padding: var(--spacing-md) 0;
    text-align: center;
    font-size: 0.875rem;
    margin-top: auto;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.5rem;
    }
    
    .summary-section {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .charts-section {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .metric-value {
        font-size: 1.5rem;
    }
    
    .holdings-table {
        font-size: 0.75rem;
    }
    
    .holdings-table th,
    .holdings-table td {
        padding: 0.5rem 0.375rem;
    }
}

@media (max-width: 480px) {
    .summary-section {
        grid-template-columns: 1fr;
    }
    
    .holdings-header {
        flex-direction: column;
        gap: var(--spacing-sm);
        align-items: flex-start;
    }
}

/* ============ UTILITIES ============ */
.hidden {
    display: none !important;
}

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

.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }

/* ============ PRICE CHANGE INDICATORS ============ */
.price-change {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.price-change.up {
    color: var(--success-color);
}

.price-change.down {
    color: var(--danger-color);
}

.price-change.neutral {
    color: var(--text-secondary);
}

.price-arrow {
    font-size: 1rem;
    font-weight: bold;
}

.price-with-change {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.price-main {
    font-weight: 600;
}

.price-change-small {
    font-size: 0.75rem;
}

/* Tooltip for price change */
.price-tooltip {
    position: relative;
    cursor: help;
}

.price-tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-header);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 0.25rem;

    /* ============ LOADING & ANIMATIONS ============ */

    /* Skeleton loader */
    .skeleton {
        background: linear-gradient(
            90deg,
            var(--bg-secondary) 0%,
            #e0e0e0 50%,
            var(--bg-secondary) 100%
        );
        background-size: 200% 100%;
        animation: skeleton-loading 1.5s ease-in-out infinite;
        border-radius: 4px;
    }

    @keyframes skeleton-loading {
        0% {
            background-position: 200% 0;
        }
        100% {
            background-position: -200% 0;
        }
    }

    .skeleton-text {
        height: 1rem;
        margin: 0.25rem 0;
    }

    .skeleton-title {
        height: 1.5rem;
        width: 60%;
        margin: 0.5rem 0;
    }

    /* Loading spinner */
    .spinner {
        display: inline-block;
        width: 1rem;
        height: 1rem;
        border: 2px solid var(--border-color);
        border-top-color: var(--primary-color);
        border-radius: 50%;
        animation: spinner-rotate 0.8s linear infinite;
    }

    @keyframes spinner-rotate {
        to {
            transform: rotate(360deg);
        }
    }

    /* Pulse animation */
    @keyframes pulse {
        0%, 100% {
            opacity: 1;
        }
        50% {
            opacity: 0.5;
        }
    }

    .pulse {
        animation: pulse 2s ease-in-out infinite;
    }

    /* Fade in animation */
    @keyframes fadeIn {
        from {
            opacity: 0;
            transform: translateY(10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .fade-in {
        animation: fadeIn 0.3s ease-out;
    }

    /* Slide in animation */
    @keyframes slideIn {
        from {
            opacity: 0;
            transform: translateX(-20px);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }

    .slide-in {
        animation: slideIn 0.4s ease-out;
    }

    /* ============ HOVER EFFECTS ============ */

    /* Card hover effect */
    .card {
        transition: all 0.3s ease;
    }

    .card:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-lg);
    }

    /* Summary card hover */
    .summary-card {
        cursor: default;
        transition: all 0.2s ease;
    }

    .summary-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-lg);
        border-color: var(--primary-color);
    }

    /* Button hover improvements */
    .btn {
        position: relative;
        overflow: hidden;
        transition: all 0.3s ease;
    }

    .btn::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.2);
        transform: translate(-50%, -50%);
        transition: width 0.6s, height 0.6s;
    }

    .btn:hover::before {
        width: 300px;
        height: 300px;
    }

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

    /* Table row hover */
    .holdings-table tbody tr {
        transition: all 0.2s ease;
        cursor: pointer;
    }

    .holdings-table tbody tr:hover {
        background-color: var(--bg-secondary);
        transform: scale(1.01);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }

    /* ============ IMPROVED EMPTY STATES ============ */

    .empty-state {
        text-align: center;
        padding: var(--spacing-xl) var(--spacing-md);
        color: var(--text-secondary);
        animation: fadeIn 0.5s ease-out;
    }

    .empty-state-icon {
        font-size: 4rem;
        margin-bottom: var(--spacing-md);
        opacity: 0.3;
    }

    .empty-state p:first-child {
        font-size: 1.25rem;
        font-weight: 600;
        color: var(--text-primary);
        margin-bottom: var(--spacing-sm);
    }

    .empty-state-subtitle {
        font-size: 0.875rem;
        color: var(--text-light);
        margin-bottom: var(--spacing-md);
    }

    .empty-state-action {
        margin-top: var(--spacing-md);
    }

    /* ============ VISUAL FEEDBACK ============ */

    /* Success feedback */
    @keyframes successPulse {
        0%, 100% {
            box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
        }
        50% {
            box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
        }
    }

    .success-feedback {
        animation: successPulse 0.6s ease-out;
    }

    /* Error shake */
    @keyframes shake {
        0%, 100% {
            transform: translateX(0);
        }
        10%, 30%, 50%, 70%, 90% {
            transform: translateX(-4px);
        }
        20%, 40%, 60%, 80% {
            transform: translateX(4px);
        }
    }

    .error-shake {
        animation: shake 0.5s ease-out;
    }

    /* Number change animation */
    @keyframes numberChange {
        0% {
            transform: scale(1);
        }
        50% {
            transform: scale(1.1);
            color: var(--primary-color);
        }
        100% {
            transform: scale(1);
        }
    }

    .number-change {
        animation: numberChange 0.4s ease-out;
    }

    /* ============ FOCUS STATES ============ */

    .form-group input:focus,
    .form-group select:focus {
        outline: none;
        border-color: var(--primary-color);
        box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
        transform: translateY(-1px);
    }

    /* ============ LOADING OVERLAY ============ */

    .loading-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(255, 255, 255, 0.9);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        z-index: 9999;
        backdrop-filter: blur(4px);
    }

    .loading-overlay.hidden {
        display: none;
    }

    .loading-content {
        text-align: center;
    }

    .loading-spinner {
        width: 50px;
        height: 50px;
        border: 4px solid var(--border-color);
        border-top-color: var(--primary-color);
        border-radius: 50%;
        animation: spinner-rotate 0.8s linear infinite;
        margin: 0 auto var(--spacing-md);
    }

    .loading-text {
        font-size: 1.125rem;
        font-weight: 500;
        color: var(--text-primary);
        margin-bottom: var(--spacing-xs);
    }

    .loading-subtext {
        font-size: 0.875rem;
        color: var(--text-secondary);
    }
}

/* ============ VIEW CONTAINERS ============ */
.view-container {
    display: none;
}

.view-container.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

/* Coming Soon Placeholder */
.coming-soon-placeholder {
    max-width: 600px;
    margin: 4rem auto;
    text-align: center;
    padding: var(--spacing-xl);
}

.coming-soon-icon {
    font-size: 6rem;
    margin-bottom: var(--spacing-md);
    opacity: 0.3;
}

.coming-soon-placeholder h2 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.coming-soon-placeholder > p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-lg);
}

.coming-soon-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-sm);
    margin: var(--spacing-lg) 0;
    text-align: left;
}

.feature-item {
    padding: var(--spacing-sm);
    background: var(--bg-secondary);
    border-radius: 6px;
    border-left: 3px solid var(--primary-color);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.coming-soon-eta {
    margin-top: var(--spacing-lg);
    font-size: 0.875rem;
    color: var(--text-light);
    font-style: italic;
    padding: var(--spacing-sm);
    background: var(--bg-secondary);
    border-radius: 6px;
    display: inline-block;
}

/* ============ AI ADVISOR ============ */

.ai-advisor-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-lg) 0;
}

.ai-advisor-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.ai-advisor-header h2 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.ai-advisor-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* Advisory Styles Section */
.advisory-styles-section {
    margin-bottom: var(--spacing-xl);
}

.advisory-styles-section h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

.advisory-styles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.style-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.style-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.style-card.active {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, var(--bg-card) 100%);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.style-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-sm);
}

.style-name {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.style-investors {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
    font-style: italic;
}

.style-description {
    font-size: 0.875rem;
    color: var(--text-light);
    line-height: 1.4;
}

.selected-style-indicator {
    text-align: center;
    padding: var(--spacing-sm);
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    margin-top: var(--spacing-md);
}

.selected-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-right: var(--spacing-xs);
}

.selected-style-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* Quick Actions Section */
.quick-actions-section {
    margin-bottom: var(--spacing-xl);
}

.quick-actions-section h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

.quick-actions-buttons {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.quick-action-btn {
    flex: 1;
    min-width: 150px;
}

/* Chat Section */
.chat-section {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 600px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md);
    background: var(--bg-secondary);
}

.chat-message {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    animation: fadeIn 0.3s ease-out;
}

.message-avatar {
    font-size: 2rem;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message-content {
    flex: 1;
    background: white;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.ai-message .message-content {
    background: white;
}

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

.user-message .message-content {
    background: var(--primary-color);
    color: white;
}

.message-content p {
    margin: 0;
    line-height: 1.5;
}

.message-content p + p {
    margin-top: var(--spacing-sm);
}

.message-loading {
    display: inline-flex;
    gap: 0.25rem;
}

.message-loading span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    animation: pulse 1.4s ease-in-out infinite;
}

.message-loading span:nth-child(2) {
    animation-delay: 0.2s;
}

.message-loading span:nth-child(3) {
    animation-delay: 0.4s;
}

/* Chat Input */
.chat-input-container {
    display: flex;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background: white;
    border-top: 1px solid var(--border-color);
}

.chat-input {
    flex: 1;
    padding: var(--spacing-sm);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 0.875rem;
    resize: vertical;
    min-height: 44px;
    max-height: 120px;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.send-btn {
    align-self: flex-end;
    white-space: nowrap;
}

/* Responsive */
@media (max-width: 768px) {
    .advisory-styles-grid {
        grid-template-columns: 1fr;
    }
    
    .quick-actions-buttons {
        flex-direction: column;
    }
    
    .quick-action-btn {
        width: 100%;
    }
    
    .chat-container {
        height: 500px;
    }
}

/* ============ SETTINGS MODAL ============ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: fadeIn 0.3s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-body {
    padding: var(--spacing-lg);
}

.settings-section {
    margin-bottom: var(--spacing-lg);
}

.settings-section h3 {
    font-size: 1.125rem;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.settings-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
    line-height: 1.5;
}

.form-group {
    margin-bottom: var(--spacing-md);
    position: relative;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.help-link {
    font-size: 0.75rem;
    font-weight: normal;
    color: var(--primary-color);
    text-decoration: none;
    margin-left: var(--spacing-xs);
}

.help-link:hover {
    text-decoration: underline;
}

.form-group input[type="password"],
.form-group input[type="text"] {
    width: 100%;
    padding: var(--spacing-sm);
    padding-right: 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
}

.btn-icon {
    position: absolute;
    right: 8px;
    top: 32px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.25rem;
}

.api-key-status {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm);
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-md);
    font-size: 0.875rem;
}

.status-indicator {
    font-size: 1.25rem;
}

.settings-actions {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    flex-wrap: wrap;
}

.settings-note {
    background: #fff3cd;
    border-left: 4px solid var(--warning-color);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 4px;
    font-size: 0.875rem;
    color: #856404;
    line-height: 1.5;
}

/* ============ FIRE CALCULATOR ============ */

.fire-calc-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-lg) 0;
}

.fire-calc-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.fire-calc-header h2 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.fire-calc-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* Current Portfolio Summary */
.current-portfolio-section {
    margin-bottom: var(--spacing-xl);
}

.current-portfolio-section h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

.portfolio-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--spacing-md);
}

.portfolio-summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    text-align: center;
}

.portfolio-summary-card.total {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e40af 100%);
    color: white;
    border-color: var(--primary-color);
}

.summary-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.portfolio-summary-card.total .summary-label {
    color: rgba(255, 255, 255, 0.9);
}

.summary-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.portfolio-summary-card.total .summary-value {
    color: white;
}

.portfolio-summary-card.editable {
    background: white;
    border: 2px dashed var(--border-color);
}

.portfolio-edit-input {
    width: 100%;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    text-align: center;
    border: none;
    background: transparent;
    padding: var(--spacing-xs);
}

.portfolio-edit-input:focus {
    outline: none;
    background: var(--bg-secondary);
    border-radius: 4px;
}

.portfolio-hint {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-top: var(--spacing-sm);
    text-align: center;
}

.section-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
    line-height: 1.5;
}

/* Parameters Section */
.fire-params-section,
.allocation-section,
.growth-models-section,
.inflation-tax-section,
.withdrawal-strategy-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.fire-params-section h3,
.allocation-section h3,
.growth-models-section h3,
.inflation-tax-section h3,
.withdrawal-strategy-section h3 {
    font-size: 1.125rem;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

.params-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-md);
}

.param-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

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

.param-input,
.param-select {
    padding: var(--spacing-sm);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-family: inherit;
}

.param-input:focus,
.param-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.param-hint {
    font-size: 0.75rem;
    color: var(--text-light);
    font-style: italic;
}

/* Slider */
.slider-container {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.param-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-secondary);
    outline: none;
    -webkit-appearance: none;
}

.param-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

.param-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
}

.slider-value {
    min-width: 50px;
    font-weight: 600;
    color: var(--primary-color);
}

/* Allocation */
.allocation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--spacing-md);
}

.allocation-item {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

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

.alloc-input {
    padding: var(--spacing-sm);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    text-align: center;
    font-weight: 600;
}

.allocation-total {
    margin-top: var(--spacing-md);
    padding: var(--spacing-sm);
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    text-align: center;
    font-weight: 600;
    color: var(--text-primary);
}

.allocation-total.valid {
    color: var(--success-color);
}

.allocation-total.invalid {
    color: var(--danger-color);
}

/* Growth Models */
.model-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-md);
}

.model-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.model-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.radio-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.radio-label:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
}

.radio-label input[type="radio"] {
    cursor: pointer;
}

/* Actions */
.fire-actions-section {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    margin: var(--spacing-xl) 0;
}

.btn-large {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: 1rem;
    font-weight: 600;
}

/* Results */
.fire-results-section {
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-xl);
    border-top: 2px solid var(--border-color);
}

.fire-results-section.hidden {
    display: none;
}

.fire-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.fire-metric-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    text-align: center;
}

.metric-icon {
    font-size: 2.5rem;
    margin-bottom: var(--spacing-sm);
}

.metric-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: var(--spacing-xs);
}

.metric-detail {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* Charts */
.fire-chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.chart-header h4 {
    font-size: 1rem;
    color: var(--text-primary);
    margin: 0;
}

.timeline-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 0.875rem;
}

.timeline-select {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.875rem;
}

.fire-chart-container canvas {
    max-height: 400px;
}

/* Scenario Analysis */
.scenario-analysis {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
}

.scenario-analysis h4 {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

.scenario-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
}

.scenario-card {
    padding: var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    text-align: center;
}

.scenario-title {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

.scenario-impact {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 768px) {
    .fire-actions-section {
        flex-direction: column;
    }
    
    .btn-large {
        width: 100%;
    }
}

/* Portfolio Totals Row */
.totals-row {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border-top: 3px solid var(--primary-color);
    border-bottom: 2px solid var(--border-color);
    font-weight: 700;
}

.totals-row td {
    padding: var(--spacing-md) var(--spacing-sm);
    font-size: 1.05rem;
}

.totals-row .positive {
    color: var(--success-color);
}

.totals-row .negative {
    color: var(--danger-color);
}