/* ============================================================
   MILTY QR — PREMIUM VIOLET QR GENERATOR STYLES
   ============================================================ */

:root {
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --clr-primary: #7c3aed;
    --clr-primary-light: #8b5cf6;
    --clr-glow: rgba(124, 58, 237, 0.25);
    --clr-slate: #0f172a;
    --clr-muted: #64748b;
    --clr-light-gray: #f1f5f9;
    --clr-border: rgba(0, 0, 0, 0.07);

    --ff-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --ff-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --transition: all 0.3s var(--ease-out);
    --shadow: 0 10px 25px -5px rgba(0,0,0,0.05), 0 8px 10px -6px rgba(0,0,0,0.04);
    --shadow-hover: 0 20px 40px -10px rgba(124, 58, 237, 0.1);
}

html.dark {
    --bg-page: #0d0d12;
    --bg-card: #13131a;
    --clr-slate: #f1f5f9;
    --clr-muted: #94a3b8;
    --clr-light-gray: #1b1b26;
    --clr-border: rgba(255,255,255,0.07);
}

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

html, body {
    min-height: 100%;
    background-color: var(--bg-page);
    color: var(--clr-slate);
    font-family: var(--ff-body);
    overflow-x: hidden;
    line-height: 1.6;
}

/* ── Topbar ──────────────────────────────────────────────────────────────── */
nav.topbar {
    position: fixed; top: 1.5rem; left: 50%; transform: translateX(-50%);
    width: 90%; max-width: 1000px; height: 58px; z-index: 1000;
    background: rgba(255,255,255,0.88); border: 1px solid var(--clr-border);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-radius: 99px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.5rem;
    box-shadow: 0 4px 20px rgba(124,58,237,0.06);
    transition: var(--transition);
}
html.dark nav.topbar { background: rgba(19,19,26,0.88); }

.nav-logo-text {
    font-family: var(--ff-heading) !important; font-weight: 800 !important;
    font-size: 15px !important; letter-spacing: 3px !important;
    color: var(--clr-slate) !important; text-decoration: none !important;
    text-transform: uppercase !important;
}
.nav-logo-text span { color: var(--clr-primary); }

.nav-pill-menu {
    display: flex; align-items: center;
    background: #f1f5f9; padding: 4px 6px; border-radius: 99px;
    gap: 0.25rem; border: 1px solid rgba(0,0,0,0.02);
}
html.dark .nav-pill-menu { background: #1b1b26; border-color: rgba(255,255,255,0.04); }

.nav-pill-link {
    font-size: 0.8rem; font-weight: 600; color: var(--clr-muted);
    text-decoration: none; padding: 0.45rem 1rem; border-radius: 99px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.nav-pill-link:hover { color: var(--clr-slate); }

.nav-pill-link.active {
    background: #ffffff;
    color: var(--clr-slate);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
html.dark .nav-pill-link.active {
    background: #252533;
    color: #f1f5f9;
}

.nav-pill-link svg {
    width: 13px;
    height: 13px;
}

.nav-right { display: flex; align-items: center; }
.theme-toggle-btn {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 50%;
    border: 1px solid var(--clr-border); background: transparent;
    color: var(--clr-muted); cursor: pointer; transition: var(--transition);
}
.theme-toggle-btn:hover { color: var(--clr-primary); }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.portal-container {
    position: relative; z-index: 1;
    width: 96%; max-width: 1100px;
    margin: 0 auto; padding: 120px 1.5rem 60px;
}

.page-header {
    text-align: center; max-width: 680px; margin: 1rem auto 2.5rem;
    animation: fadeInUp 0.8s var(--ease-out);
}

.hero-title {
    font-family: var(--ff-heading);
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 800; line-height: 1.2; letter-spacing: -1.5px;
    color: var(--clr-slate); margin-bottom: 0.85rem;
}
.hero-title span { color: var(--clr-primary); }

.hero-desc { font-size: 0.97rem; color: var(--clr-muted); line-height: 1.6; }

/* ── Tab Switcher ────────────────────────────────────────────────────────── */
.tab-switcher {
    display: flex; gap: 0.5rem; justify-content: center;
    background: var(--bg-card); border: 1px solid var(--clr-border);
    border-radius: 16px; padding: 0.5rem;
    margin-bottom: 2rem; width: fit-content; margin-inline: auto;
    box-shadow: var(--shadow);
    animation: fadeInUp 0.9s var(--ease-out);
}

.tab-btn {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.65rem 1.4rem; border-radius: 10px;
    border: none; background: transparent;
    font-size: 0.875rem; font-weight: 600;
    color: var(--clr-muted); cursor: pointer;
    transition: var(--transition);
}
.tab-btn svg { flex-shrink: 0; }
.tab-btn.active {
    background: var(--clr-primary);
    color: white;
    box-shadow: 0 4px 14px rgba(124,58,237,0.35);
}
.tab-btn:hover:not(.active) { color: var(--clr-primary); background: rgba(124,58,237,0.06); }

/* ── Tab Panels ──────────────────────────────────────────────────────────── */
.tab-panel { display: none; animation: fadeInUp 0.4s var(--ease-out); }
.tab-panel.active { display: block; }

/* ── Tool Grid ───────────────────────────────────────────────────────────── */
.tool-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.75rem;
    align-items: start;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.controls-card, .preview-card {
    background: var(--bg-card);
    border: 1px solid var(--clr-border);
    border-radius: 24px; padding: 1.75rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}
.controls-card:hover, .preview-card:hover { box-shadow: var(--shadow-hover); }

.panel-title {
    font-family: var(--ff-heading);
    font-size: 1.05rem; font-weight: 700;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1.5px solid var(--clr-light-gray);
    color: var(--clr-slate);
}
html.dark .panel-title { border-bottom-color: #232336; }

/* ── Form Controls ───────────────────────────────────────────────────────── */
.control-group { display: flex; flex-direction: column; gap: 0.45rem; margin-bottom: 1.1rem; }
.control-group:last-child { margin-bottom: 0; }
.control-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.1rem; }
.control-group.half { margin-bottom: 0; }

.ctrl-label {
    font-size: 0.8rem; font-weight: 600; letter-spacing: 0.3px;
    color: var(--clr-muted); text-transform: uppercase;
}

.ctrl-input, .ctrl-textarea, .ctrl-select {
    width: 100%; padding: 0.7rem 1rem;
    border-radius: 12px; border: 1.5px solid var(--clr-light-gray);
    background: transparent; color: var(--clr-slate);
    font-family: var(--ff-body); font-size: 0.9rem;
    outline: none; transition: var(--transition); resize: vertical;
}
html.dark .ctrl-input, html.dark .ctrl-textarea, html.dark .ctrl-select { border-color: #232336; background: #0d0d12; }
.ctrl-input:focus, .ctrl-textarea:focus, .ctrl-select:focus {
    border-color: var(--clr-primary);
    box-shadow: 0 0 0 3px var(--clr-glow);
}

.char-count { font-size: 0.75rem; color: var(--clr-muted); text-align: right; }

/* Slider */
.slider-row { display: flex; align-items: center; gap: 0.75rem; }
.ctrl-slider {
    flex: 1; -webkit-appearance: none; appearance: none;
    height: 5px; border-radius: 99px;
    background: var(--clr-light-gray); outline: none; cursor: pointer;
    transition: var(--transition);
}
html.dark .ctrl-slider { background: #232336; }
.ctrl-slider::-webkit-slider-thumb {
    -webkit-appearance: none; width: 18px; height: 18px;
    border-radius: 50%; background: var(--clr-primary);
    box-shadow: 0 0 0 3px var(--clr-glow); cursor: pointer;
    transition: var(--transition);
}
.ctrl-slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
.slider-val { font-size: 0.8rem; font-weight: 700; color: var(--clr-primary); min-width: 32px; text-align: right; }

/* Color input */
.color-input-wrap { display: flex; align-items: center; gap: 0.5rem; }
.ctrl-color {
    width: 40px; height: 40px; border-radius: 10px;
    border: 1.5px solid var(--clr-light-gray); cursor: pointer;
    padding: 2px; background: transparent;
    transition: var(--transition);
}
html.dark .ctrl-color { border-color: #232336; }
.ctrl-color:hover { border-color: var(--clr-primary); }
.ctrl-hex {
    flex: 1; padding: 0.5rem 0.75rem; border-radius: 10px;
    border: 1.5px solid var(--clr-light-gray); background: transparent;
    color: var(--clr-slate); font-family: 'Courier New', monospace;
    font-size: 0.85rem; font-weight: 600; outline: none; transition: var(--transition);
    text-transform: uppercase;
}
html.dark .ctrl-hex { border-color: #232336; background: #0d0d12; }
.ctrl-hex:focus { border-color: var(--clr-primary); box-shadow: 0 0 0 3px var(--clr-glow); }

/* Toggle switch */
.toggle-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; }
.toggle-switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-track {
    position: absolute; inset: 0; cursor: pointer;
    background: var(--clr-light-gray); border-radius: 99px; transition: var(--transition);
}
html.dark .toggle-track { background: #232336; }
.toggle-track::before {
    content: ''; position: absolute; height: 18px; width: 18px;
    left: 3px; bottom: 3px; background: white; border-radius: 50%;
    transition: var(--transition); box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
input:checked + .toggle-track { background: var(--clr-primary); }
input:checked + .toggle-track::before { transform: translateX(18px); }

/* Type hint */
.type-hint {
    display: flex; align-items: flex-start; gap: 0.5rem;
    background: rgba(124,58,237,0.06); border: 1px solid rgba(124,58,237,0.15);
    border-radius: 10px; padding: 0.65rem 0.85rem;
    font-size: 0.78rem; color: var(--clr-primary); margin-bottom: 1rem;
}
html.dark .type-hint { background: rgba(124,58,237,0.1); }

/* Buttons */
.btn-row { display: flex; gap: 0.65rem; flex-wrap: wrap; }
.btn-dl {
    display: inline-flex; align-items: center; gap: 0.45rem;
    padding: 0.65rem 1.25rem; border-radius: 10px;
    font-size: 0.85rem; font-weight: 600; cursor: pointer;
    border: 1.5px solid transparent; transition: var(--transition);
    text-decoration: none; white-space: nowrap;
}
.btn-dl:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
    background: var(--clr-primary); color: white;
    box-shadow: 0 4px 12px rgba(124,58,237,0.25);
}
.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(124,58,237,0.4);
}
.btn-outline {
    background: transparent; color: var(--clr-primary);
    border-color: rgba(124,58,237,0.35);
}
.btn-outline:hover:not(:disabled) {
    background: rgba(124,58,237,0.08);
    border-color: var(--clr-primary);
}
.btn-ghost {
    background: transparent; color: var(--clr-muted);
    border-color: var(--clr-border);
}
.btn-ghost:hover:not(:disabled) { color: var(--clr-slate); border-color: var(--clr-muted); }

/* ── Preview Card ────────────────────────────────────────────────────────── */
.preview-wrapper {
    width: 100%; min-height: 280px; border-radius: 16px;
    background: var(--clr-light-gray);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; position: relative;
    aspect-ratio: 1 / 1; transition: var(--transition);
}
html.dark .preview-wrapper { background: #1a1a26; }

.bc-preview-wrapper { aspect-ratio: auto; min-height: 160px; padding: 1.5rem; }

.preview-placeholder {
    display: flex; flex-direction: column; align-items: center; gap: 0.75rem;
    color: var(--clr-muted); text-align: center; padding: 1.5rem;
}
.preview-placeholder p { font-size: 0.85rem; max-width: 200px; line-height: 1.5; }

.preview-img {
    width: 100%; height: 100%; object-fit: contain;
    image-rendering: pixelated; transition: opacity 0.3s ease;
}
.bc-img { width: auto; max-width: 100%; height: auto; image-rendering: pixelated; }

.preview-loader, .preview-error {
    display: flex; flex-direction: column; align-items: center; gap: 0.75rem;
    color: var(--clr-muted); font-size: 0.85rem;
}
.preview-error { color: var(--clr-primary); }

.loader-ring {
    width: 32px; height: 32px;
    border: 3px solid rgba(124,58,237,0.2);
    border-top-color: var(--clr-primary);
    border-radius: 50%; animation: spin 0.8s linear infinite;
}

/* ── Reader Grid ─────────────────────────────────────────────────────────── */
.reader-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.75rem; align-items: start; }
.reader-card { }

.drop-zone {
    border: 2px dashed rgba(124,58,237,0.3); border-radius: 16px;
    min-height: 240px; background: rgba(124,58,237,0.03);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; position: relative; cursor: pointer;
    transition: var(--transition);
}
.drop-zone:hover, .drop-zone.drag-over {
    border-color: var(--clr-primary);
    background: rgba(124,58,237,0.06);
}
html.dark .drop-zone { background: rgba(124,58,237,0.05); }

.drop-zone-inner {
    display: flex; flex-direction: column; align-items: center;
    gap: 0.5rem; text-align: center; padding: 2rem; position: relative;
}
.drop-icon { color: var(--clr-primary); opacity: 0.6; }
.drop-text { font-weight: 600; font-size: 0.95rem; color: var(--clr-slate); }
.drop-subtext { font-size: 0.78rem; color: var(--clr-muted); }

/* Animated scan line */
.scan-line {
    position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent, var(--clr-primary), transparent);
    animation: scanDown 2s ease-in-out infinite;
    opacity: 0.7;
}
@keyframes scanDown {
    0% { transform: translateY(0); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(240px); opacity: 0; }
}

.read-preview-img {
    width: 100%; height: 100%; object-fit: contain;
    position: absolute; inset: 0; background: var(--clr-light-gray);
}
html.dark .read-preview-img { background: #1a1a26; }

/* Result area */
.result-area {
    min-height: 240px; border-radius: 16px;
    background: var(--clr-light-gray);
    display: flex; align-items: center; justify-content: center;
    padding: 1.5rem; flex-direction: column;
}
html.dark .result-area { background: #1a1a26; }

.result-placeholder {
    display: flex; flex-direction: column; align-items: center;
    gap: 0.75rem; color: var(--clr-muted); text-align: center;
    font-size: 0.85rem; max-width: 240px; line-height: 1.5;
}

.result-success { width: 100%; display: flex; flex-direction: column; gap: 1rem; }

.result-badge {
    display: inline-flex; align-items: center; gap: 0.4rem;
    background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.25);
    color: #22c55e; padding: 0.3rem 0.8rem; border-radius: 99px;
    font-size: 0.75rem; font-weight: 700; width: fit-content;
}

.result-label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; color: var(--clr-muted); margin-bottom: 0.4rem; }

.result-value-box {
    background: var(--bg-card); border: 1.5px solid var(--clr-border);
    border-radius: 12px; padding: 0.85rem 1rem; overflow: auto; max-height: 180px;
}
.result-value {
    font-family: 'Courier New', monospace; font-size: 0.88rem;
    color: var(--clr-slate); white-space: pre-wrap; word-break: break-all; line-height: 1.6;
}

.result-actions { display: flex; gap: 0.65rem; flex-wrap: wrap; }

.result-error {
    display: flex; flex-direction: column; align-items: center;
    gap: 0.65rem; color: var(--clr-primary); text-align: center;
    font-size: 0.88rem; font-weight: 500;
}

.result-loading {
    display: flex; flex-direction: column; align-items: center;
    gap: 0.75rem; color: var(--clr-muted); font-size: 0.88rem;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.footer-area { text-align: center; margin-top: 4rem; padding-top: 1.5rem; border-top: 1px solid var(--clr-light-gray); }
html.dark .footer-area { border-top-color: #232336; }
.disclaimer-text { font-size: 0.75rem; color: var(--clr-muted); max-width: 700px; margin: 0 auto; }

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
    background: var(--clr-slate); color: var(--bg-page);
    padding: 0.75rem 1.75rem; border-radius: 99px;
    font-size: 0.85rem; font-weight: 600; z-index: 10000;
    opacity: 0; pointer-events: none; transition: var(--transition);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15); white-space: nowrap;
}
.toast.show { opacity: 1; }

/* ── Utilities ───────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
    .tool-grid, .reader-grid { grid-template-columns: 1fr; }
    .preview-wrapper { aspect-ratio: auto; min-height: 240px; }
    .tab-switcher { flex-direction: column; width: 100%; }
    .tab-btn { justify-content: center; }
}

@media (max-width: 820px) {
    .nav-pill-menu {
        display: none !important;
    }
    .mobile-menu-btn {
        display: flex !important;
    }
}

@media (max-width: 560px) {
    .control-row { grid-template-columns: 1fr; }
}

/* Bouton Hamburger */
.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--clr-border, rgba(0, 0, 0, 0.06));
    background: transparent;
    color: var(--clr-slate, #0f172a);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-menu-btn svg {
    width: 18px;
    height: 18px;
}

/* Tiroir / Dropdown Mobile */
.mobile-nav-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 20px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
    padding: 1.25rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-nav-dropdown.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

html.dark .mobile-nav-dropdown {
    background: rgba(26, 26, 36, 0.95);
    border-color: rgba(255, 255, 255, 0.08);
}

.mobile-dropdown-header {
    border-bottom: 1px solid var(--clr-light-gray, rgba(0,0,0,0.06));
    padding-bottom: 0.5rem;
}

.mobile-menu-title {
    font-family: var(--ff-heading, 'Outfit');
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--clr-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.mobile-dropdown-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mobile-dropdown-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--clr-muted, #64748b);
    transition: all 0.2s;
}

.mobile-dropdown-link svg {
    width: 16px;
    height: 16px;
    color: var(--clr-muted, #64748b);
}

.mobile-dropdown-link:hover,
.mobile-dropdown-link.active {
    background: #f1f5f9;
    color: var(--clr-slate, #0f172a);
}

html.dark .mobile-dropdown-link:hover,
html.dark .mobile-dropdown-link.active {
    background: #252533;
    color: #f1f5f9;
}

.mobile-dropdown-link.active svg {
    color: var(--clr-primary, #7c3aed);
}
