@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --bg-light: #F4F7FB;
    --card-bg: #FFFFFF;
    --card-border: #Eef0f5;
    --text-heading: #0E172C;
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --accent-primary: #2563EB;
    --accent-hover: #1D4ED8;
    --input-bg: #FFFFFF;
    --input-border: #CBD5E1;
}

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

[hidden] {
    display: none !important;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-x: hidden;
    padding: 2rem;
    -webkit-font-smoothing: antialiased;
}

.container {
    width: 100%;
    max-width: 800px;
    z-index: 1;
}

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

header h1 {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: 0;
    margin-bottom: 0.5rem;
    color: var(--text-heading);
}

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

.card-panel {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.05);
}

.input-section {
    margin-bottom: 2.5rem;
}

.input-section label {
    display: block;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-heading);
}

.input-wrapper {
    display: flex;
    gap: 1rem;
}

input[type="text"] {
    flex: 1;
    width: 100%;
    min-width: 0;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    padding: 0.875rem 1.25rem;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    transition: all 0.2s ease;
    outline: none;
}

input[type="text"]:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

button {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    min-height: 48px;
    white-space: nowrap;
}

button:focus {
    outline: 3px solid rgba(37, 99, 235, 0.18);
    outline-offset: 2px;
}

button:disabled {
    cursor: wait;
    opacity: 0.65;
    transform: none;
}

.primary-btn {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    color: white;
    padding: 0.875rem 2rem;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
    flex: 0 0 auto;
}

.primary-btn:hover {
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
    transform: translateY(-1px);
}

.secondary-btn {
    background: #FFFFFF;
    color: var(--text-primary);
    border: 1px solid var(--input-border);
    padding: 0.75rem 1rem;
    width: 100%;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.secondary-btn:hover {
    background: #F8FAFC;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
}

.styling-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-right: 1.5rem;
    border-right: 1px solid var(--card-border);
}

.styling-column h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 0.5rem;
}

.control-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-heading);
}

.colors-group {
    background: #FAFAFA;
    border: 1px solid var(--card-border);
    padding: 1rem;
    border-radius: 12px;
}

.color-pickers {
    display: flex;
    gap: 1.5rem;
}

.color-picker-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.color-picker-wrapper span {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    cursor: pointer;
    background: none;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}
input[type="color"]::-webkit-color-swatch {
    border: 1px solid var(--input-border);
    border-radius: 8px;
}

select {
    width: 100%;
    background: #FFFFFF;
    border: 1px solid var(--input-border);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%2364748B%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpolyline%20points%3D%226%209%2012%2015%2018%209%22%3E%3C%2Fpolyline%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
}

select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.file-upload-wrapper input[type="file"] {
    width: 100%;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.file-upload-wrapper input[type="file"]::file-selector-button {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 500;
    color: var(--accent-primary);
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    margin-right: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-upload-wrapper input[type="file"]::file-selector-button:hover {
    background: #DBEAFE;
}

.preview-column {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.qr-preview-area {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 100%;
}

.qr-container {
    width: 100%;
    height: auto;
    min-height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    padding: 2rem;
}

.qr-container.empty {
    background: #F8FAFC;
    border: 1px dashed #93C5FD;
    border-radius: 12px;
}

.placeholder-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    color: var(--text-secondary);
    text-align: center;
}

.placeholder-content span {
    font-size: 1.1rem;
    font-weight: 500;
}

.qr-container > img,
.qr-container > canvas,
.qr-container > svg {
    width: min(100%, 260px);
    height: auto;
    aspect-ratio: 1;
    object-fit: contain;
}

.download-actions {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.download-fallback {
    margin-top: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
    text-align: center;
}

.download-fallback a {
    color: var(--accent-primary);
    font-weight: 700;
    text-decoration: none;
}

.download-fallback a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.export-preview {
    display: grid;
    justify-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: #F8FAFC;
    border: 1px solid var(--card-border);
    border-radius: 8px;
}

.export-preview img {
    width: min(100%, 180px);
    height: auto;
    aspect-ratio: 1;
    object-fit: contain;
    background: #FFFFFF;
    border-radius: 8px;
}

.export-share-btn {
    max-width: 220px;
}

.site-footer {
    margin: 3rem auto 0;
    max-width: 600px;
    padding-bottom: 2rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.7;
    text-align: center;
}

@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .container {
        max-width: 560px;
    }

    header {
        margin-bottom: 1.5rem;
    }

    header h1 {
        font-size: 2.25rem;
    }

    header p {
        font-size: 1rem;
        line-height: 1.6;
    }

    header p br {
        display: none;
    }

    .card-panel {
        padding: 1.25rem;
        border-radius: 16px;
    }

    .input-section {
        margin-bottom: 1.5rem;
    }

    .main-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .preview-column {
        order: -1;
    }
    
    .styling-column {
        padding-right: 0;
        border-right: none;
        border-bottom: 1px solid var(--card-border);
        padding-bottom: 1.75rem;
        gap: 1.25rem;
    }
    
    .input-wrapper {
        flex-direction: column;
        gap: 0.75rem;
    }

    .primary-btn,
    .secondary-btn {
        width: 100%;
    }

    .qr-preview-area {
        gap: 1rem;
    }

    .qr-container {
        min-height: 0;
        aspect-ratio: 1;
        padding: 1rem;
    }

    .qr-container > img,
    .qr-container > canvas,
    .qr-container > svg {
        width: min(100%, 292px);
    }
    
    .qr-container.empty {
        min-height: 0;
    }

    .placeholder-content {
        gap: 1rem;
    }

    .placeholder-content svg {
        width: 96px;
        height: 96px;
    }

    .placeholder-content span {
        font-size: 1rem;
    }

    .site-footer {
        margin-top: 2rem;
        padding-bottom: 1rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 520px) {
    body {
        padding: 0.5rem;
    }

    header {
        margin-bottom: 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .card-panel {
        padding: 0.875rem;
        border-radius: 12px;
    }

    .colors-group {
        padding: 0.875rem;
    }

    .color-pickers {
        gap: 0.75rem;
        justify-content: space-between;
    }

    .color-picker-wrapper {
        flex: 1;
        align-items: flex-start;
    }

    .download-actions {
        flex-direction: column;
    }

    .export-preview img {
        width: min(100%, 220px);
    }

    .qr-container {
        padding: 0.625rem;
    }

    .site-footer {
        text-align: left;
    }
}

@media (max-width: 360px) {
    body {
        padding: 0.375rem;
    }

    header h1 {
        font-size: 1.75rem;
    }

    header p {
        font-size: 0.9rem;
    }

    .card-panel {
        padding: 0.75rem;
    }

    input[type="text"],
    select,
    button {
        font-size: 0.95rem;
    }
}
