/* ==========================================================================
   Retirement Wealth-Management Design System (Accessibility & Calm UI)
   ========================================================================== */

:root {
    --ret-navy-dark: #0a2540;
    --ret-navy-primary: #103158;
    --ret-blue-accent: #1e5aa8;
    --ret-blue-soft: #ebf3fc;
    --ret-green-dark: #165b37;
    --ret-green-light: #e8f6ee;
    --ret-amber-dark: #925409;
    --ret-amber-light: #fef7ec;
    --ret-purple-dark: #553c9a;
    --ret-purple-light: #f3eefc;
    --ret-neutral-bg: #f5f7fa;
    --ret-card-bg: #ffffff;
    --ret-border-color: #d2dbe5;
    --ret-border-focus: #1a56a0;
    --ret-text-primary: #121826;
    --ret-text-secondary: #475569;
    --ret-text-muted: #64748b;
    --ret-font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Universal Viewport & Overflow Containment */
html {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
}

body {
    font-family: var(--ret-font-body);
    font-size: 18px;
    line-height: 1.65;
    color: var(--ret-text-primary);
    background-color: var(--ret-neutral-bg);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
    position: relative;
}

/* Ensure images, media & tables never trigger horizontal scroll blowout */
img, svg, video, canvas, audio, iframe {
    max-width: 100% !important;
    height: auto;
}

*, *::before, *::after {
    box-sizing: border-box;
}

/* Word wrapping safety for long headings & URLs (excluding tables) */
p, span, h1, h2, h3, h4, h5, h6, a, li {
    overflow-wrap: break-word;
    word-break: break-word;
}

table th, table td {
    word-break: normal !important;
    overflow-wrap: normal !important;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--ret-navy-dark);
    font-weight: 700;
    line-height: 1.3;
}

/* Large, Legible Headings */
.ret-page-title {
    font-size: 34px;
    font-weight: 800;
    color: var(--ret-navy-dark);
    margin-bottom: 8px;
}

.ret-section-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--ret-navy-dark);
    margin-bottom: 16px;
}

.ret-subtitle {
    font-size: 19px;
    color: var(--ret-text-secondary);
    line-height: 1.5;
}

/* Accessible Interactive Elements */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 3px solid var(--ret-border-focus) !important;
    outline-offset: 2px !important;
}

/* Base Components */
.rp-card {
    background: #ffffff;
    border: 2px solid var(--ret-border-color);
    border-radius: 16px;
    padding: 32px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.25s ease-in-out;
}

.rp-card:hover {
    border-color: var(--ret-navy-primary);
    box-shadow: 0 10px 28px rgba(10, 37, 64, 0.1);
    transform: translateY(-2px);
}

.rp-btn-primary {
    background-color: var(--ret-navy-primary);
    color: #ffffff !important;
    border-color: var(--ret-navy-primary);
    font-size: 18px;
    font-weight: 600;
    padding: 14px 28px;
    min-height: 52px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
    border: 2px solid transparent;
}

.rp-btn-primary:hover, .rp-btn-primary:focus {
    background-color: var(--ret-navy-dark);
    border-color: var(--ret-navy-dark);
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(10, 37, 64, 0.15);
}

.rp-btn-secondary {
    background-color: #ffffff;
    color: var(--ret-navy-primary) !important;
    border-color: var(--ret-navy-primary);
    font-size: 18px;
    font-weight: 600;
    padding: 14px 28px;
    min-height: 52px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
    border: 2px solid var(--ret-navy-primary);
}

.rp-btn-secondary:hover, .rp-btn-secondary:focus {
    background-color: var(--ret-blue-soft);
    color: var(--ret-navy-dark) !important;
    transform: translateY(-1px);
}

.rp-form-group {
    margin-bottom: 24px;
}

.rp-form-control {
    font-size: 18px;
    min-height: 52px;
    padding: 12px 18px;
    border-radius: 8px;
    border: 2px solid var(--ret-border-color);
    color: var(--ret-text-primary);
    background-color: #ffffff;
    width: 100%;
    transition: border-color 0.2s;
}

.rp-form-control:focus {
    border-color: var(--ret-border-focus);
    background-color: #ffffff;
    box-shadow: none;
}

.rp-form-label {
    font-size: 18px;
    font-weight: 600;
    color: var(--ret-navy-dark);
    margin-bottom: 8px;
    display: block;
}

.rp-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.rp-table th {
    background-color: #f1f5f9;
    color: var(--ret-navy-dark);
    font-size: 17px;
    font-weight: 700;
    padding: 16px 20px;
    border-top: 1px solid var(--ret-border-color);
    border-bottom: 2px solid var(--ret-border-color);
}

.rp-table td {
    font-size: 17px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--ret-border-color);
    vertical-align: middle;
    color: var(--ret-text-primary);
}

.rp-table tr:hover td {
    background-color: #f8fafc;
}

.rp-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.rp-badge-success {
    background-color: var(--ret-green-light);
    color: var(--ret-green-dark);
    border: 1px solid #b7e4c7;
}

.rp-badge-warning {
    background-color: var(--ret-amber-light);
    color: var(--ret-amber-dark);
    border: 1px solid #fed7aa;
}

.rp-badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.rp-badge-info {
    background-color: var(--ret-blue-soft);
    color: var(--ret-blue-accent);
    border: 1px solid #bfdbfe;
}

/* Dashboard Elements */
.rp-stat-card {
    background: var(--ret-card-bg);
    border: 1px solid var(--ret-border-color);
    border-radius: 12px;
    padding: 24px;
    height: 100%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s, box-shadow 0.2s;
}

.rp-stat-card:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.rp-stat-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--ret-text-secondary);
    margin-bottom: 12px;
}

.rp-stat-value {
    font-size: 30px;
    font-weight: 700;
    color: var(--ret-navy-dark);
    line-height: 1.2;
    margin-bottom: 6px;
}

/* Progress bar */
.rp-progress {
    background: #e2e8f0;
    border-radius: 14px;
    height: 24px;
    overflow: hidden;
    position: relative;
    margin: 18px 0;
}

.rp-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #1b6a42 0%, #2ecc71 100%);
    border-radius: 14px;
    transition: width 0.6s ease;
}

/* Modals */
.rp-modal-content {
    background-color: #fff;
    border-radius: 16px;
    border: none;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.rp-modal-header {
    border-bottom: 1px solid var(--ret-border-color);
    padding: 20px 30px;
}

.rp-modal-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--ret-navy-dark);
}

.rp-modal-body {
    padding: 30px;
    font-size: 18px;
    color: var(--ret-text-primary);
}

.rp-modal-footer {
    border-top: 1px solid var(--ret-border-color);
    padding: 20px 30px;
}

/* ==========================================================================
   COMPREHENSIVE GLOBAL RESPONSIVE ENGINE (MOBILE & TABLET ALL PAGES)
   ========================================================================== */

/* Universal Responsive Table Wrapper */
.table-responsive,
.ret-table-wrap,
.table-wrap {
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    border-radius: 14px !important;
    margin-bottom: 24px !important;
}

.table-responsive table,
.ret-table-wrap table,
.table-wrap table,
.ret-comparison-table {
    min-width: 760px !important;
    max-width: none !important;
}

.table-responsive th,
.table-responsive td,
.ret-table-wrap th,
.ret-table-wrap td,
.table-wrap th,
.table-wrap td,
.ret-comparison-table th,
.ret-comparison-table td {
    word-break: normal !important;
    overflow-wrap: normal !important;
    white-space: normal !important;
}

@media (max-width: 991.98px) {
    /* --- Universal Subpage Heroes on Tablet & Mobile --- */
    .ab-hero,
    .inv-hero,
    .port-hero,
    .ret-plan-hero,
    .hiw-hero,
    .fee-hero,
    .risk-hero,
    .faq-hero,
    .con-hero,
    .inner-hero,
    .ret-hero-section,
    .gold-breadcrumb {
        min-height: auto !important;
        text-align: center;
        padding-top: 110px !important;
        padding-bottom: 40px !important;
    }

    .ab-hero .row,
    .inv-hero .row,
    .port-hero .row,
    .ret-plan-hero .row,
    .hiw-hero .row,
    .fee-hero .row,
    .risk-hero .row,
    .faq-hero .row,
    .con-hero .row,
    .min-vh-65,
    .min-vh-55,
    .inv-hero-row,
    .port-hero-row,
    .ret-plan-hero-row,
    .hiw-hero-row,
    .fee-hero-row,
    .risk-hero-row,
    .faq-hero-row,
    .con-hero-row {
        min-height: auto !important;
        padding-top: 15px !important;
        padding-bottom: 25px !important;
    }

    .ab-hero-desc,
    .inv-hero__sub,
    .port-hero-desc,
    .ret-plan-hero-desc,
    .hiw-hero-desc,
    .fee-hero-desc,
    .risk-hero-desc,
    .faq-hero-desc,
    .con-hero-desc {
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* Subpage section paddings */
    .py-6,
    .py-120,
    .ab-section,
    section.py-6 {
        padding-top: 3.5rem !important;
        padding-bottom: 3.5rem !important;
    }
}

@media (max-width: 767.98px) {
    body {
        font-size: 16px !important;
        line-height: 1.6 !important;
    }

    /* Container padding safety on small devices */
    .container,
    .container-fluid {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    /* --- Universal Hero Section Paddings on Mobile --- */
    .ab-hero,
    .inv-hero,
    .port-hero,
    .ret-plan-hero,
    .hiw-hero,
    .fee-hero,
    .risk-hero,
    .faq-hero,
    .con-hero,
    .inner-hero,
    .ret-hero-section,
    .gold-breadcrumb {
        padding-top: 110px !important;
        padding-bottom: 35px !important;
    }

    .ab-hero .row,
    .inv-hero .row,
    .port-hero .row,
    .ret-plan-hero .row,
    .hiw-hero .row,
    .fee-hero .row,
    .risk-hero .row,
    .faq-hero .row,
    .con-hero .row,
    .min-vh-65,
    .min-vh-55,
    .inv-hero-row,
    .port-hero-row,
    .ret-plan-hero-row,
    .hiw-hero-row,
    .fee-hero-row,
    .risk-hero-row,
    .faq-hero-row,
    .con-hero-row {
        padding-top: 10px !important;
        padding-bottom: 25px !important;
    }

    /* Universal 2-in-a-row Hero Stats on Mobile */
    .ab-hero-stats,
    .risk-hero-stats,
    .ret-plan-hero-stats,
    .port-hero-stats,
    .hiw-hero-stats,
    .fee-hero-stats {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px 10px !important;
        margin-top: 24px !important;
        padding-top: 20px !important;
    }

    /* Badges across all pages */
    .ret-hero-badge,
    .ab-hero-badge,
    .inv-hero__pill,
    .port-hero-badge,
    .ret-plan-hero-badge,
    .hiw-hero-badge,
    .fee-hero-badge,
    .risk-hero-badge,
    .faq-hero-badge,
    .con-hero-badge,
    .ab-badge,
    .ret-section-pill,
    .inv-section-pill,
    .fee-section-pill {
        font-size: 0.74rem !important;
        padding: 6px 14px !important;
        max-width: 100% !important;
        white-space: normal !important;
        text-align: center !important;
        line-height: 1.4 !important;
        display: inline-flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        margin-bottom: 14px !important;
    }

    /* Titles across all pages */
    .ret-page-title,
    .ret-hero-title,
    .ab-hero-title,
    .inv-hero__title,
    .port-hero-title,
    .ret-plan-hero-title,
    .hiw-hero-title,
    .fee-hero-title,
    .risk-hero-title,
    .faq-hero-title,
    .con-hero-title,
    .inner-hero-title,
    h1.display-4,
    h1.display-5 {
        font-size: clamp(1.65rem, 6.2vw, 2.3rem) !important;
        line-height: 1.2 !important;
        letter-spacing: -0.5px !important;
        margin-bottom: 14px !important;
        word-break: break-word !important;
    }

    /* Subtitles across all pages */
    .ret-subtitle,
    .ret-hero-desc,
    .ab-hero-desc,
    .inv-hero__sub,
    .port-hero-desc,
    .ret-plan-hero-desc,
    .hiw-hero-desc,
    .fee-hero-desc,
    .risk-hero-desc,
    .faq-hero-desc,
    .con-hero-desc {
        font-size: 0.95rem !important;
        line-height: 1.65 !important;
        margin-bottom: 22px !important;
        padding: 0 4px !important;
    }

    /* Section Headings */
    .ret-section-title,
    .ab-title,
    .inv-section-title,
    .fee-section-title,
    .risk-section-title,
    h2.display-6 {
        font-size: clamp(1.45rem, 5.5vw, 1.95rem) !important;
        line-height: 1.25 !important;
        margin-bottom: 10px !important;
        text-align: center !important;
    }

    .ret-section-desc,
    .ab-desc,
    .inv-section-sub,
    .fee-section-desc {
        font-size: 0.9rem !important;
        line-height: 1.6 !important;
        text-align: center !important;
    }

    /* Hero Trust Badges & Stats Rows */
    .ab-hero-stats,
    .inv-hero__badges,
    .port-hero-stats,
    .ret-plan-hero-stats,
    .hiw-hero-stats,
    .fee-hero-stats,
    .risk-hero-stats {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        margin-top: 24px !important;
        padding-top: 18px !important;
        padding-bottom: 12px !important;
        width: 100% !important;
        justify-content: center !important;
    }

    .port-stat-item,
    .ret-plan-stat-item,
    .hiw-stat-item,
    .fee-stat-item,
    .risk-stat-item,
    .inv-trust-badge {
        width: 100% !important;
        padding: 10px 8px !important;
        text-align: center !important;
        justify-content: center !important;
    }

    .ab-hero-stat-num,
    .port-stat-val,
    .ret-plan-stat-val,
    .hiw-stat-val,
    .fee-stat-val,
    .risk-stat-val {
        font-size: 1.4rem !important;
        font-weight: 800 !important;
    }

    .ab-hero-stat-lbl,
    .port-stat-lbl,
    .ret-plan-stat-lbl,
    .hiw-stat-lbl,
    .fee-stat-lbl,
    .risk-stat-lbl {
        font-size: 0.74rem !important;
    }

    /* Cards across all pages */
    .rp-card,
    .inv-plan-card,
    .inv-risk-card,
    .ab-feature-card,
    .ab-team-card,
    .ab-value-item,
    .hiw-step-card,
    .port-strategy-card,
    .ret-step-card,
    .ret-testimonial-card,
    .ret-calc-card {
        padding: 20px 16px !important;
        border-radius: 16px !important;
        margin-bottom: 16px !important;
    }

    /* Section vertical padding */
    .py-6,
    .py-120,
    .ab-section,
    section.py-6,
    section.py-5 {
        padding-top: 2.75rem !important;
        padding-bottom: 2.75rem !important;
    }

    /* Filter Tabs (Horizontal Scrollable Strip on Mobile) */
    .inv-filter-tabs,
    .ret-plan-filters,
    .faq-categories {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        justify-content: flex-start !important;
        padding: 4px 6px 12px 6px !important;
        gap: 6px !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none;
    }

    .inv-filter-tabs::-webkit-scrollbar,
    .ret-plan-filters::-webkit-scrollbar,
    .faq-categories::-webkit-scrollbar {
        display: none;
    }

    .inv-tab,
    .ret-filter-btn,
    .faq-cat-btn {
        flex-shrink: 0 !important;
        white-space: nowrap !important;
        font-size: 0.8rem !important;
        padding: 6px 14px !important;
    }

    /* About Us Page Polish */
    .ab-img-wrap {
        padding: 0 0 16px 0 !important;
    }
    .ab-float-card {
        position: static !important;
        margin-top: 14px !important;
        width: 100% !important;
        justify-content: center !important;
        animation: none !important;
    }
    .ab-cta {
        padding: 36px 18px !important;
        border-radius: 20px !important;
        text-align: center !important;
    }
    .ab-timeline {
        padding-left: 28px !important;
    }
    .ab-timeline-dot {
        left: -21px !important;
    }
    .ab-value-item {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }
    .ab-value-item:hover {
        transform: none !important;
    }

    /* Plans Metric Grid */
    .inv-plan-metrics-grid {
        gap: 8px !important;
        padding: 12px !important;
    }
    .inv-plan-metric__label {
        font-size: 0.7rem !important;
    }
    .inv-plan-metric__value {
        font-size: 0.95rem !important;
    }

    /* FAQ Live Search & Accordion */
    .faq-search-wrap {
        max-width: 100% !important;
        padding: 0 2px !important;
    }
    .faq-search-wrap input {
        font-size: 0.88rem !important;
        padding: 10px 14px !important;
    }
    .faq-accordion-wrap .accordion-button {
        font-size: 0.92rem !important;
        padding: 14px 16px !important;
    }
    .faq-accordion-wrap .accordion-body {
        font-size: 0.86rem !important;
        padding: 12px 16px 16px !important;
    }

    /* Contact Page Cards & Forms */
    .con-hero-badge {
        white-space: normal !important;
    }

    /* Footer adjustments on mobile */
    .footer-area {
        padding-top: 40px !important;
    }
    .bottom-footer .d-flex {
        flex-direction: column !important;
        gap: 10px !important;
        text-align: center !important;
    }
}

/* Extra Small Phones (< 576px) Button Stacking & Layout */
@media (max-width: 575.98px) {
    /* Hero button groups stacked full width */
    .ab-hero .d-flex,
    .inv-hero .d-flex.flex-wrap,
    .port-hero .d-flex.flex-wrap,
    .ret-plan-hero .d-flex.flex-wrap,
    .hiw-hero .d-flex.flex-wrap,
    .fee-hero .d-flex.flex-wrap,
    .risk-hero .d-flex.flex-wrap,
    .con-hero .d-flex.flex-wrap,
    .ret-hero-section .d-flex.flex-wrap {
        flex-direction: column !important;
        width: 100% !important;
        gap: 10px !important;
    }

    .ab-btn-primary,
    .ab-btn-ghost,
    .inv-btn-primary,
    .inv-btn-ghost,
    .inv-btn-outline,
    .port-btn-primary,
    .port-btn-ghost,
    .ret-btn-primary,
    .ret-btn-ghost,
    .ret-btn-outline,
    .hiw-btn-primary,
    .hiw-btn-ghost,
    .fee-btn-primary,
    .fee-btn-ghost,
    .risk-btn-primary,
    .risk-btn-ghost,
    .rp-btn-primary,
    .btn-retirement {
        width: 100% !important;
        justify-content: center !important;
        text-align: center !important;
        padding: 12px 18px !important;
        font-size: 0.95rem !important;
        min-width: 0 !important;
    }

    /* Single column stats on extremely narrow screens (< 400px) */
    .ab-hero-stats,
    .inv-hero__badges,
    .port-hero-stats,
    .ret-plan-hero-stats,
    .hiw-hero-stats,
    .fee-hero-stats,
    .risk-hero-stats {
        grid-template-columns: 1fr !important;
    }
}

/* ==========================================================================
   Dashboard Sidebar & Header Overrides
   ========================================================================== */
.header-2 {
    background-color: #ffffff;
    border-bottom: 1px solid var(--ret-border-color);
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

.header-2__bg {
    display: none !important; /* Remove background image from header */
}

.account-info {
    color: var(--ret-navy-dark);
}

.account-info .page-name {
    font-size: 20px;
    font-weight: 700;
}

.account-info .account-number {
    color: var(--ret-text-secondary);
    font-weight: 600;
}

.main-sidebar {
    background-color: #ffffff;
    border-right: 1px solid var(--ret-border-color);
    box-shadow: 2px 0 10px rgba(0,0,0,0.02);
}

.sidebar-menu .sidebar-item .sidebar-link {
    color: var(--ret-text-secondary);
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    margin: 4px 16px;
    padding: 12px 16px;
    transition: all 0.2s ease;
}

.sidebar-menu .sidebar-item .sidebar-link:hover {
    background-color: var(--ret-blue-soft);
    color: var(--ret-navy-primary);
}

.sidebar-menu .sidebar-item .sidebar-link.active,
.sidebar-menu .sidebar-item.open .sidebar-link {
    background-color: var(--ret-navy-primary);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(16, 49, 88, 0.2);
}

.sidebar-menu .sidebar-item .sidebar-link .nav-icon {
    font-size: 20px;
}

.sidebar-menu .sidebar-dropdown-menu .sidebar-dropdown-item .sidebar-link {
    padding: 10px 16px 10px 48px;
    font-size: 15px;
    font-weight: 500;
}

.dashboard {
    background-color: var(--ret-neutral-bg);
}

.logout-btn {
    margin: 16px;
    width: calc(100% - 32px);
}
