/* Floating Calculator Style Sheet */

/* Color Palette Variables */
:root {
    --calc-blue-primary: #0f4c81; /* Premium Navy Blue */
    --calc-blue-hover: #0b3a63;
    --calc-blue-light: #e0f2fe;
    --calc-accent-red: #e11d48; /* Red accents */
    --calc-accent-red-hover: #be123c;
    --calc-white: #ffffff;
    --calc-text-dark: #0f172a;
    --calc-text-muted: #64748b;
    --calc-border: rgba(226, 232, 240, 0.8);
    --calc-glass-bg: rgba(255, 255, 255, 0.85);
    --calc-glass-border: rgba(255, 255, 255, 0.6);
    --calc-shadow: 0 10px 40px -10px rgba(15, 76, 129, 0.25);
}

.calculator-floating-container {
    position: fixed;
    bottom: 105px; /* Stacked above the WhatsApp button at 25px + 65px + 15px */
    right: 25px;
    z-index: 9999;
    font-family: "Manrope", sans-serif;
}

/* Floating Calculator Button */
.calculator-floating-btn {
    width: 65px;
    height: 65px;
    background: var(--calc-blue-primary);
    border: none;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--calc-white);
    font-size: 26px;
    box-shadow: 0 10px 30px rgba(15, 76, 129, 0.4);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.calculator-floating-btn:hover {
    transform: scale(1.12);
    background: var(--calc-blue-hover);
    box-shadow: 0 12px 35px rgba(15, 76, 129, 0.5);
}

.calculator-floating-btn i {
    pointer-events: none;
}

/* Speech Bubble Tooltip */
.calculator-tooltip {
    position: absolute;
    right: 80px;
    bottom: 10px;
    background: var(--calc-white);
    color: var(--calc-text-dark);
    padding: 10px 16px;
    border-radius: 20px;
    white-space: normal;
    width: 250px;
    font-weight: 700;
    font-size: 13.5px;
    line-height: 1.4;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--calc-border);
    
    /* Animation states */
    opacity: 0;
    visibility: hidden;
    transform: translateX(20px);
    transition: opacity 0.4s ease, transform 0.4s ease, visibility 0.4s;
    
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.calculator-tooltip.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.calculator-tooltip::after {
    content: "";
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    border-left: 10px solid var(--calc-white);
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

.tooltip-close {
    background: transparent;
    border: none;
    font-size: 18px;
    font-weight: bold;
    color: var(--calc-text-muted);
    cursor: pointer;
    line-height: 1;
    margin-left: 8px;
    padding: 0 4px;
}

.tooltip-close:hover {
    color: var(--calc-accent-red);
}

/* Main Calculator Popup Card */
.calculator-popup-card {
    position: fixed;
    bottom: 105px;
    right: 25px;
    width: 420px;
    max-height: 80vh;
    background: var(--calc-glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--calc-glass-border);
    border-radius: 24px;
    box-shadow: var(--calc-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10000;
    
    /* Animation properties */
    opacity: 0;
    visibility: hidden;
    transform: translateY(40px) scale(0.95);
    transition: opacity 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), 
                transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), 
                visibility 0.3s;
}

.calculator-popup-card.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.calculator-card-header {
    background: var(--calc-blue-primary);
    color: var(--calc-white);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-brand {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.brand-subtitle {
    font-size: 12px;
    opacity: 0.85;
}

.calculator-close-btn {
    background: transparent;
    border: none;
    color: var(--calc-white);
    font-size: 28px;
    font-weight: 300;
    cursor: pointer;
    line-height: 1;
    padding: 0 5px;
    transition: color 0.2s;
}

.calculator-close-btn:hover {
    color: var(--calc-accent-red);
}

/* Wizard / Progress Indicator */
.calculator-progress-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 40px;
    background: rgba(248, 250, 252, 0.7);
    border-bottom: 1px solid var(--calc-border);
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    opacity: 0.4;
    transition: opacity 0.3s;
}

.progress-step.active {
    opacity: 1;
}

.step-num {
    width: 22px;
    height: 22px;
    background: var(--calc-blue-primary);
    color: var(--calc-white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}

.progress-step.active .step-num {
    background: var(--calc-accent-red);
}

.step-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--calc-text-dark);
}

.progress-connector {
    flex-grow: 1;
    height: 2px;
    background: #cbd5e1;
    margin: 0 10px;
    position: relative;
    top: -8px;
}

/* Panels */
.calculator-panels-wrapper {
    flex-grow: 1;
    position: relative;
    overflow-y: auto;
    display: flex;
    height: 480px;
}

.calculator-panel {
    display: none;
    flex-direction: column;
    padding: 20px;
    width: 100%;
    height: 100%;
    position: absolute;
    box-sizing: border-box;
}

.calculator-panel.active {
    display: flex;
}

/* Form Fields Styling */
.calc-form-group {
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
}

.calc-row {
    display: flex;
    gap: 12px;
}

.calc-col {
    flex: 1;
}

.calc-form-group label {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--calc-text-dark);
    margin-bottom: 5px;
}

.required-star {
    color: var(--calc-accent-red);
}

.calc-input {
    padding: 10px 14px;
    border: 1.5px solid var(--calc-border);
    border-radius: 10px;
    font-size: 13.5px;
    outline: none;
    background: var(--calc-white);
    color: var(--calc-text-dark);
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.calc-input:focus {
    border-color: var(--calc-blue-primary);
    box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.15);
}

.input-hint {
    font-size: 11px;
    color: var(--calc-text-muted);
    margin-top: 3px;
}

.validation-error {
    font-size: 11.5px;
    color: var(--calc-accent-red);
    margin-top: 3px;
    height: 15px;
    font-weight: 500;
}

/* Buttons */
.calculator-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    font-family: inherit;
}

.calc-primary-btn {
    background: var(--calc-blue-primary);
    color: var(--calc-white);
    margin-top: auto;
}

.calc-primary-btn:hover:not(:disabled) {
    background: var(--calc-blue-hover);
}

.calc-primary-btn:disabled, .calc-submit-btn:disabled {
    background: #cbd5e1;
    color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
}

.calc-submit-btn {
    background: var(--calc-accent-red);
    color: var(--calc-white);
    flex: 1.5;
}

.calc-submit-btn:hover:not(:disabled) {
    background: var(--calc-accent-red-hover);
}

.calc-secondary-btn {
    background: transparent;
    border: 1.5px solid var(--calc-border);
    color: var(--calc-text-dark);
    flex: 1;
}

.calc-secondary-btn:hover {
    background: rgba(241, 245, 249, 0.5);
    border-color: var(--calc-text-muted);
}

.calc-button-row {
    display: flex;
    gap: 12px;
    margin-top: auto;
}

/* Results section styling */
.calculator-results-box {
    margin-top: 15px;
    background: rgba(15, 76, 129, 0.05);
    border: 1px dashed var(--calc-blue-primary);
    border-radius: 14px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: fadeIn 0.3s ease;
}

.emi-result-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--calc-white);
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.02);
}

.emi-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--calc-text-muted);
    font-weight: 700;
}

.emi-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--calc-blue-primary);
}

.chart-container {
    height: 130px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.breakdown-legend {
    display: flex;
    justify-content: space-around;
    font-size: 11.5px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

.principal-color {
    background: #0f4c81;
}

.interest-color {
    background: #e11d48;
}

/* Panel 2 Readonly Summary Card */
.readonly-summary-card {
    background: var(--calc-blue-light);
    border: 1px solid rgba(15, 76, 129, 0.15);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 14px;
}

.summary-title {
    font-size: 11.5px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--calc-blue-primary);
    margin-bottom: 6px;
}

.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 12px;
    font-size: 12px;
    color: var(--calc-text-dark);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive Overrides */
@media (max-width: 768px) {
    .calculator-floating-container {
        bottom: 90px;
        right: 20px;
    }

    .calculator-floating-btn {
        width: 58px;
        height: 58px;
        font-size: 22px;
    }

    .calculator-tooltip {
        right: 70px;
        width: 220px;
        font-size: 12px;
        padding: 8px 12px;
    }

    .calculator-popup-card {
        bottom: 0;
        right: 2.5%;
        left: 2.5%;
        width: 95%;
        max-height: 85vh;
        border-radius: 24px 24px 0 0;
    }
}
