:root {
    --primary: #007AFF;
    --primary-hover: #0056b3;
    --bg-color: #F5F5F7;
    --card-bg: #FFFFFF;
    --text-primary: #1D1D1F;
    --text-secondary: #86868B;
    --border-color: #D2D2D7;
    --input-bg: #F5F5F7;
    --focus-ring: rgba(0, 122, 255, 0.4);
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --font-stack: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-stack);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    padding: 40px 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 60px;
    animation: fadeInDown 0.8s ease-out;
}

h1 {
    font-size: 48px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #1D1D1F 0%, #424245 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 20px;
    color: var(--text-secondary);
    font-weight: 400;
    max-width: 600px;
    margin: 0 auto;
}

/* Main Card */
.glass-panel {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 40px;
    margin-bottom: 40px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
}

.grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px;
}

.full-width {
    grid-column: 1 / -1;
}

/* Form Controls */
.control-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

textarea,
input[type="text"],
select {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 16px;
    background-color: var(--input-bg);
    color: var(--text-primary);
    transition: all 0.2s ease;
    appearance: none;
}

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

textarea {
    min-height: 140px;
    resize: vertical;
    line-height: 1.6;
}

/* Custom Select Arrow */
.select-wrapper {
    position: relative;
}

.select-wrapper::after {
    content: "▼";
    font-size: 10px;
    color: var(--text-secondary);
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

/* Color Input */
.color-input-wrapper {
    position: relative;
    height: 50px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
    cursor: pointer;
}

input[type="color"] {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    cursor: pointer;
    border: none;
    padding: 0;
    margin: 0;
}

/* Tabs */
.logo-tabs {
    display: flex;
    background: var(--input-bg);
    padding: 4px;
    border-radius: var(--radius-md);
    width: fit-content;
    margin-bottom: 12px;
}

.tab-btn {
    padding: 8px 20px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn.active {
    background: #fff;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.logo-input-wrapper {
    display: none;
    animation: fadeIn 0.3s ease;
}

.logo-input-wrapper.active {
    display: block;
}

input[type="file"] {
    font-size: 14px;
    color: var(--text-secondary);
    padding: 10px 0;
}

input[type="file"]::file-selector-button {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: #fff;
    font-weight: 600;
    color: var(--text-primary);
    margin-right: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

input[type="file"]::file-selector-button:hover {
    background: var(--bg-color);
}

/* Buttons */
.btn-row {
    display: flex;
    gap: 16px;
    margin-top: 40px;
}

.action-btn {
    height: 56px;
    padding: 0 32px;
    border: none;
    border-radius: 28px;
    /* Pill shape */
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

#generateBtn {
    background: var(--primary);
    color: white;
    flex: 2;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

#generateBtn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 122, 255, 0.4);
}

#downloadAll {
    background: #fff;
    color: var(--primary);
    border: 2px solid var(--primary);
    flex: 1;
}

#downloadAll:hover {
    background: var(--bg-color);
}

#downloadAll:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Output Grid */
#qr-output {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
    padding-bottom: 60px;
}

.qr-card {
    background: #fff;
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) backwards;
}

.qr-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-color);
}

.qr-wrapper canvas {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

.qr-label {
    font-size: 13px;
    color: var(--text-secondary);
    word-break: break-all;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

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

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

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

/* Responsive */
/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 20px 16px;
    }

    h1 {
        font-size: 32px;
        margin-bottom: 8px;
    }

    .subtitle {
        font-size: 18px;
        margin-bottom: 30px;
    }

    .glass-panel {
        padding: 24px 20px;
        margin-bottom: 30px;
    }

    .grid-layout {
        grid-template-columns: 1fr;
        /* Stack everything on mobile */
        gap: 24px;
    }

    .btn-row {
        flex-direction: column;
        gap: 12px;
        margin-top: 32px;
    }

    .action-btn {
        width: 100%;
        height: 52px;
        /* Slightly smaller height for mobile */
        font-size: 16px;
        padding: 020px;
        /* Adjusted padding */
    }

    /* Ensure QR cards don't get too squashed or too wide */
    #qr-output {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 16px;
    }

    .qr-card {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 28px;
    }

    .glass-panel {
        padding: 20px 16px;
    }

    /* On very small screens, let QR cards take full width or 2 columns if possible */
    #qr-output {
        grid-template-columns: 1fr;
    }
}