/* ------------------------
   GLOBAL STYLES
------------------------ */
:root {
    --gold: #C2A86C;
    --cream: #F6F4EF;
    --dark: #1F2F28;
    --text: #3D3D3D;

    --font-heading: 'Futura Bold', sans-serif;       /* For bold headings */
    --font-secondary: 'Futura Light', sans-serif;    /* For lighter accents/subheadings */
    --font-body: 'Futura Medium', sans-serif;        /* For general readable body text */ 
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    font-family: var(--font-body);
    color: var(--text);
    background-color: var(--cream);
    line-height: 1.6;
    font-size: 16px;
    /*padding-top: calc(100px + 6rem);*/
    padding-top: 60px;
    overflow-x: hidden; /* ✅ Keep this once here */
}

h2 {
    position: relative;
    display: inline-block;
    padding-bottom: 0.4rem;
}
h2::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 3px;
    background-color: var(--gold);
    transition: width 0.4s ease;
}
/*h2:hover::after { width: 100%; }*/

@font-face {
    font-family: 'Futura Light';
    src: url('fonts/futura-pt/FuturaCyrillicLight.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
}

@font-face {
    font-family: 'Futura Medium';
    src: url('fonts/futura-pt/FuturaCyrillicMedium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
}

@font-face {
    font-family: 'Futura Bold';
    src: url('fonts/futura-pt/FuturaCyrillicBold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}

/* ------------------------
   HEADER (Side-by-side Layout)
------------------------ */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: var(--dark);
    color: var(--cream);
    border-bottom: 3px solid var(--gold);
    z-index: 1000;
    transition: opacity 0.4s ease, transform 0.4s ease;
    padding: 0.5rem 1rem; /* Reduced vertical padding */
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center; /* Centers both horizontally */
    gap: 1rem; /* Space between logo and text */
}

.logo {
    height: 80px; /* Smaller logo to fit header */
    width: auto;
}

.title {
    font-family: 'Futura Heading', sans-serif; /* Forum font for luxury feel */
    font-weight: 300; /* Clean, non-bold appearance */
    letter-spacing: 0.01em; /* Slight spacing for elegance */
    font-size: 1.8rem;
    margin: 0;
    line-height: 1;
}

/* ------------------------
   HEADER CTA BUTTONS
------------------------ */
.header-ctas {
    display: flex;
    gap: 1rem;
    margin-left: auto; /* Push CTAs to the right */
    align-items: center;
}

.header-btn {
    font-family: var(--font-secondary);
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--gold);
    border: 1px solid var(--gold);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
    background: transparent;
}

.header-btn:hover {
    background: var(--gold);
    color: var(--cream);
    box-shadow: 0 0 8px rgba(194, 168, 108, 0.6);
}

.header-btn.secondary {
    border: 1px solid var(--cream);
    color: var(--cream);
}

.header-btn.secondary:hover {
    background: var(--cream);
    color: var(--dark);
    box-shadow: 0 0 8px rgba(246, 244, 239, 0.6);
}

/* ------------------------
   HORIZONTAL SLIDER PANELS
------------------------ */
.slider-container {
    display: flex;
    width: 200%;
    transform: translateX(0);
    transition: transform 0.8s ease;
}
.slider-container.show-results { transform: translateX(-50%); }
.panel { width: 100vw; flex-shrink: 0; box-sizing: border-box; }
.input-panel {
    background: linear-gradient(135deg, var(--cream) 0%, white 100%);
    padding-left: 20px;   /* ✅ Added left padding */
    padding-right: 20px;  /* ✅ Added right padding */
}

.results-panel {
    background: var(--cream);
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding-right: 245px; /* ✅ Sidebar width (220px) + spacing (40px) */
    padding-left: 20px; /* ✅ Sidebar width (220px) + spacing (40px) */
}


/* ------------------------
   CHART SECTION
------------------------ */
.chart-section, .summary-section {
    background: white;
    border: 1px solid #eaeaea;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.3rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.chart-section h2, .summary-section h2 { font-family: var(--font-secondary); text-align: center; color: var(--dark); margin-bottom: 1rem; }
canvas { max-width: 100%; height: auto; }

#summary-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    text-align: center;
}
#summary-table th, #summary-table td {
    border: 1px solid #ddd;
    padding: 0.75rem;
    font-family: var(--font-body);
}
#summary-table th { background: var(--dark); color: var(--cream); font-family: var(--font-body); }
#summary-table tr:nth-child(even) { background: #f9f9f9; }
#summary-table tbody tr:hover { background: rgba(194, 168, 108, 0.08); transition: background 0.3s ease; }

/* ------------------------
   RESULTS SIDEBAR
------------------------ */
.results-content {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    position: relative;
}

.results-main {
    flex: 1;
    max-height: calc(100vh - var(--header-height) - 40px);
    overflow-y: auto;
    padding-right: 1rem;
}

.results-sidebar {
    display: none; /* Hidden by default */
    position: fixed;
    top: 120px; /* current value */
    right: 20px;
    bottom: 40px;          /* ✅ Padding from the bottom */
    width: 220px;
    background: white;
    border: 1px solid #eaeaea;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    padding: 1.5rem 1rem;
    z-index: 2000;
    overflow: hidden;
}


.results-sidebar h3 {
    margin-bottom: 0.5rem;
}

.results-slider-group {
    display: flex;
    flex-direction: row; /* ✅ Side-by-side sliders */
    gap: 1.5rem;
    justify-content: center;
    align-items: stretch; /* ✅ Ensures children stretch full height */
    height: calc(100% - 50px); /* ✅ Fill sidebar below "Adjust Inputs" title */
    width: 100%;
}


.results-sidebar h3 { font-family: var(--font-secondary); color: var(--dark); text-align: center; }

.sidebar-slider-container {
    flex: 1; /* ✅ Allow each slider container to grow equally */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between; /* ✅ Push label to top and value to bottom */
    text-align: center;
    gap: 0.5rem;
}
.sidebar-slider-container label { 
    font-family: var(--font-body); 
    font-weight: normal; 
    font-size: 0.9rem;
}

/* -------------------------
   SLIDER STYLES (FIXED)
------------------------- */

/* Vertical Slider Styling */
.results-sidebar input[type="range"] {
    writing-mode: vertical-lr; /* Standardized vertical slider */
    direction: rtl; /* Flip so it goes bottom-to-top */
    -webkit-appearance: none; /* Remove browser-specific styling */
    width: 8px;
    height: 100%; /* Dynamic height: fills sidebar minus padding for labels/values */
    background: transparent;
    outline: none;
    cursor: pointer;
    position: relative;
}

/* Track Styling (Gold fill) */
.results-sidebar input[type="range"]::-webkit-slider-runnable-track {
    width: 8px;
    height: 100%; /* Match slider height dynamically */
    background: linear-gradient(to top, var(--gold) var(--value, 50%), #e0e0e0 var(--value, 50%));
    border-radius: 8px;
}
.results-sidebar input[type="range"]::-moz-range-track {
    width: 8px;
    height: 100%; /* Match slider height dynamically */
    background: linear-gradient(to top, var(--gold) var(--value, 50%), #e0e0e0 var(--value, 50%));
    border-radius: 8px;
}

/* Functional Thumb (Invisible but draggable) */
.results-sidebar input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    opacity: 0; /* Hide visually but keep active for dragging */
    cursor: pointer;
    position: relative;
    z-index: 3;
}
.results-sidebar input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    opacity: 0; /* Hide visually but keep active */
    cursor: pointer;
    position: relative;
    z-index: 3;
}

/* Custom Gold Thumb Overlay */
.results-sidebar input[type="range"]::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    background: var(--gold);
    border: 2px solid #fff;
    border-radius: 50%;
    pointer-events: none; /* Allow dragging of hidden functional thumb */
    top: var(--thumb-top, 0); /* Dynamically updated by JS */
    transition: top 0s linear; /* Super fast but not jumpy */
}

/* Value Display Below Sliders */
.slider-value {
    font-family: var(--font-body);
    font-weight: bold;
    color: var(--dark);
    margin-top: 0.4rem;
}

/* ------------------------
   CTA Styles
------------------------ */
.cta-section {
    margin: 2rem 20px;
    text-align: center;
    padding-right: 245px; /* Keep space for sidebar on desktop */
}

.cta-container {
    display: flex;
    justify-content: center;
    align-items: stretch; /* ✅ Ensures equal heights */
    gap: 2rem;
    margin-bottom: 1rem;
}

/* Left Text Box matches height of WhatsApp box */
.cta-text-box {
    flex: 1;
    background-color: var(--dark);
    color: var(--gold);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    font-family: var(--font-secondary);
    font-size: 2rem;
    font-weight: 200;
    line-height: 1.1;
    letter-spacing: 0.1em;
    text-align: center;
    height: auto; /* ✅ Allow it to stretch dynamically */
}

/* WhatsApp CTA Image */
.cta-image-box {
    flex: 1;
    display: flex;
    align-items: stretch; /* ✅ Force image to control height */
}

.cta-image-box img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    object-fit: cover;
}

/* Contact link */
.cta-contact {
    margin-top: 1rem;
    font-family: var(--font-secondary);
    font-size: 1rem;
}
.cta-contact a {
    color: var(--gold);
    text-decoration: none;
    font-weight: bold;
}
.cta-contact a:hover {
    text-decoration: underline;
}


/* ------------------------
   Disclaimer
------------------------ */
.disclaimer {
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-style: italic;
    color: #666;
    text-align: center;
    margin-top: -0.5rem; /* Tighten spacing above */
    margin-bottom: 2rem; /* Space before CTAs */
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.4;
}


/*------------------------
   DESKTOP STYLES
/* Default desktop chart height */
#investmentChart {
    width: 100% !important;     /* Always span container width */
    height: auto !important;    /* Allow proportional height scaling */
    max-height: 800px;          /* Prevent it from getting too tall */
}

/* ------------------------
   Desktop default hide for mobile sliders
------------------------ */
.mobile-slider-bar {
    display: none; /* ✅ Ensure hidden on desktop and larger screens */
}


/* ------------------------
   RESPONSIVE (MOBILE & TABLET)
------------------------ */

/* Tablet & small desktop adjustments */
@media (max-width: 1000px) {
    .results-content {
        flex-direction: column;
        gap: 1rem;
    }
    .results-main {
        max-height: none;
        width: 100%;
    }
}

/* -----------------------------
   Mobile layout (primary breakpoint) 
----------------------------- */
@media (max-width: 768px) {
    /* Header adjustments */
    .title {
        font-size: 1.5rem;
        text-align: center;
    }

    .header-ctas {
        flex-direction: column;
        gap: 0.5rem;
        margin-left: 0;
    }

    .header-btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }

    /* Stack chart and table */
    .results-panel {
        padding: 10px 10px !important; /* Even padding on both sides */
    }

    /* Ensure chart and summary blocks align evenly */
    .chart-section,
    .summary-section {
        margin-left: auto;
        margin-right: auto;
        width: calc(100% - 20px); /* Equal margins inside panel */
        box-sizing: border-box;
    }

    /* Chart canvas larger */
    #investmentChart {
        height: 320px !important; /* More height for mobile charts */
        max-height: none;         /* Allow free resizing */
    }

    /* Reduce legend font size and spacing */
    .chart-section .chartjs-legend {
        font-size: 0.75rem !important;
        line-height: 1.2;
    }

    /* Hide vertical sidebar */
    .results-sidebar {
        display: none !important; /* Force hide vertical sliders on mobile */
    }

    /* Show horizontal mobile sliders */
    .mobile-slider-bar {
        display: flex;
        position: fixed;
        top: 100px; /* Adjusted to fully clear header height */
        width: 100%;
        background: var(--cream);
        z-index: 1100; /* Slightly higher than header */
        padding: 0.75rem 1rem;
        justify-content: space-around;
        gap: 1rem;
        border-bottom: 1px solid #ccc;
        transition: top 0.3s ease;
    }    

    .slider-group {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .slider-group label {
        font-weight: bold;
        margin-bottom: 0.25rem;
    }

    .slider-group input[type="range"] {
        width: 100%;
        -webkit-appearance: none;
        height: 6px;
        background: var(--gold);
        border-radius: 5px;
    }

    .slider-group input[type="range"]::-webkit-slider-thumb {
        -webkit-appearance: none;
        width: 20px;
        height: 20px;
        background: var(--gold);
        border: 2px solid #fff;
        border-radius: 50%;
        cursor: pointer;
        margin-top: -7px; /* Align thumb with track */
    }
    
    .slider-group input[type="range"]::-moz-range-thumb {
        width: 20px;
        height: 20px;
        background: var(--gold);
        border: 2px solid #fff;
        border-radius: 50%;
        cursor: pointer;
    }

    .slider-group span {
        font-size: 0.8rem;
        margin-top: 0.25rem;
        color: var(--dark);
    }

    /* Ensure content clears fixed mobile slider bar */
    body {
        padding-top: 180px;
    }

    /* CTAs stack vertically */
    .cta-section {
        margin: 1rem 0;      /* Remove side margins */
        padding: 20px;          /* Remove desktop padding-right */
        width: 100%;         /* Ensure full width usage */
    }

    .cta-container {
        width: 100%;         /* Ensure full container width */
        flex-direction: column;
        align-items: center;
    }

    .cta-image-box {
        width: 100%;
        display: block;
    }

    .cta-image-box img {
        width: 100%;
        height: auto;
        display: block;
    }

    .cta-text-box {
        display: none; /* Keep hidden as per current design choice */
    }

    /* Table font adjustments */
    #summary-table th,
    #summary-table td {
        font-size: 0.9rem;
        padding: 0.5rem;
    }

    /* Disclaimer smaller */
    .disclaimer {
        font-size: 0.7rem;
        margin-top: 1.5rem;
        margin-bottom: 0.5rem;
    }
}
