/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* ── Base ──────────────────────────────────────────────────────── */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #111;
    background: #fff;
    min-height: 100vh;
}

/* ── Nav ───────────────────────────────────────────────────────── */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 60px;
    border-bottom: 1px solid #f0f0f0;
    background: #fff;
}

.logo {
    font-size: 1.15em;
    font-weight: 700;
    color: #667eea;
    text-decoration: none;
    letter-spacing: -0.01em;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-links a, .nav-btn {
    text-decoration: none;
    font-size: 0.92em;
    font-weight: 500;
    padding: 8px 18px;
    border-radius: 8px;
    transition: all 0.18s;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.btn-ghost { color: #444; background: transparent; }
.btn-ghost:hover { background: #f4f4f4; color: #111; }

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff !important;
}
.btn-primary:hover {
    opacity: 0.88;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(102,126,234,0.32);
}

/* ── Page wrapper ──────────────────────────────────────────────── */
.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 40px;
}

/* ── Section spacing ───────────────────────────────────────────── */
.section { padding: 80px 0; }
.section-sm { padding: 48px 0; }

/* ── Headings ──────────────────────────────────────────────────── */
h1 { font-size: 2.8em; font-weight: 800; line-height: 1.15; letter-spacing: -0.02em; }
h2 { font-size: 1.6em; font-weight: 700; }
h3 { font-size: 1em; font-weight: 700; }

.gradient-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Badge ─────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    background: #f0f0ff;
    color: #667eea;
    font-size: 0.72em;
    font-weight: 700;
    padding: 4px 13px;
    border-radius: 20px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* ── Buttons (standalone, not nav) ────────────────────────────── */
.btn {
    display: inline-block;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.97em;
    padding: 13px 28px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.18s;
    font-family: inherit;
}

.btn-lg { padding: 15px 34px; font-size: 1.05em; }

.btn-solid {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}
.btn-solid:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102,126,234,0.38);
}
.btn-solid:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-outline {
    color: #667eea;
    border: 2px solid #667eea;
    background: transparent;
}
.btn-outline:hover { background: #f0f0ff; }

.btn-subtle { background: #f2f2f2; color: #444; }
.btn-subtle:hover { background: #e8e8e8; }

/* ── Card ──────────────────────────────────────────────────────── */
.card {
    background: #fff;
    border-radius: 16px;
    border: 1.5px solid #ebebeb;
    padding: 28px;
}

/* ── Form elements ─────────────────────────────────────────────── */
label {
    display: block;
    font-size: 0.88em;
    font-weight: 600;
    color: #444;
    margin-bottom: 7px;
    letter-spacing: 0.01em;
}

input[type="text"], textarea, select {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #e0e0e0;
    border-radius: 9px;
    font-size: 0.97em;
    font-family: inherit;
    color: #111;
    background: #fff;
    transition: border-color 0.18s;
    outline: none;
}

input[type="text"]:focus,
textarea:focus,
select:focus { border-color: #667eea; }

textarea { resize: vertical; min-height: 90px; }

/* ── Upload area ───────────────────────────────────────────────── */
.upload-area {
    border: 2px dashed #c8c8f0;
    border-radius: 12px;
    padding: 36px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafaff;
}

.upload-area:hover, .upload-area.drag-over {
    border-color: #667eea;
    background: #f2f2ff;
}

.upload-icon { font-size: 2.4em; margin-bottom: 10px; }

.upload-area p { color: #666; font-size: 0.92em; line-height: 1.5; }
.upload-area .hint { color: #aaa; font-size: 0.82em; margin-top: 6px; }

#imageInput { display: none; }

#preview {
    width: 100%;
    margin-top: 16px;
    display: none;
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.1);
}

/* ── Spinner ───────────────────────────────────────────────────── */
.spinner {
    border: 3px solid #f0f0f0;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 0.85s linear infinite;
    margin: 0 auto 14px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ── Error ─────────────────────────────────────────────────────── */
.error-box {
    display: none;
    background: #fff5f5;
    color: #c0392b;
    padding: 13px 16px;
    border-radius: 9px;
    border-left: 4px solid #e74c3c;
    font-size: 0.92em;
    margin-top: 16px;
}

/* ── Result image ──────────────────────────────────────────────── */
#resultImage {
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.12);
    margin-bottom: 16px;
    display: block;
}

/* ── Download button ───────────────────────────────────────────── */
.download-btn {
    display: block;
    text-align: center;
    text-decoration: none;
    padding: 13px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95em;
    background: #22c55e;
    color: #fff;
    transition: all 0.18s;
}

.download-btn:hover { background: #16a34a; transform: translateY(-1px); }

/* ── Footer ────────────────────────────────────────────────────── */
footer {
    border-top: 1px solid #f0f0f0;
    padding: 28px 60px;
    text-align: center;
    color: #aaa;
    font-size: 0.85em;
}

footer a {
    color: #aaa;
    text-decoration: none;
}

footer a:hover {
    color: #667eea;
}
