:root {
    --primary: #4f46e5;
    --primary-glow: rgba(79, 70, 229, 0.4);
    --secondary: #ec4899;
    --bg-dark: #0f172a;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

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

.blob {
    position: absolute;
    border-radius: 50%;
    opacity: 0.6;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    left: -100px;
    animation: move 20s infinite alternate;
}

.blob-2 {
    width: 350px;
    height: 350px;
    background: var(--secondary);
    bottom: -50px;
    right: -50px;
    animation: move 15s infinite alternate-reverse;
}

.blob-3 {
    width: 300px;
    height: 300px;
    background: #0ea5e9;
    top: 40%;
    left: 60%;
    animation: move 25s infinite alternate;
}

@keyframes move {
    from {
        transform: translate(0, 0);
    }

    to {
        transform: translate(100px, 100px);
    }
}

.container {
    width: min(900px, 95%);
    padding: 2rem;
    z-index: 1;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    text-align: left;
}

header h1 {
    font-size: 2.2rem;
    font-weight: 700;
}

.github-link {
    color: var(--text-muted);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
}

.github-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.accent {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.generator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .generator-grid {
        grid-template-columns: 1fr;
    }
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.control-input-num {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    padding: 2px 6px;
    /* Slightly more horizontal padding */
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 700;
    width: 65px;
    /* Slightly wider to prevent cutoff */
    text-align: center;
    font-family: inherit;
    transition: all 0.3s ease;
    appearance: none;
    /* Standard property for compatibility */
    -moz-appearance: textfield;
    /* Hide arrows in Firefox */
}

.control-input-num:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.1);
}

/* Hide arrow/spinners for number inputs in WebKit browsers */
.control-input-num::-webkit-outer-spin-button,
.control-input-num::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="text"],
select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
}

input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

input[type="color"] {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    width: 100%;
    height: 45px;
    border-radius: 12px;
    cursor: pointer;
    background: none;
}

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

input[type="color"]::-webkit-color-swatch {
    border: 1px solid var(--glass-border);
    border-radius: 12px;
}

.input-with-action {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.input-with-action input {
    flex: 1;
}

.btn-icon {
    width: 45px !important;
    height: 45px;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 12px;
    color: white;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    transform: translateY(-2px);
}

.btn-clear {
    background: rgba(239, 68, 68, 0.1) !important;
    border-color: rgba(239, 68, 68, 0.2) !important;
    color: #ef4444 !important;
}

.btn-clear:hover {
    background: rgba(239, 68, 68, 0.2) !important;
}

.file-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

.file-input-wrapper .btn-secondary {
    width: auto;
    white-space: nowrap;
    z-index: 1;
}

#qr-canvas canvas {
    max-width: 100%;
    height: auto !important;
    border-radius: 0;
    /* Forced square corners */
}

#logo-input {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    width: 140px;
    /* Limit click area to the button */
    height: 100%;
    cursor: pointer;
    z-index: 2;
}

#file-name {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.divider {
    height: 1px;
    background: var(--glass-border);
    margin: 0.5rem 0;
}

/* Switch styling */
.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border: 1px solid var(--glass-border);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--primary);
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--primary);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Range input styling */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    background: transparent;
}

input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    border: 1px solid var(--glass-border);
}

input[type="range"]::-webkit-slider-thumb {
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    -webkit-appearance: none;
    margin-top: -7px;
    box-shadow: 0 0 10px rgba(79, 70, 229, 0.4);
}

input[type="number"] {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    color: white;
    font-family: inherit;
    font-size: 1rem;
}

.preview-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    min-height: 450px;
    background: rgba(0, 0, 0, 0.15);
    /* Slightly darker gray background for contrast */
    border-radius: 24px;
    padding: 3rem;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
}

#qr-canvas {
    background: rgba(255, 255, 255, 0.03);
    /* Extremely subtle fill to show boundary */
    border: 1px solid rgba(255, 255, 255, 0.1);
    /* Clear boundary line */
    padding: 0;
    /* REMOVE FIXED PADDING - FIXES MARGIN ISSUE */
    line-height: 0;
    border-radius: 4px;
    /* Small radius for the carrier square */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

#qr-canvas:hover {
    transform: scale(1.02);
}

.btn {
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}