/* ===== ОСНОВА ===== */

body {
    margin: 0;
    font-family: system-ui, -apple-system, Inter, sans-serif;
    background: #ffffff;
    color: #1e293b;
    transition: background .3s, color .3s;
}

/* Контейнер */
.fuel-wrapper {
    max-width: 420px;
    margin: 0 auto;
    padding: 20px;
}

/* Верхняя панель */
.fuel-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.fuel-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

#languageSelect {
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    font-size: 14px;
    transition: .3s;
}

/* Шестерёнка */
.settings-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: #f1f5f9;
    border-radius: 10px;
    font-size: 20px;
    cursor: pointer;
    transition: .2s;
}

.settings-btn:hover {
    background: #e2e8f0;
    transform: rotate(20deg);
}

/* ===== МОДАЛКА ===== */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.modal-content {
    background: white;
    padding: 22px;
    border-radius: 16px;
    width: 90%;
    max-width: 360px;
    position: relative;
    transition: background .3s, color .3s;
}

.close-btn {
    position: absolute;
    right: 12px;
    top: 12px;
    border: none;
    background: #f1f5f9;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
}

/* ===== ПЛАВАЮЩИЕ LABEL’Ы ===== */

.input-group {
    position: relative;
    margin-bottom: 22px;
}

.input-group input {
    width: 100%;
    padding: 16px 14px 14px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    font-size: 16px;
    outline: none;
    transition: .2s;
    color: #0f172a;
}

.input-group input:focus {
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(37,99,235,.18);
    border-color: #2563eb;
}

.input-group label {
    position: absolute;
    left: 14px;
    top: 16px;
    color: #64748b;
    font-size: 16px;
    pointer-events: none;
    transition: .2s ease;
    background: transparent;
}

/* Плавающий эффект */
.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label {
    top: -8px;
    left: 10px;
    background: white;
    padding: 0 6px;
    font-size: 13px;
    color: #2563eb;
}

/* ===== ПОДСВЕТКА ОШИБОК ===== */

.input-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25) !important;
}

/* ===== ПЛАВНОЕ ПОЯВЛЕНИЕ РЕЗУЛЬТАТА ===== */

.result-card {
    text-align: center;
    margin-bottom: 20px;
}

.result-value,
.result-km {
    opacity: 0;
    transform: translateY(4px);
    transition: opacity .25s ease, transform .25s ease;
}

.result-show {
    opacity: 1;
    transform: translateY(0);
}

.result-value {
    font-size: 42px;
    font-weight: 700;
    color: #2563eb;
}

.result-km {
    font-size: 16px;
    color: #475569;
}

/* ===== PWA кнопка ===== */

.install-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: #2563eb;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 20px;
}

/* ===== Хостинг-блок ===== */

.hosting-box {
    border: 1px solid #f1f5f9;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,.06);
    text-align: center;
    transition: background .3s, color .3s;
}

.hosting-btn {
    display: inline-block;
    padding: 12px 20px;
    background: #2563eb;
    color: white;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
}

/* ===== Убираем стрелки ===== */

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
}

/* Placeholder — мягкий */
input::placeholder {
    color: #94a3b8;
    opacity: 1;
}

/* ===== ТЁМНАЯ ТЕМА ===== */

body.dark {
    background: #0f172a;
    color: #e2e8f0;
}

body.dark .modal-content {
    background: #1e293b;
    color: #e2e8f0;
}

body.dark input {
    background: #1e293b;
    color: #f8fafc;
    border-color: #334155;
}

body.dark .result-value {
    color: #60a5fa;
}

body.dark .hosting-box {
    background: #1e293b;
    border-color: #334155;
}

body.dark .input-group input:focus {
    box-shadow: 0 0 0 3px rgba(96,165,250,.25);
    border-color: #60a5fa;
}

body.dark .input-group label {
    background: #0f172a;
}

body.dark .input-group input:focus + label,
body.dark .input-group input:not(:placeholder-shown) + label {
    background: #0f172a;
    color: #60a5fa;
}
/* ===== FIX FLOATING LABELS ON DARK MODE ===== */

body.dark .input-group label {
    background: transparent !important;
}

body.dark .input-group input:focus + label,
body.dark .input-group input:not(:placeholder-shown) + label {
    background: transparent !important;
    color: #60a5fa !important;
}
/* Светлая тема — всплывающий label */
.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label {
    top: -10px;
    left: 10px;
    background: transparent;
    padding: 0 6px;
    font-size: 16px;        /* БОЛЬШЕ */
    font-weight: 600;       /* ЖИРНЕЕ */
    color: #2563eb;         /* Яркий синий */
}

/* Тёмная тема — всплывающий label */
body.dark .input-group input:focus + label,
body.dark .input-group input:not(:placeholder-shown) + label {
    background: transparent;
    color: #bfdbfe;         /* Яркий голубой, читаемый */
    font-size: 16px;        /* БОЛЬШЕ */
    font-weight: 600;       /* ЖИРНЕЕ */
}
body.dark input[type="number"] {
    background: #1e293b !important;
    color: #f8fafc !important;
    border-color: #334155 !important;
}

/* ===== TRUE iOS STYLE SWITCH ===== */

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #cbd5e1;
    border-radius: 34px;
    transition: .3s;
}

.slider:before {
    content: "";
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: .3s;
}

.switch input:checked + .slider {
    background: #2563eb;
}

.switch input:checked + .slider:before {
    transform: translateX(22px);
}
