/* ========================================
   FIXED INCOME DASHBOARD - STYLES
   Professional Finance UI
   ======================================== */

/* ========== CSS VARIABLES ========== */
:root {
    --primary-green: #2E7D32;
    --primary-green-light: #4CAF50;
    --primary-green-dark: #1B5E20;
    --background: #F5F7FA;
    --white: #FFFFFF;
    --card-bg: #FFFFFF;
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --card-shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
    --border-color: #E0E4E8;
    --text-primary: #1A1A2E;
    --text-secondary: #5A6474;
    --text-muted: #8B95A5;
    --badge-municipal: #E3F2FD;
    --badge-municipal-text: #1565C0;
    --badge-cd: #FFF3E0;
    --badge-cd-text: #E65100;
    --badge-treasury: #E8F5E9;
    --badge-treasury-text: #2E7D32;
    --badge-corporate: #F3E5F5;
    --badge-corporate-text: #7B1FA2;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --transition: all 0.2s ease;
}

/* ========== RESET & BASE ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ========== HEADER ========== */
.header {
    background-color: var(--white);
    border-bottom: 1px solid var(--border-color);
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-green);
    letter-spacing: -0.5px;
}

.nav {
    display: flex;
    gap: 32px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    padding: 20px 0;
    position: relative;
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--primary-green);
}

.nav-link.active {
    color: var(--primary-green);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background-color: var(--primary-green);
    border-radius: 3px 3px 0 0;
}

.nav-link.logout-link {
    color: #ff6b6b;
    margin-left: 20px;
    padding: 8px 16px;
    border: 1px solid #ff6b6b;
    border-radius: 6px;
}

.nav-link.logout-link:hover {
    background-color: #ff6b6b;
    color: white;
}

/* ========== MAIN CONTENT ========== */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* ========== WELCOME SECTION ========== */
.welcome-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 32px;
    margin-bottom: 40px;
}

.welcome-text {
    flex: 1;
}

.welcome-text h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.welcome-text p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    max-width: 600px;
}

.timestamp {
    font-size: 13px;
    color: var(--text-muted);
}

.market-value-card {
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-green-dark) 100%);
    color: var(--white);
    padding: 24px 32px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 20px rgba(46, 125, 50, 0.3);
    min-width: 280px;
}

.market-value-icon {
    width: 56px;
    height: 56px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.market-value-content {
    display: flex;
    flex-direction: column;
}

.market-value-label {
    font-size: 13px;
    opacity: 0.9;
    margin-bottom: 4px;
}

.market-value-amount {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* ========== BONDS & CDS SECTION ========== */
.bonds-section {
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.info-link {
    font-size: 14px;
    color: var(--primary-green);
    text-decoration: none;
    font-weight: 500;
}

.info-link:hover {
    text-decoration: underline;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}

.stat-card {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-2px);
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: block;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

/* ========== PROGRESS BAR ========== */
.progress-bar-section {
    margin-bottom: 32px;
}

.progress-bar {
    height: 8px;
    background-color: #E8F5E9;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-green) 0%, var(--primary-green-light) 100%);
    border-radius: 4px;
    transition: width 0.8s ease;
    width: 0%;
}

/* ========== TWO COLUMN SECTION ========== */
.two-column-section {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.bottom-section {
    grid-template-columns: 1fr 1fr;
}

/* ========== CARDS ========== */
.card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.position-count {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 400;
}

.see-more-btn {
    background-color: transparent;
    border: 1px solid var(--primary-green);
    color: var(--primary-green);
    padding: 8px 16px;
    border-radius: var(--border-radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.see-more-btn:hover {
    background-color: var(--primary-green);
    color: var(--white);
}

/* ========== POSITIONS TABLE ========== */
.table-container {
    overflow-x: auto;
}

.positions-table {
    width: 100%;
    border-collapse: collapse;
}

.positions-table th,
.positions-table td {
    padding: 14px 16px;
    text-align: left;
    font-size: 14px;
}

.positions-table th {
    background-color: #F8FAFC;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.positions-table th.highlight-col {
    background-color: #E8F5E9;
    color: var(--primary-green-dark);
}

.positions-table td.highlight-col {
    background-color: #F1F8E9;
    color: var(--primary-green-dark);
    font-weight: 600;
}

.positions-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.positions-table tbody tr:nth-child(even) {
    background-color: #FAFBFC;
}

.positions-table tbody tr:hover {
    background-color: #F0F4F8;
}

.positions-table td:last-child {
    font-weight: 600;
    color: var(--text-primary);
}

/* ========== ASSET BADGES ========== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-municipal {
    background-color: var(--badge-municipal);
    color: var(--badge-municipal-text);
}

.badge-cd {
    background-color: var(--badge-cd);
    color: var(--badge-cd-text);
}

.badge-treasury {
    background-color: var(--badge-treasury);
    color: var(--badge-treasury-text);
}

.badge-corporate {
    background-color: var(--badge-corporate);
    color: var(--badge-corporate-text);
}

/* ========== CHART CARD ========== */
.chart-card {
    display: flex;
    flex-direction: column;
}

.chart-container {
    padding: 20px 24px;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

#cashFlowChart {
    max-height: 280px;
}

/* ========== ANALYTICS CARD ========== */
.analytics-content {
    padding: 24px;
}

.analytics-bar {
    margin-bottom: 20px;
}

.analytics-bar:last-child {
    margin-bottom: 0;
}

.analytics-bar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.analytics-bar-label {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.analytics-bar-percentage {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
}

.analytics-bar-track {
    height: 10px;
    background-color: #E8ECF0;
    border-radius: 5px;
    overflow: hidden;
}

.analytics-bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.8s ease;
}

.analytics-bar-fill.municipal {
    background-color: #1565C0;
}

.analytics-bar-fill.cd {
    background-color: #E65100;
}

.analytics-bar-fill.treasury {
    background-color: #2E7D32;
}

.analytics-bar-fill.corporate {
    background-color: #7B1FA2;
}

/* ========== BOND LADDER CARD ========== */
.ladder-container {
    padding: 24px;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 280px;
    gap: 20px;
}

.ladder-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    max-width: 100px;
}

.ladder-bar {
    width: 100%;
    background: linear-gradient(180deg, var(--primary-green-light) 0%, var(--primary-green) 100%);
    border-radius: var(--border-radius-sm) var(--border-radius-sm) 0 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 12px;
    transition: var(--transition);
    position: relative;
}

.ladder-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, transparent 100%);
    border-radius: var(--border-radius-sm) var(--border-radius-sm) 0 0;
}

.ladder-bar:hover {
    transform: scaleY(1.05);
    transform-origin: bottom;
}

.ladder-years {
    color: var(--white);
    font-size: 13px;
    font-weight: 600;
    position: relative;
}

.ladder-label {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 600;
    text-align: center;
}

/* ========== FOOTER ========== */
.footer {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 13px;
    border-top: 1px solid var(--border-color);
    background-color: var(--white);
    margin-top: 40px;
}

/* ========== RESPONSIVE DESIGN ========== */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .two-column-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        height: auto;
        padding: 16px 0;
        gap: 16px;
    }
    
    .nav {
        gap: 16px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .welcome-section {
        flex-direction: column;
    }
    
    .market-value-card {
        width: 100%;
        min-width: auto;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .welcome-text h1 {
        font-size: 24px;
    }
    
    .stat-value {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .nav {
        gap: 12px;
    }
    
    .main-content {
        padding: 16px;
    }
}

/* ========== MODAL ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
}

.modal-content.modal-lg {
    max-width: 900px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-header h2 span {
    font-weight: 400;
    color: var(--text-muted);
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-body .table-container {
    max-height: none;
}

.modal-body .positions-table {
    width: 100%;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}
