/* ============================================================
   Forsa Immo Planner — Frontend styles
   ============================================================ */

.fip-app {
    max-width: 1200px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    color: #1d2327;
    line-height: 1.5;
}

.fip-app *, .fip-app *::before, .fip-app *::after { box-sizing: border-box; }

/* ---------- Header ---------- */
.fip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
    color: #fff;
    border-radius: 8px 8px 0 0;
    gap: 20px;
}
.fip-header h2 { margin: 0 0 4px; color: #fff; font-size: 22px; }
.fip-header p { margin: 0; opacity: 0.95; font-size: 14px; }
.fip-header-logo img { max-height: 50px; background: #fff; padding: 4px 8px; border-radius: 4px; }

/* ---------- Stepper ---------- */
.fip-stepper {
    display: flex;
    justify-content: space-between;
    padding: 20px;
    background: #f6f7f7;
    border-bottom: 1px solid #dcdcde;
    gap: 8px;
    flex-wrap: wrap;
}
.fip-step {
    flex: 1;
    min-width: 140px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #dcdcde;
    transition: all 0.2s;
}
.fip-step.active {
    background: #1e3a5f;
    color: #fff;
    border-color: #1e3a5f;
}
.fip-step.done {
    background: #e6f3ec;
    border-color: #4caf50;
}
.fip-step .num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f0f0f1;
    color: #1d2327;
    font-weight: 700;
    flex-shrink: 0;
}
.fip-step.active .num { background: #fff; color: #1e3a5f; }
.fip-step.done .num { background: #4caf50; color: #fff; }
.fip-step .lbl { font-size: 13px; font-weight: 500; }

/* ---------- Screens ---------- */
.fip-screen {
    background: #fff;
    padding: 30px;
    border: 1px solid #dcdcde;
    border-top: none;
    border-radius: 0 0 8px 8px;
}
.fip-screen h3 { margin-top: 0; font-size: 20px; color: #1e3a5f; }
.fip-help { color: #50575e; font-size: 14px; }

/* ---------- Inputs ---------- */
.fip-select-large,
.fip-input-group input,
.fip-input-group select {
    padding: 10px 14px;
    border: 2px solid #dcdcde;
    border-radius: 6px;
    font-size: 15px;
    width: 100%;
    background: #fff;
    transition: border-color 0.15s;
}
.fip-select-large:focus,
.fip-input-group input:focus,
.fip-input-group select:focus {
    border-color: #1e3a5f;
    outline: none;
}

.fip-zone-picker { margin: 20px 0; }

/* ---------- Mode tabs (map vs list) ---------- */
.fip-mode-tabs {
    display: flex;
    gap: 6px;
    margin: 20px 0 14px;
    border-bottom: 2px solid #dcdcde;
}
.fip-mode-tab {
    padding: 10px 18px;
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #50575e;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
}
.fip-mode-tab:hover { color: #1e3a5f; }
.fip-mode-tab.active {
    color: #1e3a5f;
    border-bottom-color: #1e3a5f;
}

/* ---------- Map ---------- */
.fip-map {
    width: 100%;
    height: 460px;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    background: #f6f7f7;
    margin: 10px 0;
}
.fip-map-status {
    padding: 10px 14px;
    background: #f0f6ff;
    border-left: 4px solid #1e3a5f;
    border-radius: 4px;
    font-size: 13px;
    color: #1e3a5f;
    margin-top: 8px;
}
.fip-map-status.error {
    background: #fff7e6;
    border-left-color: #dba617;
    color: #5d4a00;
}
.fip-map-status.success {
    background: #e6f3ec;
    border-left-color: #4caf50;
    color: #1e6b3a;
}

/* WhatsApp button */
.fip-btn-whatsapp {
    background: #25D366;
    color: #fff;
    border-color: #25D366;
    display: inline-block;
    text-decoration: none;
    text-align: center;
    padding: 14px 22px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 8px;
}
.fip-btn-whatsapp:hover { background: #1da851; color: #fff; }

.fip-success-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}
.fip-success-actions .fip-btn { width: 100%; }

.fip-zone-info {
    background: #f9f9fb;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    padding: 20px;
    margin: 20px 0;
}
.fip-zone-info h4 { margin: 0 0 6px; color: #1e3a5f; font-size: 17px; }
.fip-zone-info p { margin: 0 0 14px; color: #50575e; }
.fip-zone-params {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
}
.fip-zone-params .param {
    background: #fff;
    padding: 10px 12px;
    border-radius: 4px;
    border-left: 3px solid #1e3a5f;
}
.fip-zone-params .lbl { display: block; font-size: 11px; color: #646970; text-transform: uppercase; }
.fip-zone-params .val { display: block; font-size: 16px; font-weight: 600; margin-top: 2px; }

/* ---------- Lot inputs ---------- */
.fip-lot-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin: 20px 0;
}
.fip-input-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #50575e;
    margin-bottom: 6px;
}
.fip-input-group.computed output {
    display: block;
    padding: 10px 14px;
    background: #f0f6ff;
    border: 2px solid #1e3a5f;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 700;
    color: #1e3a5f;
}

.fip-warnings { margin: 16px 0; }
.fip-warnings .warn,
.fip-warnings .error {
    padding: 10px 14px;
    border-radius: 6px;
    margin: 6px 0;
    font-size: 14px;
}
.fip-warnings .warn  { background: #fff7e6; border-left: 4px solid #dba617; color: #5d4a00; }
.fip-warnings .error { background: #fcecec; border-left: 4px solid #d63638; color: #6a1212; }

/* ---------- Plan layout (step 3) ---------- */
.fip-plan-layout {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 24px;
    margin: 20px 0;
}
@media (max-width: 880px) {
    .fip-plan-layout { grid-template-columns: 1fr; }
}

.fip-canvas-wrap {
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    padding: 12px;
}
#fip-canvas-container {
    width: 100%;
    height: 500px;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
}

.fip-canvas-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 12px;
    font-size: 12px;
    color: #50575e;
}
.fip-canvas-legend .dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    margin-right: 4px;
    vertical-align: middle;
}
.fip-canvas-legend .lot       { background: #d1d5db; }
.fip-canvas-legend .setback   { background: #fcd34d; }
.fip-canvas-legend .buildable { background: #d1fae5; border: 1px dashed #10b981; }
.fip-canvas-legend .house     { background: #1e3a5f; }

/* ---------- Controls ---------- */
.fip-controls { display: flex; flex-direction: column; gap: 16px; }
.fip-control-group {
    background: #f9f9fb;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    padding: 14px 16px;
}
.fip-control-group h4 {
    margin: 0 0 10px;
    font-size: 14px;
    color: #1e3a5f;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.fip-control-group input[type=range] { width: 100%; }
.fip-range-value { text-align: center; font-weight: 700; font-size: 18px; color: #1e3a5f; margin: 6px 0; }

.fip-floor-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.fip-floor-btn {
    flex: 1;
    padding: 10px;
    border: 2px solid #dcdcde;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.15s;
}
.fip-floor-btn:hover { border-color: #1e3a5f; }
.fip-floor-btn.active {
    background: #1e3a5f;
    color: #fff;
    border-color: #1e3a5f;
}

.fip-input-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 6px 0;
}
.fip-input-row label { font-size: 14px; }
.fip-input-row input { width: 80px; padding: 6px 8px; border: 1px solid #dcdcde; border-radius: 4px; }

.fip-summary {
    background: #f0f6ff;
    border-left: 4px solid #1e3a5f;
    padding: 12px 14px;
    border-radius: 4px;
    font-size: 14px;
}
.fip-summary div { margin: 4px 0; }

.fip-validation { margin-top: 10px; }
.fip-validation .ok {
    background: #e6f3ec;
    border-left: 4px solid #4caf50;
    padding: 10px 14px;
    color: #1e6b3a;
    font-weight: 600;
    border-radius: 4px;
}
.fip-validation .ko {
    background: #fcecec;
    border-left: 4px solid #d63638;
    padding: 10px 14px;
    color: #6a1212;
    border-radius: 4px;
}
.fip-validation .ko ul { margin: 6px 0 0 18px; padding: 0; }

/* ---------- Buttons ---------- */
.fip-actions {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #dcdcde;
}
.fip-final-actions { justify-content: center; }

.fip-btn {
    padding: 12px 22px;
    border: 2px solid #dcdcde;
    background: #fff;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    color: #1d2327;
}
.fip-btn:hover:not(:disabled) { border-color: #1e3a5f; color: #1e3a5f; }
.fip-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.fip-btn-primary {
    background: #1e3a5f;
    color: #fff;
    border-color: #1e3a5f;
}
.fip-btn-primary:hover:not(:disabled) { background: #2c5282; color: #fff; border-color: #2c5282; }
.fip-btn-help {
    background: #25D366;
    color: #fff;
    border-color: #25D366;
}
.fip-btn-help:hover:not(:disabled) { background: #1da851; color: #fff; border-color: #1da851; }
.fip-btn-help-final { font-size: 17px; padding: 14px 28px; }

/* ---------- Cost table ---------- */
.fip-cost-summary {
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
    color: #fff;
    padding: 24px;
    border-radius: 8px;
    margin: 20px 0;
    text-align: center;
}
.fip-cost-total .lbl { display: block; font-size: 14px; opacity: 0.9; text-transform: uppercase; letter-spacing: 0.5px; }
.fip-cost-total .val { display: block; font-size: 28px; font-weight: 800; margin-top: 6px; }

.fip-cost-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
}
.fip-cost-table th,
.fip-cost-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #dcdcde;
    text-align: left;
}
.fip-cost-table th {
    background: #f6f7f7;
    font-weight: 600;
    color: #1e3a5f;
}
.fip-cost-table tr.cat-header td {
    background: #f0f6ff;
    font-weight: 700;
    color: #1e3a5f;
    padding-top: 14px;
}

.fip-disclaimer {
    font-size: 13px;
    color: #646970;
    font-style: italic;
    padding: 12px 14px;
    background: #f9f9fb;
    border-radius: 4px;
    margin: 16px 0;
}

/* ---------- Modal ---------- */
.fip-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.fip-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}
.fip-modal-content {
    position: relative;
    background: #fff;
    border-radius: 10px;
    padding: 30px;
    width: 92%;
    max-width: 460px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.fip-modal-close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: none;
    border: 0;
    font-size: 26px;
    cursor: pointer;
    color: #646970;
    line-height: 1;
}
.fip-modal-content h3 { margin: 0 0 8px; color: #1e3a5f; }
.fip-modal-content p { color: #50575e; margin: 0 0 18px; }

.fip-modal-content .fip-input-group { margin-bottom: 12px; }
.fip-modal-actions { margin-top: 16px; }
.fip-modal-actions .fip-btn { width: 100%; padding: 14px; }

.fip-privacy { font-size: 11px; color: #8c8f94; margin-top: 12px; }

.fip-error {
    color: #d63638;
    background: #fcecec;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    margin: 8px 0;
    display: none;
}
.fip-error.shown { display: block; }

.fip-modal-content.fip-success { text-align: center; }
.fip-success-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: #4caf50;
    color: #fff;
    font-size: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* ====================== HIDDEN PRINT STAGING AREA ======================
   #fip-print-view is filled with project data and then copied into a
   hidden iframe for printing. It's never visible to the user. */
#fip-print-view { display: none !important; }
