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

:root {
    --emerald: #10b981;
    --teal: #14b8a6;
    --emerald-dark: #059669;
    --emerald-light: #d1fae5;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --radius-lg: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
.header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.9);
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--gray-900);
}

.logo-icon {
    color: var(--emerald);
    font-size: 1.5rem;
}

.pro-badge {
    background: linear-gradient(135deg, var(--emerald), var(--teal));
    color: var(--white);
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
    letter-spacing: 0.5px;
    vertical-align: super;
}

.nav {
    display: flex;
    gap: 32px;
}

.nav a {
    text-decoration: none;
    color: var(--gray-500);
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.nav a:hover {
    color: var(--emerald);
}

/* Hero */
.hero {
    text-align: center;
    padding: 80px 0 40px;
    background: linear-gradient(180deg, var(--white) 0%, var(--gray-50) 100%);
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.15;
    margin-bottom: 16px;
}

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

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--gray-500);
    max-width: 600px;
    margin: 0 auto;
}

/* Generator */
.generator-section {
    padding: 40px 0 80px;
}

.generator-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    border: 1px solid var(--gray-200);
}

.tabs {
    display: flex;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
    overflow-x: auto;
}

.tab {
    flex: 1;
    padding: 14px 20px;
    border: none;
    background: none;
    font-family: inherit;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--gray-500);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    position: relative;
}

.tab:hover {
    color: var(--gray-700);
    background: var(--white);
}

.tab.active {
    color: var(--emerald);
    background: var(--white);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--emerald);
}

.generator-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.input-panel {
    padding: 32px;
    border-right: 1px solid var(--gray-100);
}

.input-group {
    margin-bottom: 20px;
}

.input-group.hidden {
    display: none;
}

.input-group label {
    display: block;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-bottom: 6px;
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--gray-800);
    background: var(--white);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    border-color: var(--emerald);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.input-group textarea {
    resize: vertical;
}

.customize-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    align-items: flex-end;
}

.color-pick,
.size-pick {
    flex: 1;
}

.color-pick label,
.size-pick label {
    display: block;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-bottom: 6px;
}

.color-pick input[type="color"] {
    width: 100%;
    height: 40px;
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    cursor: pointer;
    padding: 2px;
}

.size-pick select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    background: var(--white);
    color: var(--gray-800);
    cursor: pointer;
    outline: none;
}

.size-pick select:focus {
    border-color: var(--emerald);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.logo-upload-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.upload-btn {
    padding: 8px 16px;
    background: var(--gray-100);
    border: 1.5px dashed var(--gray-300);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s;
}

.upload-btn:hover {
    background: var(--gray-200);
    border-color: var(--emerald);
    color: var(--emerald);
}

#logo-name {
    font-size: 0.85rem;
    color: var(--gray-400);
}

.remove-logo {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
}

.remove-logo.hidden {
    display: none;
}

.generate-btn {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--emerald), var(--teal));
    color: var(--white);
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.generate-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.35);
}

.generate-btn:active {
    transform: translateY(0);
}

.preview-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
    background: var(--gray-50);
    min-height: 400px;
}

.qr-output {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 280px;
}

.qr-output canvas,
.qr-output img {
    border-radius: 8px;
}

.qr-placeholder {
    text-align: center;
    color: var(--gray-400);
}

.qr-placeholder-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 12px;
}

.download-row {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.download-row.hidden {
    display: none;
}

.dl-btn {
    padding: 10px 24px;
    background: var(--white);
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s;
}

.dl-btn:hover {
    border-color: var(--emerald);
    color: var(--emerald);
    box-shadow: var(--shadow-sm);
}

/* Features */
.features-section {
    padding: 80px 0;
    background: var(--white);
}

.features-section h2 {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 48px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.feature-card {
    padding: 32px 24px;
    background: var(--gray-50);
    border-radius: var(--radius);
    border: 1px solid var(--gray-100);
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
}

.feature-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.feature-card p {
    font-size: 0.9rem;
    color: var(--gray-500);
    line-height: 1.6;
}

/* History */
.history-section {
    padding: 60px 0 80px;
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.history-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
}

.clear-btn {
    padding: 8px 16px;
    background: none;
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.85rem;
    color: var(--gray-500);
    cursor: pointer;
    transition: all 0.2s;
}

.clear-btn:hover {
    border-color: #ef4444;
    color: #ef4444;
}

.history-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.history-item {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: box-shadow 0.2s;
    cursor: pointer;
}

.history-item:hover {
    box-shadow: var(--shadow-md);
}

.history-item img {
    width: 56px;
    height: 56px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid var(--gray-100);
}

.history-info {
    flex: 1;
    min-width: 0;
}

.history-info .type-badge {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--emerald);
    margin-bottom: 2px;
}

.history-info .content {
    font-size: 0.85rem;
    color: var(--gray-700);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-info .date {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 2px;
}

.empty-history {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--gray-400);
    padding: 40px;
}

/* Ad Section */
.ad-section {
    padding: 0 0 60px;
}

.ad-placeholder {
    background: var(--gray-100);
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    color: var(--gray-400);
    font-size: 0.9rem;
}

/* Footer */
.footer {
    background: var(--gray-900);
    color: var(--gray-400);
    text-align: center;
    padding: 24px 0;
    font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 768px) {
    .nav {
        gap: 16px;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .generator-body {
        grid-template-columns: 1fr;
    }

    .input-panel {
        border-right: none;
        border-bottom: 1px solid var(--gray-100);
    }

    .preview-panel {
        min-height: 300px;
        padding: 32px 24px;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .history-list {
        grid-template-columns: 1fr;
    }

    .tabs {
        overflow-x: auto;
    }
}

@media (max-width: 480px) {
    .header .container {
        flex-direction: column;
        height: auto;
        padding: 12px 24px;
        gap: 8px;
    }

    .hero {
        padding: 48px 0 24px;
    }

    .hero h1 {
        font-size: 1.75rem;
    }

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