:root {
    --primary-bg: #F8FAFC;
    --card-bg: rgba(255, 255, 255, 0.85);
    --text-main: #111827;
    --text-muted: #6B7280;
    --accent: #6366F1;
    --accent-hover: #4F46E5;
    --border-color: #E5E7EB;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-md: 12px;
    --radius-lg: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --primary-bg: #0F172A;
    --card-bg: rgba(30, 41, 59, 0.85);
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --accent: #818CF8;
    --accent-hover: #A5B4FC;
    --border-color: #334155;
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--primary-bg);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    transition: background-color 0.4s ease;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 5%;
    background: transparent;
    position: relative;
    z-index: 10;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    font-size: 1.8rem;
    color: var(--accent);
    background: linear-gradient(135deg, #6366F1, #A855F7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
    color: var(--text-main);
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
}

.icon-btn:hover {
    color: var(--accent);
    transform: scale(1.1);
}

/* Main Container */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 5%;
    position: relative;
    z-index: 10;
}

.hero {
    text-align: center;
    margin-bottom: 4rem;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-title span {
    background: linear-gradient(135deg, #6366F1, #A855F7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
}

/* Generator Layout */
.generator-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
}

@media (max-width: 900px) {
    .generator-layout {
        grid-template-columns: 1fr;
    }
    
    .preview-card {
        position: static;
    }
}

@media (max-width: 600px) {

    .hero-title {
        font-size: 2.2rem;
    }

    .card {
        padding: 1.5rem;
    }

    .color-pickers {
        flex-direction: column;
        gap: 1rem;
    }

    .picker-group {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .action-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

/* Cards (Glassmorphism) */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Controls Section */
.control-group {
    margin-bottom: 2rem;
}

.section-label {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-main);
}

/* Input Types */
.input-types {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.type-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: transparent;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.type-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent);
    border-color: var(--accent);
}

.type-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.39);
}

/* Forms */
.dynamic-input {
    display: none;
    animation: fadeIn 0.3s ease;
}
.dynamic-input.active {
    display: block;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.premium-input, .premium-select {
    width: 100%;
    padding: 1rem 1rem 1rem 2.8rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

.premium-input:focus, .premium-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

textarea.premium-input {
    padding-left: 1rem; /* No icon for textarea usually */
}
#input-container-text textarea { padding-left: 1rem; }

.mb-2 { margin-bottom: 0.75rem; }

/* Templates Grid */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 1rem;
}

.template-card {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: transparent;
}

.template-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.template-card.active {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.05);
}

.template-preview-img-container {
    width: 60px;
    height: 60px;
    margin: 0 auto 0.5rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.template-preview-img-container img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.template-name {
    font-size: 0.75rem;
    font-weight: 500;
}

/* Customization */
.customization-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

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

.picker-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.picker-group label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
    background: none;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 1px solid var(--border-color); border-radius: 8px; }

.slider-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.premium-slider {
    width: 100%;
    cursor: pointer;
}

/* Actions */
.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn {
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--accent);
    color: white;
    flex: 1;
    box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.39);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-success {
    background: #10B981;
    color: white;
    width: 100%;
    margin-bottom: 0.5rem;
}

.btn-success:hover {
    background: #059669;
    box-shadow: 0 4px 14px 0 rgba(16, 185, 129, 0.39);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    flex: 1;
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Preview Card */
.preview-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    text-align: center;
    position: sticky;
    top: 2rem;
}

.preview-title {
    font-size: 1.25rem;
    margin-bottom: 2rem;
}

.preview-container {
    width: 100%;
    aspect-ratio: 1/1;
    max-width: 350px;
    background: white;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    padding: 1rem;
}

[data-theme="dark"] .preview-container {
    background: rgba(255, 255, 255, 0.05); /* slightly lighter dark */
}

/* Skeletons */
.skeleton-loader {
    display: none;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background: linear-gradient(110deg, #ececec 8%, #f5f5f5 18%, #ececec 33%);
    background-size: 200% 100%;
    animation: 1.5s shine linear infinite;
}

[data-theme="dark"] .skeleton-loader {
    background: linear-gradient(110deg, #1e293b 8%, #334155 18%, #1e293b 33%);
}

.skeleton-loader.active {
    display: block;
}

.qr-result img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    display: block;
}

.download-actions {
    width: 100%;
    opacity: 0.5;
    pointer-events: none;
    transition: var(--transition);
}

.download-actions.active {
    opacity: 1;
    pointer-events: auto;
}

.secondary-downloads {
    display: flex;
    gap: 0.5rem;
}

/* History */
.history-section {
    margin-top: 4rem;
}

.history-grid {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Hide scrollbar for cleaner look if desired, or keep it */
.history-grid::-webkit-scrollbar {
    height: 8px;
}
.history-grid::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.history-item {
    min-width: 200px;
    flex-shrink: 0;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.history-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.history-img {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    background: white;
}

.history-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.empty-state {
    width: 100%;
    text-align: center;
    color: var(--text-muted);
    padding: 3rem;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    border: 1px dashed var(--border-color);
}

/* Footer */
.footer {
    text-align: center;
    padding: 3rem 5% 2rem 5%;
    margin-top: 4rem;
    border-top: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
}
.footer-socials {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
.footer-socials a {
    color: var(--text-muted);
    font-size: 1.5rem;
    transition: var(--transition);
}
.footer-socials a:hover {
    color: var(--accent);
    transform: translateY(-3px);
}
.footer-contact {
    margin-bottom: 1.5rem;
}
.footer-contact a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}
.footer-contact a:hover {
    color: var(--accent);
}
.footer-content p {
    margin-bottom: 0.25rem;
}
.footer-content a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}
.footer-content a:hover {
    text-decoration: underline;
}
.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 1.5rem auto 0 auto;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.footer-bottom-left {
    color: var(--text-muted);
    text-align: left;
    margin: 0;
}
.footer-bottom-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.footer-policy-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: color 0.2s ease, transform 0.2s ease;
}
.footer-policy-link:hover {
    color: var(--accent);
    text-decoration: underline;
    transform: translateY(-1px);
}
@media (max-width: 640px) {
    .footer-bottom {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
    .footer-bottom-left {
        text-align: center;
    }
    .footer-bottom-right {
        margin-left: 0;
        justify-content: center;
    }
}

/* Features Section */
.features-section {
    margin-top: 5rem;
    padding: 0 2%;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem 1.5rem;
    text-align: center;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.feature-card:hover {
    transform: translateY(-10px);
    border-color: var(--accent);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    font-size: 2.5rem;
    color: var(--accent);
    margin-bottom: 1.5rem;
    display: inline-block;
    padding: 1rem;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 50%;
    transition: var(--transition);
}

.feature-card:hover .feature-icon {
    transform: scale(1.1) rotate(5deg);
    background: var(--accent);
    color: white;
}

.feature-card h4 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.feature-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

@keyframes fadeInUpFloat {
    0% { opacity: 0; transform: translateY(30px); }
    100% { opacity: 1; transform: translateY(0); }
}

.animated-feature {
    animation: fadeInUpFloat 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
}

.footer-details {
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* Toasts */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--text-main);
    color: var(--primary-bg);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideInRight 0.3s ease forwards;
}

.toast.error {
    background: #EF4444;
    color: white;
}

@keyframes shine {
    to {
        background-position-x: -200%;
    }
}
