/* ============================================
   QR FORGE — Premium Dark Theme
   ============================================ */

:root {
    --bg-dark: #0a0a0f;
    --bg-card: rgba(18, 18, 28, 0.75);
    --bg-card-solid: #12121c;
    --bg-input: rgba(30, 30, 48, 0.8);
    --border: rgba(255, 255, 255, 0.06);
    --border-focus: rgba(108, 99, 255, 0.5);
    --text: #e8e8f0;
    --text-secondary: #8888a0;
    --text-muted: #555568;
    --accent: #6C63FF;
    --accent-2: #a78bfa;
    --accent-gradient: linear-gradient(135deg, #6C63FF 0%, #a78bfa 50%, #c084fc 100%);
    --success: #22c55e;
    --error: #ef4444;
    --radius: 14px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ---- Animated BG Orbs ---- */
.bg-orbs {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    animation: orb-float 20s ease-in-out infinite;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: #6C63FF;
    top: -200px;
    left: -100px;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: #a78bfa;
    bottom: -150px;
    right: -100px;
    animation-delay: -7s;
    animation-duration: 25s;
}

.orb-3 {
    width: 350px;
    height: 350px;
    background: #c084fc;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
    animation-duration: 30s;
}

@keyframes orb-float {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(50px, -40px) scale(1.08);
    }

    66% {
        transform: translate(-30px, 30px) scale(0.95);
    }
}

/* ---- Container ---- */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

/* ---- Header ---- */
.header {
    padding: 32px 0 8px;
    text-align: center;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 6px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    color: var(--accent);
    filter: drop-shadow(0 0 12px rgba(108, 99, 255, 0.4));
}

.logo h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
}

.logo .accent {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 400;
}

/* ---- Main Grid ---- */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 460px;
    gap: 28px;
    padding-top: 24px;
    padding-bottom: 60px;
    align-items: start;
}

/* ---- Glass Panel ---- */
.panel {
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
}

/* ---- Section ---- */
.section {
    margin-bottom: 28px;
}

.section-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

/* ---- Type Tabs ---- */
.type-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.type-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.type-tab svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.type-tab:hover {
    background: var(--bg-input);
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.12);
}

.type-tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(108, 99, 255, 0.35);
}

/* ---- Form ---- */
.data-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.form-row>.form-group {
    flex: 1;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.label-hint {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.72rem;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="datetime-local"],
textarea,
select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.88rem;
    transition: var(--transition);
    outline: none;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
}

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

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238888a0' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

::placeholder {
    color: var(--text-muted);
}

/* ---- Color Input ---- */
.color-row {
    flex-wrap: wrap;
    align-items: flex-end;
}

.color-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 4px 10px 4px 4px;
}

input[type="color"] {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-xs);
    cursor: pointer;
    background: none;
    padding: 0;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.color-hex {
    font-size: 0.78rem;
    font-family: 'Inter', monospace;
    color: var(--text-secondary);
}

/* ---- Logo Upload ---- */
.logo-upload-area {
    border: 2px dashed rgba(108, 99, 255, 0.25);
    border-radius: var(--radius-sm);
    background: rgba(108, 99, 255, 0.03);
    cursor: pointer;
    transition: var(--transition);
    overflow: hidden;
}

.logo-upload-area:hover {
    border-color: rgba(108, 99, 255, 0.5);
    background: rgba(108, 99, 255, 0.06);
}

.logo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px;
    color: var(--text-muted);
}

.logo-placeholder svg {
    width: 36px;
    height: 36px;
    opacity: 0.5;
}

.logo-placeholder span {
    font-size: 0.8rem;
}

.logo-preview-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    position: relative;
}

.logo-preview-wrap img {
    max-width: 80px;
    max-height: 80px;
    border-radius: var(--radius-xs);
    object-fit: contain;
}

.remove-logo-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: var(--error);
    color: #fff;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.remove-logo-btn:hover {
    transform: scale(1.15);
}

/* ---- Generate Button ---- */
.generate-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 20px rgba(108, 99, 255, 0.35);
    position: relative;
    overflow: hidden;
}

.generate-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, transparent 50%);
    opacity: 0;
    transition: var(--transition);
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(108, 99, 255, 0.5);
}

.generate-btn:hover::before {
    opacity: 1;
}

.generate-btn:active {
    transform: translateY(0);
}

.generate-btn svg {
    width: 20px;
    height: 20px;
}

.generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ---- Preview Panel ---- */
.preview-panel {
    position: sticky;
    top: 24px;
}

.preview-area {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 340px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.02);
    margin-bottom: 20px;
    overflow: hidden;
}

.preview-empty,
.preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    color: var(--text-muted);
    padding: 40px;
}

.preview-empty svg {
    width: 64px;
    height: 64px;
}

.preview-empty p,
.preview-loading p {
    font-size: 0.88rem;
}

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Preview Result */
.preview-result {
    padding: 24px;
    width: 100%;
    text-align: center;
}

.preview-result img {
    max-width: 100%;
    max-height: 360px;
    border-radius: var(--radius-xs);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    animation: fadeScaleIn 0.4s ease-out;
}

@keyframes fadeScaleIn {
    from {
        opacity: 0;
        transform: scale(0.92);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ---- Download Buttons ---- */
.download-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: transparent;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.download-btn svg {
    width: 16px;
    height: 16px;
}

.download-btn.primary {
    flex: 1 1 100%;
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.download-btn.secondary {
    flex: 1 1 0;
    min-width: 0;
}

.download-btn.primary:hover {
    box-shadow: 0 4px 16px rgba(108, 99, 255, 0.4);
}

.download-btn.secondary:hover {
    background: var(--bg-input);
    border-color: rgba(255, 255, 255, 0.12);
}

/* ---- Info Box ---- */
.info-box {
    display: flex;
    gap: 14px;
    padding: 16px;
    background: rgba(108, 99, 255, 0.06);
    border: 1px solid rgba(108, 99, 255, 0.15);
    border-radius: var(--radius-sm);
}

.info-box svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    color: var(--accent);
    margin-top: 2px;
}

.info-box strong {
    font-size: 0.82rem;
    color: var(--text);
    display: block;
    margin-bottom: 2px;
}

.info-box p {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ---- Toast ---- */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card-solid);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--error);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.toast.success {
    border-color: rgba(34, 197, 94, 0.3);
    color: var(--success);
}

/* ---- Footer ---- */
.footer {
    text-align: center;
    padding: 24px 0 32px;
    color: var(--text-muted);
    font-size: 0.78rem;
    position: relative;
    z-index: 1;
}

/* ---- Responsive ---- */
@media (max-width: 960px) {
    .main-grid {
        grid-template-columns: 1fr;
    }

    .preview-panel {
        position: static;
    }
}

@media (max-width: 600px) {
    .header {
        padding: 20px 0 4px;
    }

    .logo h1 {
        font-size: 1.6rem;
    }

    .panel {
        padding: 20px;
    }

    .type-tabs {
        gap: 6px;
    }

    .type-tab {
        padding: 7px 10px;
        font-size: 0.72rem;
    }

    .form-row {
        flex-direction: column;
    }
}

/* ---- History Section ---- */
.history-section {
    padding-bottom: 40px;
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.clear-history-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-xs);
    color: var(--error);
    font-family: var(--font);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.clear-history-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}

.history-card {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    transition: var(--transition);
    position: relative;
}

.history-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.history-card-thumb {
    width: 100%;
    aspect-ratio: 1;
    background: #fff;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    overflow: hidden;
}

.history-card-thumb img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.history-card-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.history-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.68rem;
    color: var(--text-muted);
}

.history-card-type {
    padding: 2px 8px;
    background: rgba(108, 99, 255, 0.12);
    color: var(--accent);
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
}

.history-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

.history-card-actions a,
.history-card-actions button {
    flex: 1;
    padding: 6px 0;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: var(--transition);
}

.history-card-actions a:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.history-card-actions button:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border-color: rgba(239, 68, 68, 0.3);
}