:root {
    --bg-color: #050510;
    --accent-color: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.45);
    --accent-hover: #4f46e5;
    --emerald: #10b981;
    --emerald-glow: rgba(16, 185, 129, 0.4);
    --rose: #f43f5e;
    --amber: #f59e0b;
    --glass-bg: rgba(255, 255, 255, 0.035);
    --glass-card: rgba(255, 255, 255, 0.045);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-focus: rgba(99, 102, 241, 0.6);
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-main);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
    position: relative;
}

/* Background Blobs */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    filter: blur(85px);
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    opacity: 0.45;
    animation: move 20s infinite alternate ease-in-out;
}

.blob-1 {
    width: 450px;
    height: 450px;
    background: #4f46e5;
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: #7c3aed;
    bottom: -150px;
    right: -120px;
    animation-delay: -5s;
}

.blob-3 {
    width: 350px;
    height: 350px;
    background: #db2777;
    top: 45%;
    left: 50%;
    animation-delay: -10s;
}

@keyframes move {
    from { transform: translate(0, 0); }
    to { transform: translate(70px, 80px); }
}

/* App Layout */
.app-layout {
    max-width: 1240px;
    margin: 0 auto;
    padding: 1.5rem 2rem 3rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    min-height: 100vh;
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding-bottom: 0.5rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.5rem 0.9rem;
    border-radius: 12px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
}

.back-link svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.back-link:hover {
    color: var(--text-primary);
    border-color: var(--accent-color);
    background: rgba(99, 102, 241, 0.12);
}

.back-link:hover svg {
    transform: translateX(-3px);
}

.brand-title {
    text-align: center;
}

.logo {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo span {
    color: var(--accent-color);
    text-shadow: 0 0 20px var(--accent-glow);
}

.logo-sub {
    display: block;
    font-size: 0.82rem;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    margin-top: -2px;
}

.header-spacer {
    width: 135px;
}

@media (max-width: 600px) {
    .header-spacer {
        display: none;
    }
}

/* Glass Panels */
.glass-panel {
    background: var(--glass-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.35);
}

/* Main Content Grid */
.main-content {
    display: grid;
    grid-template-columns: 1fr 440px;
    gap: 2rem;
    align-items: start;
}

/* Left Config Panel */
.config-panel {
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Type Selector Tabs */
.type-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 4px;
    gap: 4px;
    flex-wrap: wrap;
}

.type-btn {
    flex: 1;
    min-width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.6rem 0.75rem;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.type-btn svg {
    width: 15px;
    height: 15px;
}

.type-btn:hover {
    color: var(--text-primary);
}

.type-btn.active {
    background: var(--accent-color);
    color: #ffffff;
    box-shadow: 0 2px 10px var(--accent-glow);
}

/* Form Container */
.form-container {
    min-height: 140px;
}

.type-form {
    display: none;
    flex-direction: column;
    gap: 0.85rem;
}

.type-form.active {
    display: flex;
}

.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-secondary);
}

.styled-input, .styled-textarea, .styled-select {
    width: 100%;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.92rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.styled-textarea {
    height: 110px;
    resize: vertical;
}

.styled-input:focus, .styled-textarea:focus, .styled-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 12px var(--accent-glow);
}

.field-row {
    display: flex;
    gap: 1rem;
}

.field-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-col {
    justify-content: flex-end;
    padding-bottom: 0.75rem;
}

.checkbox-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.checkbox-option input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 1.5px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.checkbox-option input[type="checkbox"]:checked + .checkbox-custom {
    background: var(--accent-color);
    border-color: var(--accent-color);
}

.checkbox-option input[type="checkbox"]:checked + .checkbox-custom::after {
    content: "✓";
    font-size: 11px;
    color: #ffffff;
    font-weight: 700;
}

.checkbox-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Customization Box */
.customization-box {
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.box-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
}

.custom-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.custom-item {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.color-picker-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 0.35rem 0.65rem;
}

.color-picker-wrap input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    background: none;
}

.color-picker-wrap input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker-wrap input[type="color"]::-webkit-color-swatch {
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
}

.hex-text {
    font-family: var(--font-code, monospace);
    font-size: 0.82rem;
    color: var(--text-secondary);
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
    margin-top: 0.4rem;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px var(--accent-glow);
}

/* Right Preview & Export Panel */
.preview-panel {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.75rem;
}

.preview-box {
    width: 280px;
    height: 280px;
    background: #ffffff;
    border-radius: 20px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}

.qr-canvas-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-canvas-wrap canvas,
.qr-canvas-wrap img {
    max-width: 100%;
    max-height: 100%;
    display: block;
}

.export-actions {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 280px;
    gap: 0.65rem;
}

.export-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

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

.export-btn.primary {
    background: var(--accent-color);
    color: #ffffff;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.export-btn.primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

.export-btn.secondary {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.export-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

.export-btn.ghost {
    background: transparent;
    color: var(--text-secondary);
}

.export-btn.ghost:hover {
    color: #ffffff;
}

/* AdSense Section */
.adsense-container {
    margin-top: 1rem;
    width: 100%;
    display: flex;
    justify-content: center;
}

.ad-placeholder {
    width: 100%;
    min-height: 90px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.ad-label {
    position: absolute;
    top: 6px;
    left: 14px;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    opacity: 0.55;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--glass-border-focus);
    color: #ffffff;
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    .custom-grid {
        grid-template-columns: 1fr;
    }
    .field-row {
        flex-direction: column;
    }
    .app-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}
