/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    min-height: 100vh;
    color: #e0e0e0;
    padding: 20px;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
}

h1 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 4px;
    color: #fff;
}

.subtitle {
    text-align: center;
    color: #a0a0c0;
    margin-bottom: 30px;
    font-size: 0.95rem;
}

/* --- Layout --- */
.main-layout {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.config-panel {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 28px;
    backdrop-filter: blur(10px);
}

.preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    position: sticky;
    top: 20px;
}

.preview-area {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 30px;
    min-height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    backdrop-filter: blur(10px);
}

.preview-placeholder {
    color: #666;
    font-size: 0.95rem;
}

#qr-canvas {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* --- Form Elements --- */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.88rem;
    color: #c0c0e0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

textarea, select, input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #fff;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s;
    resize: vertical;
}

textarea:focus, select:focus, input[type="text"]:focus {
    outline: none;
    border-color: #7c5cfc;
    box-shadow: 0 0 0 3px rgba(124, 92, 252, 0.2);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23aaa' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* --- Color Inputs --- */
.color-group {
    display: flex;
    gap: 16px;
}

.color-group .form-group {
    flex: 1;
}

.color-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.color-input-wrapper input[type="color"] {
    width: 42px;
    height: 42px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    cursor: pointer;
    background: none;
    padding: 2px;
    flex-shrink: 0;
}

.color-input-wrapper input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-input-wrapper input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 5px;
}

.color-input-wrapper input[type="text"] {
    flex: 1;
    font-family: 'Consolas', 'Courier New', monospace;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- Range Slider --- */
.range-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.range-wrapper input[type="range"] {
    flex: 1;
    accent-color: #7c5cfc;
    height: 6px;
    cursor: pointer;
}

.range-wrapper span {
    min-width: 40px;
    text-align: right;
    font-weight: 600;
    color: #7c5cfc;
    font-size: 0.9rem;
}

/* --- Logo Upload --- */
.logo-upload-area {
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-upload-area:hover,
.logo-upload-area.drag-over {
    border-color: #7c5cfc;
    background: rgba(124, 92, 252, 0.08);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #888;
    font-size: 0.88rem;
}

.upload-icon {
    font-size: 1.6rem;
    margin-bottom: 2px;
}

.upload-hint {
    font-size: 0.75rem;
    color: #555;
}

.logo-preview-container {
    position: relative;
    display: inline-block;
}

#logo-preview {
    max-width: 80px;
    max-height: 80px;
    border-radius: 8px;
    object-fit: contain;
}

#remove-logo {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: #e74c3c;
    color: #fff;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.2s;
}

#remove-logo:hover {
    background: #c0392b;
}

/* --- Buttons --- */
.btn-generate {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #7c5cfc, #5a3fd4);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 6px;
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(124, 92, 252, 0.4);
}

.btn-generate:active {
    transform: translateY(0);
}

.download-buttons {
    display: flex;
    gap: 12px;
    width: 100%;
}

.btn-download {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-download:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px);
}

.btn-svg {
    background: rgba(124, 92, 252, 0.15);
    border-color: rgba(124, 92, 252, 0.3);
}

.btn-svg:hover {
    background: rgba(124, 92, 252, 0.25);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .main-layout {
        flex-direction: column;
    }

    .preview-panel {
        position: static;
        width: 100%;
    }

    .color-group {
        flex-direction: column;
        gap: 0;
    }

    h1 {
        font-size: 1.5rem;
    }
}
