/**
 * Yield Calculator Styles
 * Specific styles for the yield calculator
 * Inherits base styles from calculator.css
 *
 * @package Utleiekalk_FINN
 * @version 1.0.0
 */

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

/* ===== Yield Calculator Wrapper ===== */
.yield-calculator-wrapper {
    max-width: 100%;
    width: 100%;
    margin: 0 auto 34px;
    padding: 0 20px;
    color: var(--uk-text);
    box-sizing: border-box;
    font-family: "Manrope", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    text-rendering: optimizeLegibility !important;
}

/* ===== AGGRESSIVE FONT OVERRIDE - Match Rental Calculator ===== */
/* Maximum specificity to override ALL themes (Astra, Elementor, etc.) */

/* Base wrapper and all children - USE MANROPE */
html body .yield-calculator-wrapper,
html body .yield-calculator-wrapper *,
body .yield-calculator-wrapper,
body .yield-calculator-wrapper *,
.yield-calculator-wrapper,
.yield-calculator-wrapper *,
* .yield-calculator-wrapper,
* .yield-calculator-wrapper * {
    font-family: "Manrope", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif !important;
}

/* Elementor compatibility - USE MANROPE */
.elementor-widget-container .yield-calculator-wrapper,
.elementor-widget-container .yield-calculator-wrapper *,
.elementor-element .yield-calculator-wrapper,
.elementor-element .yield-calculator-wrapper *,
div[class*="elementor"] .yield-calculator-wrapper,
div[class*="elementor"] .yield-calculator-wrapper *,
html body .elementor-widget-container .yield-calculator-wrapper,
html body .elementor-widget-container .yield-calculator-wrapper *,
html body .elementor-element .yield-calculator-wrapper,
html body .elementor-element .yield-calculator-wrapper * {
    font-family: "Manrope", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif !important;
}

/* INPUT FIELDS AND FORMS - USE INTER */
html body .yield-calculator-wrapper input,
html body .yield-calculator-wrapper select,
html body .yield-calculator-wrapper textarea,
html body .yield-calculator-wrapper .uk-input,
body .yield-calculator-wrapper input,
body .yield-calculator-wrapper select,
body .yield-calculator-wrapper textarea,
body .yield-calculator-wrapper .uk-input,
.yield-calculator-wrapper input,
.yield-calculator-wrapper select,
.yield-calculator-wrapper textarea,
.yield-calculator-wrapper .uk-input,
* .yield-calculator-wrapper input,
* .yield-calculator-wrapper select,
* .yield-calculator-wrapper textarea,
* .yield-calculator-wrapper .uk-input {
    font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif !important;
}

/* Elementor compatibility - INPUT FIELDS - USE INTER */
.elementor-widget-container .yield-calculator-wrapper input,
.elementor-widget-container .yield-calculator-wrapper select,
.elementor-widget-container .yield-calculator-wrapper textarea,
.elementor-widget-container .yield-calculator-wrapper .uk-input,
.elementor-element .yield-calculator-wrapper input,
.elementor-element .yield-calculator-wrapper select,
.elementor-element .yield-calculator-wrapper textarea,
.elementor-element .yield-calculator-wrapper .uk-input,
div[class*="elementor"] .yield-calculator-wrapper input,
div[class*="elementor"] .yield-calculator-wrapper select,
div[class*="elementor"] .yield-calculator-wrapper textarea,
div[class*="elementor"] .yield-calculator-wrapper .uk-input,
html body .elementor-widget-container .yield-calculator-wrapper input,
html body .elementor-widget-container .yield-calculator-wrapper select,
html body .elementor-widget-container .yield-calculator-wrapper textarea,
html body .elementor-widget-container .yield-calculator-wrapper .uk-input,
html body .elementor-element .yield-calculator-wrapper input,
html body .elementor-element .yield-calculator-wrapper select,
html body .elementor-element .yield-calculator-wrapper textarea,
html body .elementor-element .yield-calculator-wrapper .uk-input {
    font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif !important;
}

.yield-shell {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
}

.yield-form {
    display: grid;
    gap: var(--uk-gap);
}

/* ===== Results Grid Layout ===== */
.yield-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-xl);
    margin-top: var(--spacing-2xl);
    padding-top: var(--spacing-2xl);
    border-top: 1px solid var(--uk-border);
}

/* ===== Result Cards ===== */
.yield-result-card {
    background: var(--uk-card);
    border: 1px solid var(--uk-border);
    border-radius: 16px;
    padding: var(--uk-pad);
    text-align: center;
    box-shadow: var(--uk-shadow);
    transition: all 0.3s ease;
}

.yield-result-card:hover {
    border-color: var(--uk-primary);
    box-shadow: 0 12px 32px rgba(16,24,40,.12),
                0 0 0 2px rgba(9,184,125,.1),
                0 0 20px rgba(9,184,125,.15);
    transform: translateY(-2px);
}

/* ===== Result Labels ===== */
.yield-result-label {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #0b1220;
    margin-bottom: var(--spacing-sm);
}

/* ===== Result Values ===== */
.yield-result-value-wrapper {
    margin: var(--spacing-lg) 0;
}

.yield-result-value {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1.2;
    transition: color 0.3s ease;
}

/* ===== Brutto Yield Color Coding ===== */
.yield-result-brutto.red {
    color: var(--uk-red);
}

.yield-result-brutto.yellow {
    color: var(--uk-accent);
}

.yield-result-brutto.green {
    color: var(--uk-green);
}

/* ===== Netto Yield (No color coding) ===== */
.yield-result-netto {
    color: var(--uk-text);
}

/* ===== Result Description ===== */
.yield-result-description {
    font-size: 12px;
    color: var(--uk-muted);
    margin-bottom: var(--spacing-md);
    font-weight: 500;
}

/* ===== Threshold Hint (below brutto yield) ===== */
.yield-threshold-hint {
    font-size: 13px;
    font-weight: 700;
    padding: 8px 14px;
    border-radius: 12px;
    display: inline-block;
    margin-top: var(--spacing-sm);
    transition: all 0.3s ease;
}

.yield-threshold-hint.red {
    background-color: rgba(220, 38, 38, 0.1);
    color: var(--uk-red);
}

.yield-threshold-hint.yellow {
    background-color: rgba(248, 199, 47, 0.15);
    color: #d4a500;
}

.yield-threshold-hint.green {
    background-color: rgba(5, 150, 105, 0.1);
    color: var(--uk-green);
}

/* ===== Calculation Breakdown (Netto Card) ===== */
.yield-calculation-breakdown {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--uk-border);
    text-align: left;
    background: var(--uk-bg-subtle);
    padding: var(--spacing-md);
    border-radius: 12px;
    margin-left: calc(var(--spacing-md) * -1);
    margin-right: calc(var(--spacing-md) * -1);
    margin-bottom: calc(var(--spacing-md) * -1);
}

.breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-xs) 0;
    font-size: 13px;
    color: var(--uk-text);
}

.breakdown-row span:first-child {
    color: var(--uk-muted);
    font-weight: 500;
}

.breakdown-row span:last-child {
    font-weight: 700;
    font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
    font-feature-settings: 'tnum';
}

.breakdown-total {
    margin-top: var(--spacing-sm);
    padding-top: var(--spacing-sm);
    border-top: 2px solid var(--uk-border);
    font-weight: 700;
}

.breakdown-total span:first-child {
    color: var(--uk-text);
    font-weight: 700;
}

.breakdown-total span:last-child {
    color: var(--uk-primary);
    font-size: 15px;
    font-weight: 800;
}

/* ===== Information Section ===== */
.yield-info-section {
    margin-top: 0;
}

.yield-info-content {
    line-height: 1.7;
    font-size: 14px;
}

.yield-info-content h4 {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.2px;
    color: var(--uk-text);
    margin-bottom: var(--spacing-sm);
    margin-top: var(--spacing-lg);
}

.yield-info-content h4:first-child {
    margin-top: 0;
}

.yield-info-content p {
    margin-bottom: var(--spacing-md);
    color: var(--uk-text);
}

.yield-info-content strong {
    color: var(--uk-primary);
    font-weight: 700;
}

/* ===== Interpretation List ===== */
.yield-interpretation-list {
    list-style: none;
    padding: 0;
    margin: var(--spacing-md) 0;
}

.yield-interpretation-list li {
    display: flex;
    align-items: center;
    padding: var(--spacing-sm) 0;
    color: var(--uk-text);
}

.color-indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: var(--spacing-sm);
    display: inline-block;
    flex-shrink: 0;
}

.color-indicator.red {
    background-color: var(--uk-red);
}

.color-indicator.yellow {
    background-color: var(--uk-accent);
}

.color-indicator.green {
    background-color: var(--uk-green);
}

/* ===== Note Styling ===== */
.yield-note {
    background-color: var(--uk-bg-subtle);
    border-left: 4px solid var(--uk-primary);
    padding: var(--spacing-md);
    border-radius: 12px;
    margin-top: var(--spacing-lg);
}

/* ===== Input Field Overrides for Yield Calculator ===== */
/* Ensure input fields match rental calculator style with !important to override theme */
html body .yield-calculator-wrapper .uk-input {
    padding: 14px 14px !important;
    border-radius: 12px !important;
    border: 1px solid var(--uk-border) !important;
    background: #fff !important;
    background-color: #fff !important;
    font-size: 15px !important;
    transition: border-color .2s, box-shadow .2s !important;
    box-shadow: none !important;
    color: var(--uk-text) !important;
}

html body .yield-calculator-wrapper .uk-input:focus {
    outline: none !important;
    border-color: var(--uk-primary) !important;
    box-shadow: var(--uk-focus) !important;
}

html body .yield-calculator-wrapper .uk-field label {
    display: block !important;
    font-size: 12px !important;
    font-weight: 800 !important;
    letter-spacing: .3px !important;
    margin-bottom: 10px !important;
    text-transform: uppercase !important;
    color: #0b1220 !important;
}

html body .yield-calculator-wrapper .uk-help {
    display: block !important;
    font-size: 12px !important;
    color: var(--uk-muted) !important;
    margin-top: 6px !important;
}

/* ===== Range slider styling with theme override ===== */
html body .yield-calculator-wrapper .uk-range-wrap,
body .yield-calculator-wrapper .uk-range-wrap,
.yield-calculator-wrapper .uk-range-wrap {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

html body .yield-calculator-wrapper input[type="range"],
body .yield-calculator-wrapper input[type="range"],
.yield-calculator-wrapper input[type="range"],
* .yield-calculator-wrapper input[type="range"] {
    -webkit-appearance: none !important;
    appearance: none !important;
    flex: 1 !important;
    width: 100% !important;
    height: 8px !important;
    border-radius: 4px !important;
    outline: none !important;
    margin: 0 !important;
    /* Background is set dynamically by JavaScript */
}

/* Slider thumb (the ball) - WebKit browsers (Chrome, Safari, Edge) */
html body .yield-calculator-wrapper input[type="range"]::-webkit-slider-thumb,
body .yield-calculator-wrapper input[type="range"]::-webkit-slider-thumb,
.yield-calculator-wrapper input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none !important;
    appearance: none !important;
    width: 20px !important;
    height: 20px !important;
    border-radius: 50% !important;
    background: #09B87D !important;
    cursor: pointer !important;
    border: 3px solid white !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15) !important;
}

/* Slider thumb (the ball) - Firefox */
html body .yield-calculator-wrapper input[type="range"]::-moz-range-thumb,
body .yield-calculator-wrapper input[type="range"]::-moz-range-thumb,
.yield-calculator-wrapper input[type="range"]::-moz-range-thumb {
    width: 20px !important;
    height: 20px !important;
    border-radius: 50% !important;
    background: #09B87D !important;
    cursor: pointer !important;
    border: 3px solid white !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15) !important;
}

/* The container should have white background */
html body .yield-calculator-wrapper .uk-range-out {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    border: 1px solid var(--uk-border, #E6E8EC) !important;
    padding: 6px 10px !important;
    border-radius: 10px !important;
    background: #fff !important;
    background-color: #fff !important;
}

/* The input field inside should have transparent/white background - NO GRAY! */
html body .yield-calculator-wrapper .uk-range-out input {
    width: 72px !important;
    border: none !important;
    outline: none !important;
    font-size: 14px !important;
    background: transparent !important;
    background-color: transparent !important;
    color: var(--uk-text, #1b1f23) !important;
    text-align: center !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

/* Remove any theme-added backgrounds on focus */
html body .yield-calculator-wrapper .uk-range-out input:focus {
    background: transparent !important;
    background-color: transparent !important;
    outline: none !important;
    box-shadow: none !important;
}

html body .yield-calculator-wrapper .uk-range-out span {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: var(--uk-muted) !important;
}

/* ===== Responsive Design ===== */

/* Mobile (< 768px) */
@media (max-width: 767px) {
    .yield-calculator-wrapper {
        padding: 0 12px;
    }

    .yield-results-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }

    .yield-result-value {
        font-size: 2.5rem;
    }

    .yield-result-card {
        padding: var(--spacing-lg);
    }

    /* Stack input fields vertically on mobile */
    .uk-grid .uk-field.col-6 {
        width: 100%;
    }
}

/* Tablet (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .yield-results-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }
}

/* Desktop (> 1024px) */
@media (min-width: 1025px) {
    .yield-results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== Animations & Transitions ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.yield-result-card {
    animation: fadeInUp 0.4s ease-out;
}

.yield-result-card:nth-child(1) {
    animation-delay: 0.1s;
}

.yield-result-card:nth-child(2) {
    animation-delay: 0.2s;
}

/* Smooth transitions for value changes */
.yield-result-value,
.breakdown-row span:last-child {
    transition: color 0.3s ease, transform 0.2s ease;
}

/* Pulse effect when values update */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

/* ===== Section Styling to Match Rental Calculator ===== */
.yield-calculator-wrapper .uk-section {
    display: block;
}

.yield-calculator-wrapper .uk-section-body {
    margin-top: 0;
}

/* ===== Additional Polish ===== */
.yield-calculator-wrapper .uk-card {
    position: relative;
}

/* No gradient bar - using subtle glow effect instead */

/* ===== Print Styles ===== */
@media print {
    .yield-calculator-wrapper {
        background: white;
    }

    .yield-result-card {
        border: 1px solid #000;
        page-break-inside: avoid;
        animation: none;
        box-shadow: none;
    }

    .yield-threshold-hint {
        border: 1px solid currentColor;
    }
}
