/* ============================================================
   PROFESSIONAL CALCULATOR REDESIGN
   Premium dark-theme with glassmorphism effect
   Matches existing website color palette: #6c5ce7 (purple)
   ============================================================ */

/* --- Calculator Section Wrapper --- */
.calculator-section {
    padding: 60px 20px;
}

/* --- Input Card (Main Form Container) --- */
.input-section {
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.input-card {
    background: linear-gradient(145deg, #1a1040 0%, #0f0a28 100%) !important;
    border: 1px solid rgba(108, 92, 231, 0.4) !important;
    border-radius: 24px !important;
    box-shadow:
        0 0 0 1px rgba(108, 92, 231, 0.15),
        0 25px 60px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
    padding: 40px !important;
    max-width: 520px !important;
    width: 100% !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    position: relative;
    overflow: hidden;
}

/* Subtle top gradient glow */
.input-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #6c5ce7, #a29bfe, #6c5ce7, transparent);
    opacity: 0.8;
}

/* --- Card Header --- */
.input-header {
    text-align: center;
    margin-bottom: 30px !important;
    padding-bottom: 22px !important;
    border-bottom: 1px solid rgba(108, 92, 231, 0.2) !important;
}

.input-header h3 {
    font-size: 1.4rem !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    margin: 0 0 8px 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    letter-spacing: 0.3px;
}

.input-header h3 i {
    color: #a29bfe !important;
    font-size: 1.2rem !important;
}

.input-header p {
    font-size: 0.9rem !important;
    color: rgba(255, 255, 255, 0.5) !important;
    margin: 0 !important;
    line-height: 1.5;
}

/* --- Form Labels --- */
.birth-form label:not(.checkbox-label) {
    display: block !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    color: rgba(255, 255, 255, 0.7) !important;
    margin-bottom: 8px !important;
    letter-spacing: 0.4px !important;
    text-transform: uppercase !important;
}

/* --- All Input Fields --- */
.birth-form input[type="text"],
.birth-form input[type="date"],
.birth-form input[type="time"] {
    width: 100% !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(108, 92, 231, 0.35) !important;
    border-radius: 12px !important;
    padding: 14px 18px !important;
    color: #ffffff !important;
    font-size: 1rem !important;
    font-family: inherit !important;
    transition: all 0.3s ease !important;
    box-sizing: border-box !important;
    outline: none !important;
    -webkit-appearance: none;
    appearance: none;
    color-scheme: dark;
}

.birth-form input[type="text"]::placeholder {
    color: rgba(255, 255, 255, 0.3) !important;
}

.birth-form input[type="text"]:focus,
.birth-form input[type="date"]:focus,
.birth-form input[type="time"]:focus {
    border-color: #6c5ce7 !important;
    background: rgba(108, 92, 231, 0.1) !important;
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.2) !important;
}

/* --- Form Help Text --- */
.form-help {
    display: block !important;
    font-size: 0.8rem !important;
    color: rgba(255, 255, 255, 0.35) !important;
    margin-top: 6px !important;
    font-style: italic;
}

/* --- Form Group Spacing --- */
.form-group {
    margin-bottom: 20px !important;
}

/* --- Form Row (Date + Time) --- */
.form-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 16px !important;
}

/* --- Checkboxes --- */
.form-options {
    margin: 20px 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
}

.checkbox-label {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    cursor: pointer !important;
    font-size: 0.95rem !important;
    color: rgba(255, 255, 255, 0.65) !important;
    transition: color 0.2s ease !important;
    padding: 8px 12px !important;
    border-radius: 10px !important;
    border: 1px solid rgba(108, 92, 231, 0.15) !important;
    background: rgba(255, 255, 255, 0.02) !important;
    transition: all 0.2s ease !important;
}

.checkbox-label:hover {
    color: rgba(255, 255, 255, 0.9) !important;
    border-color: rgba(108, 92, 231, 0.4) !important;
    background: rgba(108, 92, 231, 0.08) !important;
}

/* Hide native checkbox */
.checkbox-label input[type="checkbox"] {
    display: none !important;
}

/* Custom checkbox */
.checkmark {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    border: 2px solid rgba(108, 92, 231, 0.6) !important;
    border-radius: 6px !important;
    background: transparent !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    position: relative;
}

.checkbox-label input[type="checkbox"]:checked ~ .checkmark {
    background: #6c5ce7 !important;
    border-color: #6c5ce7 !important;
}

.checkbox-label input[type="checkbox"]:checked ~ .checkmark::after {
    content: '' !important;
    width: 5px !important;
    height: 9px !important;
    border: 2px solid #fff !important;
    border-top: none !important;
    border-left: none !important;
    transform: rotate(45deg) !important;
    position: absolute !important;
    top: 1px !important;
}

/* --- Submit / Calculate Button --- */
.calculate-btn {
    width: 100% !important;
    padding: 18px 30px !important;
    background: linear-gradient(135deg, #6c5ce7 0%, #8e7dff 50%, #6c5ce7 100%) !important;
    background-size: 200% 200% !important;
    border: none !important;
    border-radius: 14px !important;
    color: #ffffff !important;
    font-size: 1.1rem !important;
    font-weight: 700 !important;
    font-family: inherit !important;
    cursor: pointer !important;
    letter-spacing: 0.3px !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 20px rgba(108, 92, 231, 0.5) !important;
    margin-top: 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    position: relative;
    overflow: hidden;
}

.calculate-btn::before {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transition: left 0.5s ease;
}

.calculate-btn:hover::before {
    left: 100%;
}

.calculate-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 30px rgba(108, 92, 231, 0.7) !important;
    background-position: right center !important;
}

.calculate-btn:active {
    transform: translateY(0px) !important;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4) !important;
}

/* --- Mobile Responsive --- */
@media (max-width: 600px) {
    .input-card {
        padding: 28px 20px !important;
        border-radius: 18px !important;
    }

    .form-row {
        grid-template-columns: 1fr !important;
    }

    .calculate-btn {
        font-size: 1rem !important;
        padding: 16px 20px !important;
    }
}

/* ============================================================
   MATRIX LEGEND & DIAGRAM MOBILE CENTERING FIXES
   ============================================================ */

/* Desktop: legend floats to the right of SVG */
.matrix-diagram-container {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.matrix-diagram-container > svg {
    flex: 1 1 300px;
    max-width: 100%;
    height: auto;
    display: block;
}

/* On tablets and below: legend goes below the SVG, centered */
@media (max-width: 1024px) {
    .matrix-diagram-container {
        flex-direction: column;
        align-items: center;
    }

    .matrix-legend-floating {
        position: static !important;
        top: auto !important;
        right: auto !important;
        margin: 0 auto 12px !important;
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 8px 16px !important;
        width: auto !important;
        text-align: center;
    }

    .matrix-legend-floating .legend-note {
        width: 100%;
        text-align: center;
    }
}

/* On mobile: fully centered, smaller font */
@media (max-width: 768px) {
    .matrix-diagram-container {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .matrix-legend-floating {
        position: static !important;
        top: auto !important;
        right: auto !important;
        margin: 8px auto !important;
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 6px 14px !important;
        font-size: 0.78rem !important;
        padding: 8px 12px !important;
        transform: none !important;
        width: auto !important;
        max-width: 100%;
    }

    .matrix-legend-floating .legend-group {
        display: flex;
        align-items: center;
        gap: 5px;
    }

    .matrix-legend-floating .legend-note {
        width: 100%;
        text-align: center;
        margin-top: 2px;
    }
}

/* ============================================================
   /* ============================================================
/* ============================================================
   ACTION BUTTONS — HIGH CONTRAST & THEMED RECEPTACLE
   Theme: Golden (#f1c40f) and Deep Purple (#6c5ce7)
   ============================================================ */

/* -- Shared base for ALL .action-btn across the page ------- */
.action-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    padding: 12px 24px !important;
    border-radius: 12px !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    font-family: inherit !important;
    cursor: pointer !important;
    border: none !important;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    white-space: nowrap !important;
    letter-spacing: 0.5px !important;
    text-decoration: none !important;
    line-height: 1.2 !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
    text-transform: uppercase !important;
}

/* -- Primary button (Export) — Golden Yellow like the logo -- */
.action-btn.primary,
#exportBtn,
#exportHealthChartBtn,
#exportMatrixDiagramBtn {
    background: linear-gradient(135deg, #f1c40f 0%, #f39c12 100%) !important;
    color: #1a1a1a !important; /* Dark text for highest legibility on gold */
    box-shadow: 0 6px 20px rgba(243, 156, 18, 0.4) !important;
}

.action-btn.primary:hover,
#exportBtn:hover {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%) !important;
    transform: translateY(-3px) scale(1.02) !important;
    box-shadow: 0 10px 25px rgba(243, 156, 18, 0.5) !important;
}

/* -- Secondary buttons (Print/Share) — Solid Purple ------- */
.action-btn.secondary,
#printBtn,
#shareBtn,
#printHealthChartBtn,
#printMatrixDiagramBtn {
    background: #6c5ce7 !important;
    color: #ffffff !important;
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.3) !important;
}

.action-btn.secondary:hover,
#printBtn:hover {
    background: #5a4bd1 !important;
    transform: translateY(-3px) scale(1.02) !important;
    box-shadow: 0 10px 25px rgba(108, 92, 231, 0.45) !important;
}

/* -- New Calculation — Solid Bright Teal ------------------ */
#newCalculationBtn {
    background: #00b894 !important;
    color: #ffffff !important;
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 6px 20px rgba(0, 184, 148, 0.3) !important;
}

#newCalculationBtn:hover {
    background: #00a082 !important;
    transform: translateY(-3px) scale(1.02) !important;
    box-shadow: 0 10px 25px rgba(0, 184, 148, 0.45) !important;
}

/* -- Button groups layout ---------------------------------- */
.action-buttons {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 15px !important;
    padding: 25px 15px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Health chart & diagram action-buttons groups */
.health-chart-card .action-buttons,
.matrix-diagram-card .action-buttons {
    padding: 14px 0 4px !important;
    gap: 10px !important;
}

/* Main bottom results action-buttons group */
.results-section > .action-buttons,
#resultsSection > .action-buttons,
.results-section .action-buttons:last-of-type {
    padding: 20px 10px !important;
    gap: 10px !important;
}

/* -- Mobile: stack buttons vertically with full width ------ */
@media (max-width: 520px) {
    .action-buttons {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        padding: 20px 10px !important;
    }

    .action-btn {
        width: 100% !important;
        max-width: 100% !important;
        padding: 15px 20px !important;
        font-size: 0.95rem !important;
        border-radius: 14px !important; /* Slightly more rounded on mobile */
    }

    /* Keep icons same size */
    .action-btn i,
    .action-btn .fas,
    .action-btn .far {
        font-size: 0.95rem !important;
    }
}

/* -- Tablet: Grid layout ----------------------------------- */
@media (min-width: 521px) and (max-width: 768px) {
    #resultsSection .action-buttons,
    .health-chart-card .action-buttons,
    .matrix-diagram-card .action-buttons {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 15px !important;
    }

    .action-btn {
        width: 100% !important;
        padding: 11px 14px !important;
        font-size: 0.87rem !important;
    }
}
