/* --- OSAGO PRO STYLES --- */
:root {
    --accent-blue: #2563EB;
    --accent-blue-light: #EFF6FF;
    --gradient-blue-card: linear-gradient(135deg, #2563EB 0%, #1E40AF 100%);
    --text-on-blue: #ffffff;
}

/* Base Layout */
.calc-header { margin-bottom: 32px; }
.subtitle { color: var(--text-secondary); margin-top: 8px; font-size: 16px; line-height: 1.5; }

.calc-grid { display: grid; grid-template-columns: 1fr; gap: 24px; align-items: start; }
@media (min-width: 900px) { .calc-grid { grid-template-columns: 1.4fr 0.6fr; } }

/* Inputs Card FIXES */
.calc-inputs { 
    gap: 24px; 
    z-index: 50; 
    /* Fix for Dropdowns being cut off */
    overflow: visible !important; 
    position: relative;
}

.input-group { margin-bottom: 24px; position: relative; }
.input-group label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 8px; color: var(--text-primary); }

.input-wrapper { position: relative; display: flex; align-items: center; }
.input-wrapper input {
    width: 100%; padding: 14px 16px; padding-right: 40px;
    font-size: 16px; font-weight: 500;
    border: 1px solid #E5E7EB; border-radius: 12px;
    outline: none; transition: border 0.2s; background: #fff;
}
.input-wrapper input:focus { border-color: var(--accent-blue); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.suffix, .suffix-icon { position: absolute; right: 16px; color: var(--text-secondary); pointer-events: none; }
.mt-2 { margin-top: 10px; }

/* --- CUSTOM SELECT V2 (Unified) --- */
.calc-select-hidden { display: none; }
.custom-select { position: relative; width: 100%; user-select: none; }

.custom-select-trigger {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; padding: 14px 16px; font-size: 16px; font-weight: 500;
    border: 1px solid #E5E7EB; border-radius: 12px; cursor: pointer; background: #fff;
    box-sizing: border-box; transition: all 0.2s;
    min-height: 50px;
}
.custom-select.open .custom-select-trigger { border-color: var(--accent-blue); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.custom-arrow { width: 8px; height: 8px; border-right: 2px solid #9CA3AF; border-bottom: 2px solid #9CA3AF; transform: rotate(45deg); transition: 0.2s; margin-left: 10px; flex-shrink: 0; }
.custom-select.open .custom-arrow { transform: rotate(-135deg); border-color: var(--accent-blue); }

.custom-options {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0;
    background: #fff; border: 1px solid #E5E7EB; border-radius: 12px;
    /* High Z-Index to float over everything */
    box-shadow: 0 10px 40px rgba(0,0,0,0.2); z-index: 9999;
    opacity: 0; visibility: hidden; transform: translateY(-10px);
    transition: all 0.2s; max-height: 400px;
    display: flex; flex-direction: column;
}
.custom-select.open .custom-options { opacity: 1; visibility: visible; transform: translateY(0); }

/* Search Box */
.custom-search-wrap { padding: 10px; border-bottom: 1px solid #F3F4F6; background: #fff; position: sticky; top: 0; z-index: 10; border-radius: 12px 12px 0 0; }
.custom-search-input { width: 100%; padding: 10px; border: 1px solid #E5E7EB; border-radius: 8px; font-size: 14px; outline: none; }
.custom-search-input:focus { border-color: var(--accent-blue); }

/* List */
.custom-options-list { overflow-y: auto; flex: 1; scroll-behavior: smooth; -webkit-overflow-scrolling: touch; }
.custom-option { padding: 14px 16px; font-size: 15px; cursor: pointer; border-bottom: 1px solid #F9FAFB; transition: background 0.1s; color: #374151; }
.custom-option:last-child { border-bottom: none; }
.custom-option:hover { background: #EFF6FF; color: var(--accent-blue); }
.custom-option small { display: block; font-size: 12px; opacity: 0.6; margin-top: 2px; }

/* Group Headers */
.custom-group-label {
    padding: 10px 16px; font-size: 11px; font-weight: 700; color: #9CA3AF;
    background: #F9FAFB; text-transform: uppercase; letter-spacing: 0.05em;
    position: sticky; top: 0; z-index: 5; border-bottom: 1px solid #E5E7EB;
}

/* Driver Switcher */
.driver-mode-switch { display: flex; background: #F3F4F6; padding: 4px; border-radius: 12px; margin-bottom: 20px; }
.radio-tab { flex: 1; cursor: pointer; }
.radio-tab input { display: none; }
.tab-box { display: block; padding: 12px; text-align: center; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--text-secondary); transition: 0.2s; }
.radio-tab input:checked + .tab-box { background: #fff; color: var(--accent-blue); box-shadow: 0 2px 8px rgba(0,0,0,0.05); }

/* Drivers List */
.drivers-list { margin-bottom: 16px; }
.driver-row { background: #fff; border: 1px solid #E5E7EB; border-radius: 12px; padding: 16px; margin-bottom: 12px; position: relative; animation: slideDown 0.3s ease; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

.driver-header { display: flex; justify-content: space-between; margin-bottom: 12px; }
.driver-title { font-size: 12px; font-weight: 700; text-transform: uppercase; color: #9CA3AF; letter-spacing: 0.05em; }
.btn-remove-driver { background: none; border: none; color: #EF4444; font-size: 20px; padding: 0 10px; cursor: pointer; opacity: 0.7; }

.driver-inputs { display: grid; grid-template-columns: 1fr 1fr 1.5fr; gap: 12px; }
.d-input-group label { display: block; font-size: 11px; margin-bottom: 4px; color: var(--text-secondary); }
.d-input-group input, .d-input-group select { width: 100%; padding: 10px; font-size: 14px; border: 1px solid #E5E7EB; border-radius: 8px; background: #F9FAFB; }

.btn-add-driver {
    width: 100%; padding: 16px; border: 2px dashed #D1D5DB; border-radius: 12px;
    background: transparent; color: var(--text-secondary); font-weight: 600; cursor: pointer;
    transition: all 0.2s; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 15px;
}
.btn-add-driver:hover { border-color: var(--accent-blue); color: var(--accent-blue); background: #EFF6FF; }

.info-msg { font-size: 14px; color: #4B5563; background: #F3F4F6; padding: 16px; border-radius: 8px; border-left: 3px solid var(--accent-blue); }

/* Result Card */
.card--blue { background: var(--gradient-blue-card); color: var(--text-on-blue); border: none; position: relative; overflow: hidden; padding: 24px; border-radius: 20px; }
.card--blue h2 { color: rgba(255,255,255,0.9); margin-bottom: 24px; font-size: 18px; text-transform: uppercase; letter-spacing: 0.05em; }

.price-range { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; background: rgba(0,0,0,0.1); padding: 16px; border-radius: 12px; }
.price-item .label { font-size: 11px; opacity: 0.7; text-transform: uppercase; display: block; margin-bottom: 4px; }
.price-item .value { font-size: 28px; font-weight: 800; }
.price-dash { opacity: 0.3; font-size: 24px; }

.factors-grid { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 8px; margin-bottom: 20px; }
.factor-item { text-align: center; background: rgba(255,255,255,0.1); padding: 8px; border-radius: 8px; }
.factor-item span { font-size: 10px; opacity: 0.7; display: block; margin-bottom: 2px; }
.factor-item strong { font-size: 14px; }

/* Tip Box */
.tip-box-white {
    background: #FFFFFF; color: #1F2937;
    padding: 16px; border-radius: 12px;
    font-size: 13px; line-height: 1.5;
    display: flex; gap: 12px; align-items: flex-start;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.tip-icon { font-size: 20px; line-height: 1; flex-shrink: 0; }

/* Actions */
.actions-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 24px; }
.btn-action-outline {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    background: transparent; border: 1px solid rgba(255,255,255,0.4);
    color: #fff; padding: 12px; border-radius: 10px; cursor: pointer;
    font-weight: 600; font-size: 14px; transition: 0.2s;
}
.btn-action-outline:hover { background: rgba(255,255,255,0.1); border-color: #fff; }
.copy-feedback {
    text-align: center; font-size: 12px; margin-top: 10px; 
    color: #fff; opacity: 0; transition: opacity 0.3s;
}
.copy-feedback.visible { opacity: 1; }

/* --- INFO & ARTICLES --- */
.info-wrapper { padding: 60px 0; margin-top: 60px; border-top: 1px solid #F3F4F6; }
.article-block { margin-bottom: 40px; }
.article-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 40px; }

.article-card { background: #fff; padding: 24px; border: 1px solid #E5E7EB; border-radius: 16px; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); }
.article-card h3, .article-block h3 { font-size: 18px; font-weight: 700; color: #111827; margin-bottom: 16px; }
.article-card p, .article-block p { font-size: 15px; color: #4B5563; line-height: 1.6; margin-bottom: 16px; }

.icon-heading { display: flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 800; color: #111827; margin-bottom: 24px; }
.header-icon { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.05); flex-shrink: 0; }
.blue-icon svg { color: var(--accent-blue); }

.math-expression { background: #F3F4F6; border: 1px solid #E5E7EB; padding: 16px; border-radius: 12px; font-weight: 700; text-align: center; color: var(--accent-blue); font-family: monospace; font-size: 16px; margin-bottom: 32px; word-wrap: break-word; }

/* Tables */
.calc-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 20px; }
.calc-table th { text-align: left; padding: 12px; border-bottom: 2px solid #E5E7EB; color: #6B7280; font-weight: 600; font-size: 12px; text-transform: uppercase; }
.calc-table td { padding: 12px; border-bottom: 1px solid #F3F4F6; color: #374151; vertical-align: top; }
.calc-table tr:last-child td { border-bottom: none; }
.full-width { min-width: 100%; }
.comparison-table-wrapper { overflow-x: auto; margin-bottom: 24px; border: 1px solid #E5E7EB; border-radius: 12px; -webkit-overflow-scrolling: touch; }

/* FAQ Style */
.faq-section { margin-top: 40px; }
.faq-blue-style .faq-item { background: #fff; border: 1px solid #E5E7EB; border-radius: 12px; margin-bottom: 12px; overflow: hidden; }
.faq-blue-style .faq-item[open] { border-color: var(--accent-blue); box-shadow: 0 4px 12px rgba(37,99,235,0.1); }
.faq-blue-style summary.faq-question { padding: 18px 20px; cursor: pointer; font-weight: 600; color: #1F2937; list-style: none; display: flex; justify-content: space-between; align-items: center; transition: background 0.2s; }
.faq-blue-style summary.faq-question:hover { background: #F9FAFB; }
.faq-blue-style .faq-item[open] summary.faq-question { background: #EFF6FF; color: var(--accent-blue); }
.faq-question::after { content: '+'; font-size: 20px; color: #9CA3AF; }
.faq-blue-style .faq-item[open] summary.faq-question::after { content: '−'; color: var(--accent-blue); }
.faq-answer { padding: 20px; color: #4B5563; line-height: 1.6; font-size: 15px; border-top: 1px solid #F3F4F6; }

.summary-divider { height: 1px; background: rgba(255,255,255,0.2); margin: 20px 0; }
.soft-divider { border: none; height: 1px; background: linear-gradient(90deg, transparent, #E5E7EB, transparent); margin: 48px 0; }
.divider { border: 0; border-top: 1px solid #E5E7EB; margin: 24px 0; }

@media (max-width: 768px) {
    .calc-grid { grid-template-columns: 1fr; }
    .article-grid { grid-template-columns: 1fr; }
    .driver-inputs { grid-template-columns: 1fr 1fr; }
    .d-kbm-group { grid-column: span 2; }
    .calc-header h1 { font-size: 24px; }
    .price-range { padding: 12px; }
    .price-item .value { font-size: 24px; }
}

/* --- PRINT & PDF STYLES (Fixed to fit A4) --- */
@media print {
    @page { margin: 0; size: auto; }
    body { background: #fff; margin: 0; padding: 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    
    /* Hide Everything extraneous */
    .calc-header, .calc-inputs, .back-link, .sidebar, 
    header, footer, .no-print, .screen-only, .btn-action, .actions-row, .faq-section { 
        display: none !important; 
    }

    /* Layout Reset */
    .calc-grid { display: block; margin: 0; gap: 0; padding: 1cm; }
    .container { width: 100%; max-width: 100%; padding: 0; margin: 0; }
    
    /* Result Card Print Version */
    .calc-results { width: 100%; margin: 0; page-break-inside: avoid; }
    .sticky-card { position: static !important; top: auto; }
    
    /* Optimized Card */
    .card--blue {
        background: #fff !important; color: #000 !important;
        border: 2px solid #000; box-shadow: none; padding: 15px;
        border-radius: 4px; margin-bottom: 20px;
    }
    
    /* Headers */
    .print-header { display: flex !important; justify-content: space-between; align-items: center; border-bottom: 2px solid #000; margin-bottom: 15px; padding-bottom: 10px; }
    .print-header h2 { margin: 0; font-size: 20px; text-transform: uppercase; color: #000; }
    .print-date { font-size: 12px; color: #000; }
    
    .print-details { display: block !important; margin: 10px 0; font-size: 13px; line-height: 1.4; color: #000; border-bottom: 1px solid #ccc; padding-bottom: 10px; }
    
    /* Price */
    .price-range { background: none; border: 1px solid #000; padding: 8px; color: #000; margin-bottom: 15px; }
    .price-item .label { color: #000; opacity: 1; font-weight: bold; font-size: 10px; }
    .price-item .value { color: #000; font-size: 24px; }
    
    /* Factors */
    .factors-grid { gap: 5px; border: 1px solid #000; padding: 8px; margin-bottom: 10px; }
    .factor-item { background: none; border: none; text-align: left; display: flex; justify-content: space-between; padding: 2px 0; border-bottom: 1px dotted #ccc; }
    .factor-item span { color: #000; opacity: 1; font-size: 11px; }
    .factor-item strong { color: #000; font-size: 11px; }
    
    /* Tip Box */
    .tip-box-white { border: 1px solid #000; background: none; color: #000; box-shadow: none; margin-top: 15px; padding: 10px; }

    /* Bottom Info */
    .info-wrapper { margin-top: 0; padding-top: 20px; border: none; padding-left: 1cm; padding-right: 1cm; }
    .article-block, .article-card { border: none; padding: 0; box-shadow: none; margin-bottom: 15px; page-break-inside: avoid; }
    .article-card h3, .article-block h3 { color: #000; border-bottom: 1px solid #000; padding-bottom: 4px; display: inline-block; font-size: 14px; }
    .math-expression { border: 1px solid #000; background: none; color: #000; font-weight: bold; font-size: 12px; padding: 8px; }
    .calc-table { font-size: 12px; }
    .calc-table th { color: #000; border-bottom: 2px solid #000; padding: 6px; }
    .calc-table td { color: #000; border-bottom: 1px solid #ccc; padding: 6px; }
}