/**
 * Enwell Offertformulär - Frontend CSS
 * Version 3.5 - Fixad desktop/mobil separation
 * 
 * SEKTIONER:
 * 1. CSS-variabler
 * 2. Wrapper och Container
 * 3. Besparingskalkylator Sidebar
 * 4. Inline Kalkylator
 * 5. Steg-indikator
 * 6. Formulär Innehåll
 * 7. Alternativknappar (Radioknappar)
 * 8. Formulärfält
 * 9. Knappar
 * 10. Meddelanden och Loader
 * 11. Test Mode Indikator
 * 12. Google Places Autocomplete
 * 13. Desktop Stilar (769px+)
 * 14. Mobil Stilar (max 768px)
 */

/* ========================================
   SEKTION 1: CSS-VARIABLER
   ======================================== */
:root {
    /* Grundfärger */
    --eof-primary-color: #4a7c59;
    --eof-primary-hover: #3d6349;
    --eof-primary-light: #f0f7f3;
    --eof-background-color: #ffffff;
    --eof-container-bg: #f8f8f8;
    
    /* Alternativknappar (radioknappar) */
    --eof-option-bg: #ffffff;
    --eof-option-text: #333333;
    --eof-option-border-style: solid;
    --eof-option-border-width: 2px;
    --eof-option-border-color: #e0e0e0;
    --eof-option-border-radius: 8px;
    --eof-option-hover-bg: #fafafa;
    --eof-option-selected-bg: #f0f7f3;
    --eof-option-selected-border: #4a7c59;
    
    /* Primärknappar */
    --eof-button-bg: #4a7c59;
    --eof-button-hover: #3d6349;
    --eof-button-text: #ffffff;
    --eof-button-radius: 8px;
    
    /* Sekundärknappar */
    --eof-button-secondary-bg: #f5f5f5;
    --eof-button-secondary-text: #666;
    --eof-button-secondary-hover: #e0e0e0;
    --eof-button-secondary-radius: 8px;
    
    /* Steg-indikatorer */
    --eof-step-size: 40px;
    --eof-step-inactive-bg: #f5f5f5;
    --eof-step-inactive-color: #999;
    --eof-step-active-bg: #4a7c59;
    --eof-step-active-color: #ffffff;
    --eof-step-completed-bg: #6fa581;
    --eof-step-completed-color: #ffffff;
    --eof-step-line-color: #e0e0e0;
    
    /* Kalkylator */
    --eof-calc-bg: #f8f8f8;
    --eof-calc-border-style: solid;
    --eof-calc-border-width: 2px;
    --eof-calc-border-color: #e0e0e0;
    --eof-calc-border-radius: 8px;
    --eof-calc-display-bg: #ffffff;
    --eof-calc-amount-color: #4a7c59;
    --eof-calc-label-color: #666;
    --eof-calc-info-color: #666;
    
    /* Formulärfält */
    --eof-input-bg: #ffffff;
    --eof-input-border-color: #ddd;
    --eof-input-border-radius: 6px;
    --eof-input-focus-color: #4a7c59;
    --eof-input-padding: 12px 15px;
    --eof-input-margin-bottom: 15px;
    
    /* Animationer */
    --eof-transition-speed: 0.3s;
    
    /* Typografi */
    --eof-font-size: 16px;
    --eof-heading-size: 24px;
}

/* ========================================
   SEKTION 2: WRAPPER OCH CONTAINER
   ======================================== */
.eof-form-wrapper {
    display: flex;
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: var(--eof-font-size);
}

.eof-form-container {
    flex: 1;
    background: var(--eof-container-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* ========================================
   SEKTION 3: BESPARINGSKALKYLATOR SIDEBAR
   ======================================== */
.eof-calculator-sidebar {
    flex: 0 0 320px;
    position: sticky;
    top: 20px;
    height: fit-content;
}

.eof-calculator-content {
    background: var(--eof-calc-bg);
    padding: 30px;
    border-radius: var(--eof-calc-border-radius);
    border: var(--eof-calc-border-width) var(--eof-calc-border-style) var(--eof-calc-border-color);
    min-height: 200px;
    transition: all var(--eof-transition-speed) ease;
}

.eof-calculator-content h3 {
    margin: 0 0 15px 0;
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
}

.eof-calculator-content p {
    color: var(--eof-calc-label-color);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.eof-savings-display {
    background: var(--eof-calc-display-bg);
    padding: 25px;
    border-radius: calc(var(--eof-calc-border-radius) / 2);
    text-align: center;
    margin-top: 20px;
    display: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all var(--eof-transition-speed) ease;
}

.eof-savings-display.active {
    display: block;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.eof-savings-label {
    display: block;
    font-size: 14px;
    color: var(--eof-calc-label-color);
    margin-bottom: 10px;
}

.eof-savings-amount {
    margin-bottom: 15px;
}

.eof-savings-amount .eof-amount {
    font-size: 42px;
    font-weight: 600;
    color: var(--eof-calc-amount-color);
}

.eof-savings-amount .eof-currency {
    font-size: 20px;
    color: var(--eof-calc-amount-color);
    margin-left: 5px;
}

.eof-savings-info {
    font-size: 13px;
    color: var(--eof-calc-info-color);
}

.eof-savings-info .eof-percent {
    font-weight: 600;
    color: var(--eof-calc-amount-color);
}

.eof-savings-placeholder {
    background: var(--eof-calc-display-bg);
    padding: 25px;
    border-radius: calc(var(--eof-calc-border-radius) / 2);
    text-align: center;
    margin-top: 20px;
}

.eof-savings-placeholder.hidden {
    display: none;
}

.eof-savings-placeholder p {
    margin: 0;
    color: #999;
    font-style: italic;
}

/* ========================================
   SEKTION 4: INLINE KALKYLATOR
   ======================================== */
.eof-inline-calculator {
    display: none;
    margin: 20px 0;
}

.eof-inline-calculator .eof-calculator-content {
    background: var(--eof-calc-bg);
    padding: 20px;
    border-radius: var(--eof-calc-border-radius);
    border: var(--eof-calc-border-width) var(--eof-calc-border-style) var(--eof-calc-border-color);
}

/* ========================================
   SEKTION 5: STEG-INDIKATOR
   ======================================== */
.eof-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    position: relative;
}

.eof-steps::before {
    content: '';
    position: absolute;
    top: calc(var(--eof-step-size) / 2);
    left: 10%;
    right: 10%;
    height: 2px;
    background: var(--eof-step-line-color);
    z-index: 1;
}

.eof-step {
    flex: 1;
    text-align: center;
    position: relative;
    z-index: 2;
    cursor: pointer;
    opacity: 1;
    transition: opacity var(--eof-transition-speed) ease;
}

.eof-step.active,
.eof-step.completed {
    opacity: 1;
}

.eof-step-number {
    display: inline-block;
    width: var(--eof-step-size);
    height: var(--eof-step-size);
    line-height: var(--eof-step-size);
    border-radius: 50%;
    background: var(--eof-step-inactive-bg);
    color: var(--eof-step-inactive-color);
    font-weight: bold;
    margin-bottom: 8px;
    transition: all var(--eof-transition-speed) ease;
}

.eof-step.active .eof-step-number {
    background: var(--eof-step-active-bg);
    color: var(--eof-step-active-color);
    box-shadow: 0 2px 8px rgba(74, 124, 89, 0.3);
}

.eof-step.completed .eof-step-number {
    background: var(--eof-step-completed-bg);
    color: var(--eof-step-completed-color);
}

.eof-step-label {
    display: block;
    font-size: 12px;
    color: #666;
}

.eof-step.active .eof-step-label {
    font-weight: 600;
    color: #333;
}

/* ========================================
   SEKTION 6: FORMULÄR INNEHÅLL
   ======================================== */
.eof-step-content {
    display: none;
    animation: fadeIn 0.5s ease;
}

.eof-step-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.eof-step-content h2 {
    color: #333;
    margin-bottom: 30px;
    font-size: var(--eof-heading-size);
    text-align: center;
}

/* ========================================
   SEKTION 7: ALTERNATIVKNAPPAR (RADIOKNAPPAR)
   ======================================== */
.eof-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.eof-option {
    position: relative;
    cursor: pointer;
}

.eof-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.eof-option-content {
    display: block;
    padding: 20px;
    border: var(--eof-option-border-width) var(--eof-option-border-style) var(--eof-option-border-color);
    border-radius: var(--eof-option-border-radius);
    background: var(--eof-option-bg);
    transition: all var(--eof-transition-speed) ease;
    text-align: center;
}

.eof-option:hover .eof-option-content {
    border-color: var(--eof-primary-color);
    background: var(--eof-option-hover-bg);
}

.eof-option input[type="radio"]:checked + .eof-option-content {
    border-color: var(--eof-option-selected-border);
    background: var(--eof-option-selected-bg);
    box-shadow: 0 2px 8px rgba(74, 124, 89, 0.15);
}

.eof-option-text {
    font-size: 15px;
    color: var(--eof-option-text);
    font-weight: 500;
}

/* ========================================
   SEKTION 8: FORMULÄRFÄLT
   ======================================== */
.eof-form-fields {
    max-width: 600px;
    margin: 0 auto;
}

.eof-form-group {
    margin-bottom: 20px;
}

.eof-form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
    font-size: 14px;
}

.eof-input {
    width: 100%;
    padding: var(--eof-input-padding);
    border: 1px solid var(--eof-input-border-color);
    border-radius: var(--eof-input-border-radius);
    background: var(--eof-input-bg);
    font-size: var(--eof-font-size);
    transition: all var(--eof-transition-speed) ease;
}

.eof-input:focus {
    outline: none;
    border-color: var(--eof-input-focus-color);
    box-shadow: 0 0 0 3px rgba(74, 124, 89, 0.1);
}

.eof-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.eof-checkbox {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
}

.eof-checkbox input[type="checkbox"] {
    margin-right: 8px;
    margin-top: 2px;
}

/* ========================================
   SEKTION 9: KNAPPAR
   ======================================== */
.eof-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
}

.eof-btn {
    padding: 12px 30px;
    border: none;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--eof-transition-speed) ease;
}

.eof-btn-back {
    background: var(--eof-button-secondary-bg);
    color: var(--eof-button-secondary-text);
    border-radius: var(--eof-button-secondary-radius);
}

.eof-btn-back:hover {
    background: var(--eof-button-secondary-hover);
    transform: translateX(-2px);
}

.eof-btn-primary {
    background: var(--eof-button-bg);
    color: var(--eof-button-text);
    border-radius: var(--eof-button-radius);
    margin-left: auto;
}

.eof-btn-primary:hover {
    background: var(--eof-button-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.eof-btn-submit {
    font-size: 18px;
    padding: 15px 40px;
}

/* ========================================
   SEKTION 10: MEDDELANDEN OCH LOADER
   ======================================== */
.eof-message {
    padding: 20px;
    border-radius: 8px;
    margin-top: 30px;
    text-align: center;
}

.eof-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.eof-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.eof-loader {
    text-align: center;
    padding: 60px 20px;
}

.eof-spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--eof-primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========================================
   SEKTION 11: TEST MODE INDIKATOR
   ======================================== */
.eof-test-mode {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #ff9800;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    z-index: 10000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ========================================
   SEKTION 12: GOOGLE PLACES AUTOCOMPLETE
   ======================================== */
.pac-container {
    z-index: 10000;
    border-radius: 6px;
    margin-top: 2px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.pac-item {
    padding: 10px 15px;
    cursor: pointer;
}

.pac-item:hover {
    background: #f5f5f5;
}

.pac-item-selected {
    background: #e8f5e9;
}

/* ========================================
   SEKTION 13: DESKTOP STILAR (769px+)
   ======================================== */
@media (min-width: 769px) {
    /* Sidebar visas ALLTID på desktop */
    .eof-form-wrapper .eof-calculator-sidebar {
        display: block !important;
        flex: 0 0 320px;
        position: sticky;
        top: 20px;
    }
    
    /* Inline-kalkylator döljs ALLTID på desktop */
    .eof-inline-calculator {
        display: none !important;
    }
}

/* ========================================
   SEKTION 14: MOBIL STILAR (max 768px)
   ======================================== */
@media (max-width: 768px) {
    /* Grundlayout för mobil */
    .eof-form-wrapper {
        flex-direction: column;
    }
    
    /* === KALKYLATOR POSITIONER === */
    
    /* Standard position (top) */
    .eof-form-wrapper .eof-calculator-sidebar {
        position: static;
        flex: none;
        width: 100%;
        margin-bottom: 20px;
        order: -1;
        display: block;
    }
    
    /* Bottom position */
    .eof-form-wrapper.calculator-bottom .eof-calculator-sidebar {
        order: 1;
        margin-bottom: 0;
        margin-top: 20px;
        display: block;
    }
    
    /* Inline position */
    .eof-form-wrapper.calculator-inline .eof-calculator-sidebar {
        display: none !important;
    }
    
    .eof-form-wrapper.calculator-inline .eof-inline-calculator {
        display: block !important;
    }
    
    /* Hidden position */
    .eof-form-wrapper.calculator-hidden .eof-calculator-sidebar,
    .eof-form-wrapper.calculator-hidden .eof-inline-calculator {
        display: none !important;
    }
    
    /* === KALKYLATOR STILAR === */
    
    /* Compact stil */
    .eof-form-wrapper.calculator-style-compact .eof-calculator-content {
        padding: 20px;
    }
    
    .eof-form-wrapper.calculator-style-compact .eof-calculator-content h3 {
        font-size: 16px;
        margin-bottom: 10px;
    }
    
    .eof-form-wrapper.calculator-style-compact .eof-calculator-content > p {
        display: none;
    }
    
    .eof-form-wrapper.calculator-style-compact .eof-savings-display {
        padding: 15px;
        margin-top: 10px;
    }
    
    .eof-form-wrapper.calculator-style-compact .eof-savings-amount .eof-amount {
        font-size: 32px;
    }
    
    .eof-form-wrapper.calculator-style-compact .eof-savings-placeholder {
        padding: 15px;
    }
    
    /* Minimal stil */
    .eof-form-wrapper.calculator-style-minimal .eof-calculator-content {
        padding: 0 !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        min-height: auto !important;
    }
    
    .eof-form-wrapper.calculator-style-minimal .eof-calculator-content h3,
    .eof-form-wrapper.calculator-style-minimal .eof-calculator-content > p {
        display: none !important;
    }
    
    .eof-form-wrapper.calculator-style-minimal .eof-savings-placeholder {
        display: none !important;
    }
    
    .eof-form-wrapper.calculator-style-minimal .eof-savings-display {
        display: block !important;
        padding: 15px 20px !important;
        margin: 0 !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        text-align: center;
    }
    
    .eof-form-wrapper.calculator-style-minimal .eof-savings-label {
        display: inline !important;
        margin: 0 8px 0 0 !important;
        font-size: 14px;
    }
    
    .eof-form-wrapper.calculator-style-minimal .eof-savings-amount {
        display: inline !important;
        margin: 0 !important;
    }
    
    .eof-form-wrapper.calculator-style-minimal .eof-savings-amount .eof-amount {
        font-size: 24px !important;
        font-weight: 700;
    }
    
    .eof-form-wrapper.calculator-style-minimal .eof-savings-amount .eof-currency {
        font-size: 14px !important;
        opacity: 0.8;
        margin-left: 4px;
    }
    
    .eof-form-wrapper.calculator-style-minimal .eof-savings-info {
        display: block !important;
        font-size: 12px;
        margin-top: 5px !important;
        opacity: 0.8;
    }
    
    /* === FORMULÄR MOBILANPASSNING === */
    
    .eof-form-container {
        padding: 15px;
    }
    
    .eof-form-group {
        margin-bottom: var(--eof-input-margin-bottom);
    }
    
    .eof-form-group label {
        margin-bottom: 6px;
        font-size: 13px;
    }
    
    .eof-input {
        padding: 10px 12px;
        font-size: 16px; /* Förhindrar zoom på iOS */
    }
    
    .eof-checkbox {
        margin-top: 10px;
    }
    
    .eof-checkbox span {
        font-size: 13px;
        line-height: 1.4;
    }
    
    .eof-form-row {
        grid-template-columns: 1fr;
        gap: 0px;
    }
    
    /* === STEG-INDIKATOR MOBIL === */
    
    .eof-steps {
        margin-bottom: 30px;
    }
    
    .eof-step-label {
        font-size: 10px;
    }
    
    .eof-step-number {
        width: 36px;
        height: 36px;
        line-height: 36px;
        font-size: 14px;
    }
    
    .eof-steps::before {
        top: 18px;
    }
    
    /* === ALTERNATIVKNAPPAR MOBIL === */
    
    .eof-options {
        grid-template-columns: 1fr;
    }
    
    /* 2-kolumns layout om vald */
    .mobile-columns-2 .eof-options {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .mobile-columns-2 .eof-option-content {
        padding: 15px 10px;
    }
    
    .mobile-columns-2 .eof-option-text {
        font-size: 13px;
    }
    
    /* === NAVIGATION MOBIL === */
    
    .eof-navigation {
        flex-direction: column;
        gap: 10px;
    }
    
    .eof-btn {
        width: 100%;
    }
}