/* ============================================
   SIP CALCULATOR - FIGMA LEVEL CSS
   Version 1.1 - Slider Fill Fixed
============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ---- Reset & Variables ---- */
.sip-wrap * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.sip-wrap {
    --blue:          #4361EE;
    --blue-dark:     #3A0CA3;
    --green:         #06D6A0;
    --green-dark:    #048A81;
    --purple:        #7209B7;
    --purple-light:  #F3EEFF;
    --grad:          linear-gradient(135deg, #4361EE 0%, #7209B7 100%);
    --grad-soft:     linear-gradient(135deg,
                     rgba(67,97,238,0.07) 0%,
                     rgba(114,9,183,0.07) 100%);
    --white:         #FFFFFF;
    --bg:            #F0F4FF;
    --border:        rgba(67,97,238,0.14);
    --text:          #1A1A2E;
    --text-muted:    #6B7280;
    --shadow:        0 32px 80px rgba(67,97,238,0.18),
                     0 8px 24px rgba(114,9,183,0.10);
    --shadow-btn:    0 12px 32px rgba(67,97,238,0.40);
    --radius-xl:     24px;
    --radius-lg:     16px;
    --radius-md:     12px;
    --radius-sm:     8px;
    font-family: 'Inter', sans-serif;
    position: relative;
    padding: 40px 16px;
    background: var(--bg);
}

/* ---- Blobs ---- */
.sip-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    pointer-events: none;
    z-index: 0;
}
.sip-blob-1 {
    width: 320px; height: 320px;
    background: rgba(67,97,238,0.10);
    top: -80px; left: -100px;
}
.sip-blob-2 {
    width: 260px; height: 260px;
    background: rgba(114,9,183,0.09);
    bottom: 20px; right: -80px;
}
.sip-blob-3 {
    width: 200px; height: 200px;
    background: rgba(6,214,160,0.07);
    top: 40%; left: 40%;
}

/* ---- Main Card ---- */
.sip-card {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--border);
}

/* ---- Header ---- */
.sip-header {
    background: var(--grad);
    padding: 26px 32px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

.sip-header::after {
    content: '';
    position: absolute;
    width: 220px; height: 220px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
    top: -90px; right: -60px;
}

.sip-header::before {
    content: '';
    position: absolute;
    width: 140px; height: 140px;
    background: rgba(255,255,255,0.04);
    border-radius: 50%;
    bottom: -50px; left: 35%;
}

.sip-header-icon {
    width: 52px; height: 52px;
    background: rgba(255,255,255,0.18);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.25);
}

.sip-header-text h2 {
    color: white;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.sip-header-text p {
    color: rgba(255,255,255,0.75);
    font-size: 13px;
    font-weight: 400;
    margin-top: 3px;
}

/* ---- Body ---- */
.sip-body {
    padding: 32px;
}

/* ---- Two Column Layout ---- */
.sip-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

/* ---- Inputs Column ---- */
.sip-inputs {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* ---- Field ---- */
.sip-field {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sip-field-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.sip-field-top label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    flex: 1;
}

/* Input Box */
.sip-input-box {
    display: flex;
    align-items: stretch;
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    min-width: 120px;
    transition: all 0.25s ease;
}

.sip-input-box:focus-within {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(67,97,238,0.10);
}

.sip-prefix,
.sip-suffix {
    padding: 0 10px;
    font-size: 14px;
    font-weight: 700;
    color: var(--blue);
    background: rgba(67,97,238,0.06);
    display: flex;
    align-items: center;
    white-space: nowrap;
    border-right: 1.5px solid var(--border);
}

.sip-suffix {
    border-right: none;
    border-left: 1.5px solid var(--border);
}

.sip-input-box input[type="number"] {
    width: 100%;
    padding: 10px 10px;
    border: none;
    background: transparent;
    font-size: 15px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    color: var(--text);
    text-align: right;
    outline: none;
    min-width: 0;
    -moz-appearance: textfield;
}

.sip-input-box input[type="number"]::-webkit-inner-spin-button,
.sip-input-box input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ============================================
   RANGE SLIDER - FIXED FILL
============================================ */
.sip-field input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 100px;
    outline: none;
    cursor: pointer;
    /* Default fill set by JS */
    background: linear-gradient(
        to right,
        #4361EE 0%,
        #7209B7 50%,
        #E0E7FF 50%,
        #E0E7FF 100%
    );
    transition: height 0.2s;
}

.sip-field input[type="range"]:hover {
    height: 8px;
}

/* Webkit Thumb */
.sip-field input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    border: 3px solid #4361EE;
    box-shadow: 0 2px 10px rgba(67,97,238,0.35);
    transition: all 0.2s ease;
}

.sip-field input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 16px rgba(67,97,238,0.45);
}

.sip-field input[type="range"]::-webkit-slider-thumb:active {
    transform: scale(1.15);
    border-color: var(--purple);
    box-shadow: 0 4px 20px rgba(114,9,183,0.45);
}

/* Firefox Thumb */
.sip-field input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    border: 3px solid #4361EE;
    box-shadow: 0 2px 10px rgba(67,97,238,0.35);
}

/* Firefox Track */
.sip-field input[type="range"]::-moz-range-track {
    height: 6px;
    border-radius: 100px;
    background: #E0E7FF;
}

.sip-field input[type="range"]::-moz-range-progress {
    height: 6px;
    border-radius: 100px;
    background: linear-gradient(to right, #4361EE, #7209B7);
}

/* Range Labels */
.sip-range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: -4px;
}

/* ---- Calculate Button ---- */
#sip_btn {
    width: 100%;
    padding: 15px 24px;
    background: var(--grad);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    letter-spacing: 0.3px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-btn);
    position: relative;
    overflow: hidden;
    margin-top: 4px;
}

#sip_btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(255,255,255,0.15),
        transparent
    );
    opacity: 0;
    transition: opacity 0.3s;
}

#sip_btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 40px rgba(67,97,238,0.45);
}

#sip_btn:hover::before {
    opacity: 1;
}

#sip_btn:active {
    transform: translateY(0);
}

.sip-btn-text {
    font-size: 15px;
    font-weight: 700;
}

.sip-btn-icon {
    width: 28px; height: 28px;
    background: rgba(255,255,255,0.20);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---- Results Column ---- */
.sip-results {
    display: flex;
    flex-direction: column;
    gap: 20px;
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.5s cubic-bezier(0.34,1.56,0.64,1);
}

.sip-results-visible {
    opacity: 1 !important;
    transform: translateX(0) !important;
}

/* ---- Donut Chart ---- */
.sip-chart-wrap {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 200px;
    height: 200px;
    margin: 0 auto;
}

.sip-chart-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 2;
    pointer-events: none;
}

.sip-chart-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    white-space: nowrap;
}

.sip-chart-value {
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.5px;
    white-space: nowrap;
}

/* ---- Legend ---- */
.sip-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.sip-legend-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.sip-legend-dot {
    width: 10px; height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

.sip-dot-invested {
    background: linear-gradient(135deg, #4361EE, #3A0CA3);
}

.sip-dot-returns {
    background: linear-gradient(135deg, #06D6A0, #048A81);
}

/* ---- Result Cards ---- */
.sip-result-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sip-result-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: #FAFBFF;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    transition: all 0.25s ease;
}

.sip-result-card:hover {
    border-color: var(--blue);
    box-shadow: 0 4px 16px rgba(67,97,238,0.10);
    transform: translateX(4px);
}

.sip-card-highlight {
    background: var(--grad-soft);
    border-color: rgba(67,97,238,0.25) !important;
}

.sip-result-icon {
    font-size: 22px;
    width: 40px; height: 40px;
    background: white;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.sip-result-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 3px;
}

.sip-result-value {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.sip-color-blue   { color: var(--blue); }
.sip-color-green  { color: var(--green-dark); }
.sip-color-purple { color: var(--purple); }

/* ---- Footer ---- */
.sip-footer {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 16px 32px 24px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
    border-top: 1px solid var(--border);
    background: #FAFBFF;
}

.sip-footer svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--blue);
}

/* ---- Tablet ---- */
@media (max-width: 768px) {

    .sip-layout {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .sip-results {
        transform: translateY(20px) !important;
        border-top: 1px solid var(--border);
        padding-top: 28px;
    }

    .sip-results-visible {
        transform: translateY(0) !important;
    }

    .sip-body {
        padding: 24px;
    }

    .sip-footer {
        padding: 14px 24px 20px;
    }
}

/* ---- Mobile ---- */
@media (max-width: 480px) {

    .sip-wrap {
        padding: 20px 10px;
    }

    .sip-card {
        border-radius: var(--radius-lg);
    }

    .sip-header {
        padding: 20px;
    }

    .sip-header-text h2 {
        font-size: 18px;
    }

    .sip-body {
        padding: 20px;
    }

    .sip-footer {
        padding: 14px 20px 20px;
    }

    .sip-result-value {
        font-size: 16px;
    }

    .sip-chart-value {
        font-size: 13px;
    }
}
