/* =============================================================================
   AI Image Resizer — style.css
   Modern SaaS dashboard · dark gradient · glassmorphism · mobile-first
   ========================================================================== */

:root {
    --bg-1: #0b1220;
    --bg-2: #131c34;
    --bg-3: #1b2547;
    --card: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.10);
    --text: #e8edf7;
    --muted: #94a3c4;
    --accent: #4f8cff;
    --accent-2: #7c5cff;
    --accent-grad: linear-gradient(135deg, #4f8cff, #7c5cff);
    --success: #2ecc8f;
    --error: #ff5f70;
    --warn: #ffb74d;
    --radius: 16px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    font-size: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(79, 140, 255, 0.18), transparent 60%),
        radial-gradient(1000px 500px at 110% 10%, rgba(124, 92, 255, 0.18), transparent 55%),
        linear-gradient(160deg, var(--bg-1), var(--bg-2) 55%, var(--bg-3));
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Typography helpers ---------- */
h1 { font-size: 1.25rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.accent { color: var(--accent); }
.center { text-align: center; }
.hide-mobile { display: none; }

/* ---------- Logo ---------- */
.logo-badge {
    width: 54px; height: 54px;
    display: grid; place-items: center;
    border-radius: 14px;
    font-weight: 800; letter-spacing: 0.5px;
    background: var(--accent-grad);
    color: #fff;
    box-shadow: var(--shadow);
    margin: 0 auto 14px;
    font-size: 1.2rem;
}
.logo-badge.sm { width: 40px; height: 40px; margin: 0; font-size: 0.95rem; border-radius: 11px; }

/* ---------- Cards ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 18px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: var(--shadow);
}
.card-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px; gap: 12px;
}

/* ---------- Header ---------- */
.app-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--card-border);
    background: rgba(11, 18, 32, 0.6);
    backdrop-filter: blur(10px);
    position: sticky; top: 0; z-index: 20;
    gap: 12px;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.header-right { display: flex; align-items: center; gap: 12px; }
.badge {
    display: inline-block;
    font-size: 0.7rem; font-weight: 600;
    padding: 2px 8px; border-radius: 999px;
    background: rgba(79, 140, 255, 0.18);
    color: var(--accent); border: 1px solid rgba(79, 140, 255, 0.35);
}

/* ---------- Layout ---------- */
.container { max-width: 920px; margin: 0 auto; padding: 22px 16px 60px; }

/* ---------- Stats ---------- */
.stats-strip {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 12px; margin-bottom: 18px;
}
.stat {
    background: var(--card); border: 1px solid var(--card-border);
    border-radius: 14px; padding: 14px; text-align: center;
}
.stat-num { display: block; font-size: 1.2rem; font-weight: 800; }
.stat-label { font-size: 0.75rem; color: var(--muted); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 0.85rem; color: var(--muted); }
input[type="text"], input[type="password"], input[type="number"], select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-size: 0.95rem;
    transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.25);
}
select option { background: var(--bg-2); color: var(--text); }

input[type="range"] {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 6px; border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--accent-grad); cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
input[type="range"]::-moz-range-thumb {
    width: 20px; height: 20px; border: none; border-radius: 50%;
    background: var(--accent); cursor: pointer;
}

.checkbox { display: flex; align-items: center; gap: 10px; cursor: pointer; margin: 6px 0; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--accent); }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 0 16px; }

/* ---------- Format pills ---------- */
.format-options { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.radio-pill { position: relative; cursor: pointer; }
.radio-pill input { position: absolute; opacity: 0; }
.radio-pill span {
    display: inline-block; padding: 9px 16px; border-radius: 999px;
    border: 1px solid var(--card-border); background: rgba(255, 255, 255, 0.04);
    font-size: 0.88rem; transition: all .2s;
}
.radio-pill input:checked + span {
    background: var(--accent-grad); border-color: transparent; color: #fff; font-weight: 600;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 18px; border-radius: 12px; border: 1px solid transparent;
    font-size: 0.92rem; font-weight: 600; cursor: pointer;
    text-decoration: none; color: var(--text);
    transition: transform .12s, box-shadow .2s, background .2s, opacity .2s;
    background: rgba(255, 255, 255, 0.06);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent-grad); color: #fff; box-shadow: 0 8px 22px rgba(79, 140, 255, 0.35); }
.btn-primary:hover { box-shadow: 0 10px 28px rgba(79, 140, 255, 0.5); }
.btn-ghost { background: rgba(255, 255, 255, 0.05); border-color: var(--card-border); }
.btn-block { width: 100%; }
.btn-lg { padding: 14px 22px; font-size: 1rem; }

.submit-bar {
    display: flex; gap: 12px; justify-content: flex-end;
    position: sticky; bottom: 0; padding: 14px 0;
}

/* ---------- Dropzone ---------- */
.dropzone {
    border: 2px dashed var(--card-border);
    border-radius: var(--radius);
    padding: 40px 20px; text-align: center; cursor: pointer;
    transition: border-color .2s, background .2s;
    background: rgba(255, 255, 255, 0.02);
}
.dropzone:hover, .dropzone.dragover {
    border-color: var(--accent);
    background: rgba(79, 140, 255, 0.08);
}
.dz-icon { font-size: 2.2rem; margin-bottom: 8px; }
.dz-title { font-weight: 600; margin-bottom: 4px; }

/* ---------- Preview grid ---------- */
.preview-grid {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 12px; margin-top: 16px;
}
.preview-grid:empty { margin-top: 0; }
.preview-item {
    position: relative; border-radius: 12px; overflow: hidden;
    border: 1px solid var(--card-border); background: rgba(0, 0, 0, 0.25);
}
.preview-item img { width: 100%; height: 120px; object-fit: cover; display: block; }
.preview-item .pv-name {
    font-size: 0.72rem; padding: 6px 8px; color: var(--muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- Tips ---------- */
.tips { margin-top: 12px; display: grid; gap: 4px; font-size: 0.84rem; color: var(--muted); }

/* ---------- Alerts ---------- */
.alert { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 0.9rem; border: 1px solid transparent; }
.alert-error { background: rgba(255, 95, 112, 0.12); border-color: rgba(255, 95, 112, 0.4); color: #ffd0d5; }
.alert-warn  { background: rgba(255, 183, 77, 0.12); border-color: rgba(255, 183, 77, 0.4); color: #ffe3b8; }
.alert-success { background: rgba(46, 204, 143, 0.12); border-color: rgba(46, 204, 143, 0.4); color: #c7f4e2; }

/* ---------- Result card ---------- */
.result-card { border-color: rgba(79, 140, 255, 0.35); }
.result-item {
    display: grid; grid-template-columns: 1fr; gap: 16px;
    padding: 16px 0; border-top: 1px solid var(--card-border);
}
.result-item:first-of-type { border-top: none; }
.result-preview img {
    width: 100%; max-height: 240px; object-fit: contain;
    border-radius: 12px; background: rgba(0, 0, 0, 0.3);
}
.result-info h3 { margin-bottom: 10px; word-break: break-word; }
.compare-grid {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 10px; margin-bottom: 14px;
}
.compare-grid > div {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    border-radius: 10px; padding: 8px 10px;
}
.compare-grid .lbl { display: block; font-size: 0.72rem; color: var(--muted); }
.compare-grid b { font-size: 0.95rem; }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.result-actions.center { justify-content: center; margin-top: 12px; }

/* ---------- Auth ---------- */
.auth-body { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.auth-wrapper { width: 100%; max-width: 400px; }
.auth-card { padding: 32px 26px; }
.auth-logo { text-align: center; margin-bottom: 22px; }
.auth-logo h1 { font-size: 1.4rem; }
.auth-form { margin-top: 8px; }
.auth-footer { text-align: center; margin-top: 18px; font-size: 0.8rem; }

/* ---------- Footer ---------- */
.app-footer { text-align: center; padding: 24px; color: var(--muted); font-size: 0.85rem; }

/* ---------- Loading overlay ---------- */
.loading-overlay {
    position: fixed; inset: 0; z-index: 100;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
    background: rgba(8, 12, 22, 0.78); backdrop-filter: blur(6px);
    color: var(--text);
}
.loading-overlay[hidden] { display: none; }
.spinner {
    width: 52px; height: 52px; border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--accent);
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 404 card ---------- */
.error-card { text-align: center; padding: 36px 26px; }
.error-card h1 { margin: 6px 0 8px; font-size: 1.5rem; }
.error-card .btn { margin-top: 18px; }
.error-card .logo-badge { width: 70px; height: 70px; font-size: 1.1rem; }

/* ---------- Responsive ---------- */
@media (max-width: 380px) {
    :root { font-size: 15px; }
    .container { padding: 16px 12px 48px; }
    .card { padding: 16px; }
    .format-options { gap: 8px; }
    .radio-pill span { padding: 8px 12px; font-size: 0.82rem; }
    .submit-bar .btn { flex: 1; }
}

@media (max-width: 639px) {
    .app-header { padding: 12px 14px; }
    .app-header h1 { font-size: 1.05rem; line-height: 1.2; }
    .logo-badge.sm { width: 36px; height: 36px; }
    .btn { padding: 10px 14px; }
    .submit-bar { gap: 10px; }
    .result-actions .btn { flex: 1; min-width: 140px; }
}

@media (min-width: 640px) {
    .hide-mobile { display: inline; }
    .stats-strip { grid-template-columns: repeat(4, 1fr); }
    .grid-2 { grid-template-columns: 1fr 1fr; }
    .grid-3 { grid-template-columns: 1fr 1fr 1fr; }
    .preview-grid { grid-template-columns: repeat(3, 1fr); }
    .compare-grid { grid-template-columns: repeat(4, 1fr); }
    h1 { font-size: 1.4rem; }
}
@media (min-width: 860px) {
    .result-item { grid-template-columns: 280px 1fr; }
    .preview-grid { grid-template-columns: repeat(4, 1fr); }
}
