:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

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

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

/* Background gradient animation */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.15) 0%, rgba(15, 23, 42, 1) 70%);
    z-index: 0;
    animation: pulse 10s ease-in-out infinite alternate;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    100% {
        transform: scale(1.1);
        opacity: 1;
    }
}

.container {
    position: relative;
    z-index: 1;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 3rem;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    opacity: 0;
    animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeUp {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.header-icon {
    width: 48px;
    height: 48px;
    color: var(--primary);
    margin-bottom: 1rem;
    background: rgba(99, 102, 241, 0.1);
    padding: 12px;
    border-radius: 16px;
    display: inline-block;
}

h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

.input-group {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

input[type="text"] {
    flex: 1;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    outline: none;
    width: 100%;
}

input[type="text"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

input[type="text"]::placeholder {
    color: var(--text-muted);
}

/* Options Row styles */
.options-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
    align-items: stretch;
}

.flex-1 {
    flex: 1;
}

/* Logo Upload Custom Styles */
.logo-upload-group {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.4);
    border: 1px dashed var(--border-color);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    min-height: 52px;
}

.logo-upload-group:hover,
.logo-upload-group.has-file {
    border-color: rgba(99, 102, 241, 0.5);
    background: rgba(15, 23, 42, 0.6);
}

.logo-upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    transition: color 0.3s ease;
    width: 100%;
}

.logo-upload-btn:hover {
    color: var(--primary);
}

.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logo-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    width: 100%;
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

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

#logo-preview-img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.remove-logo-btn {
    position: absolute;
    top: -8px;
    right: 50%;
    margin-right: -24px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.remove-logo-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
    box-shadow: none;
}

/* Size Select Custom Styles */
.size-select-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0 1rem;
    transition: all 0.3s ease;
    flex: 1;
}

.size-select-group:hover,
.size-select-group:focus-within {
    border-color: rgba(99, 102, 241, 0.5);
    background: rgba(15, 23, 42, 0.6);
}

.size-icon {
    color: var(--text-muted);
    width: 18px;
    height: 18px;
}

.modern-select {
    background: transparent;
    color: var(--text-main);
    border: none;
    font-family: inherit;
    font-size: 0.9rem;
    padding: 0.75rem 0;
    width: 100%;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.modern-select option {
    background: var(--bg-dark);
    color: var(--text-main);
    padding: 10px;
}

.full-width-btn {
    width: 100%;
    justify-content: center;
    padding: 1rem;
    margin-bottom: 2rem;
}

button {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 0 1.5rem;
    font-family: inherit;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

button:active {
    transform: translateY(0);
}

.action-btn {
    background: #f1f5f9;
    color: #0f172a;
    padding: 0.75rem 1.5rem;
}

.action-btn:hover {
    background: #e2e8f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.qr-container {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    position: relative;
    overflow: hidden;
    transition: all 0.4s ease;
}

.qr-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: #94a3b8;
    position: absolute;
    transition: opacity 0.3s ease;
}

.placeholder-icon {
    width: 48px;
    height: 48px;
    opacity: 0.5;
}

#qrcode {
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    justify-content: center;
    width: 100%;
}

#qrcode img {
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    max-width: 100%;
    /* Always constrain display width to container */
    max-height: 250px;
    /* Prevent UI overflow */
    object-fit: contain;
}

.qr-container.active #qrcode {
    opacity: 1;
    transform: scale(1);
}

.qr-container.active .qr-placeholder {
    opacity: 0;
    pointer-events: none;
}

.actions {
    margin-top: 1.5rem;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.4s ease 0.2s;
}

.actions.visible {
    opacity: 1;
    transform: translateY(0);
}

.hidden {
    display: none !important;
}

@media (max-width: 480px) {
    .container {
        padding: 2rem;
        margin: 1rem;
        border-radius: 20px;
    }

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