/*
 * styles.css — All custom styles for the Car Import Calculator.
 * Tailwind CSS (CDN) handles utility classes in index.html.
 * This file covers component-level styles only.
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', sans-serif; }

/* ── Number input: remove native spinner ──────────── */
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; }

/* ── Custom stepper ───────────────────────────────── */
.stepper-wrap { position: relative; display: flex; align-items: center; }
.stepper-wrap input {
    width: 100%;
    padding: 0.5rem 2.6rem 0.5rem 0.85rem;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 0.5rem;
    color: #fff;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.stepper-wrap input:focus {
    outline: none;
    border-color: #006233;
    box-shadow: 0 0 0 3px rgba(0,98,51,0.15);
}
.stepper-btns {
    position: absolute;
    right: 4px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.stepper-btns button {
    width: 22px; height: 16px;
    background: #334155;
    border: none;
    border-radius: 3px;
    color: #94a3b8;
    cursor: pointer;
    font-size: 9px;
    line-height: 1;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.stepper-btns button:hover { background: #006233; color: #fff; }

/* ── Tooltip ──────────────────────────────────────── */
.tip { position: relative; display: inline-flex; align-items: center; cursor: help; }
.tip .tipbox {
    visibility: hidden; opacity: 0;
    width: 220px;
    background: #0f172a;
    border: 1px solid #334155;
    color: #cbd5e1;
    font-size: 11px;
    line-height: 1.5;
    text-align: left;
    border-radius: 8px;
    padding: 8px 10px;
    position: absolute;
    z-index: 10;
    bottom: calc(100% + 6px);
    left: 50%; transform: translateX(-50%);
    transition: opacity 0.2s;
    pointer-events: none;
}
.tip:hover .tipbox { visibility: visible; opacity: 1; }

/* ── Language toggle ──────────────────────────────── */
.lang-btn {
    color: #cbd5e1;
    transition: all 0.2s ease;
    min-width: 32px;
    text-align: center;
}
.lang-btn.active {
    background: #006233;
    color: #fff;
    font-weight: 600;
}
.lang-btn:hover:not(.active) {
    color: #e2e8f0;
    background: #475569;
}

/* ── Result card pulse animation ──────────────────── */
@keyframes pulse-green {
    0%   { box-shadow: 0 0 0 0 rgba(0,98,51,0.5); }
    70%  { box-shadow: 0 0 0 10px rgba(0,98,51,0); }
    100% { box-shadow: 0 0 0 0 rgba(0,98,51,0); }
}
.result-pulse { animation: pulse-green 0.5s ease-out; }

/* ── Go-to-top button ─────────────────────────────── */
#goToTop {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 40;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #006233;
    border: 1px solid #008844;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}
#goToTop.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
#goToTop:hover { background: #008844; transform: scale(1.1); }

/* ── Scroll progress bar ──────────────────────────── */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, #006233, #D4AF37);
    z-index: 50;
    transition: width 50ms linear;
    pointer-events: none;
}

/* ── Scroll snap ──────────────────────────────────── */
.snap-container { scroll-snap-type: y proximity; }
.snap-section   { scroll-snap-align: start; }

/* ── Print ────────────────────────────────────────── */
@media print {
    .no-print { display: none !important; }
    body { background: #fff !important; color: #000 !important; }
}

/* ══════════════════════════════════════════════════════
   History Panel Styles
   ══════════════════════════════════════════════════════ */
.history-info-banner {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid #334155;
    border-left: 3px solid #D4AF37;
    border-radius: 0.5rem;
    padding: 0.6rem 0.85rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: #94a3b8;
    line-height: 1.4;
}
.history-info-banner span.icon { font-size: 1rem; flex-shrink: 0; }
.history-info-banner strong    { color: #D4AF37; }

.history-card {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid #334155;
    border-radius: 0.5rem;
    padding: 0.85rem 1rem;
    transition: all 0.2s ease;
}
.history-card:hover {
    border-color: #006233;
    box-shadow: 0 2px 10px rgba(0, 98, 51, 0.12);
}
.history-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    cursor: pointer;
    user-select: none;
    gap: 0.5rem;
}
.history-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.history-card-date {
    font-size: 0.7rem;
    color: #64748b;
    margin-top: 0.1rem;
}

.delete-btn {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 0.3rem 0.6rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}
.delete-btn:hover { background: #ef4444; color: white; }

.history-card-result {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: nowrap;
}
.result-item {
    flex: 1;
    min-width: 0;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 0.375rem;
    padding: 0.35rem 0.5rem;
    text-align: center;
}
.result-label {
    font-size: 0.6rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.1rem;
}
.result-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: #006233;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.result-value.gold { color: #D4AF37; }

.collapsible-toggle {
    width: 100%;
    text-align: center;
    background: transparent;
    border: 1px solid #1e293b;
    color: #64748b;
    padding: 0.35rem 0.75rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-top: 0.4rem;
}
.collapsible-toggle:hover {
    background: #1e293b;
    color: #cbd5e1;
    border-color: #475569;
}
.collapsible-toggle.active {
    background: #006233;
    border-color: #006233;
    color: white;
}
.collapsible-content {
    display: none;
    background: #0f172a;
    border: 1px solid #1e293b;
    border-top: none;
    padding: 0.6rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 0 0 0.375rem 0.375rem;
    margin-top: -1px;
}
.collapsible-content.show { display: block; }

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
    border-bottom: 1px solid #1e293b;
    color: #cbd5e1;
    font-size: 0.75rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { color: #64748b; }
.detail-value { font-weight: 600; color: #f1f5f9; }

/* ── Mobile compact overrides ─────────────────────── */
@media (max-width: 640px) {
    body { font-size: 14px; }
    label { font-size: 0.875rem; }
    .history-card { padding: 0.65rem 0.75rem; }
    .history-card-title { font-size: 0.85rem; }
    .result-value { font-size: 0.75rem; }
    .result-label { font-size: 0.55rem; }
    .result-item { padding: 0.25rem 0.35rem; }
    .history-card-result { gap: 0.35rem; }
    .delete-btn { padding: 0.25rem 0.5rem; font-size: 0.65rem; }
    .collapsible-toggle { padding: 0.3rem; font-size: 0.65rem; }
    .collapsible-content { padding: 0.5rem; font-size: 0.7rem; }
    .detail-row { padding: 0.2rem 0; font-size: 0.7rem; }
    .history-info-banner { font-size: 0.65rem; padding: 0.5rem 0.65rem; }
}

/* ── RTL (Arabic) overrides ───────────────────────── */
[dir="rtl"] .stepper-btns { right: auto; left: 4px; }
[dir="rtl"] .stepper-wrap input { padding: 0.5rem 0.85rem 0.5rem 2.6rem; }
[dir="rtl"] .tip .tipbox { left: auto; right: 50%; transform: translateX(50%); }
[dir="rtl"] .history-info-banner { border-left: none; border-right: 3px solid #D4AF37; }
[dir="rtl"] .detail-label { text-align: right; }
[dir="rtl"] .detail-value { text-align: left; }
[dir="rtl"] #goToTop { right: auto; left: 2rem; }
