* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #10b981;
    --error-color: #ef4444;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --bg-color: #f9fafb;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --shadow: 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);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

header {
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem 0;
    text-align: center;
    box-shadow: var(--shadow);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-light);
    font-size: 1.1rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

main {
    padding: 2rem 0;
}

.tabs {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.95);
    padding: 0.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.tab-btn {
    flex: 1;
    min-width: 150px;
    padding: 1rem 1.5rem;
    border: none;
    background: transparent;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
}

.card h2 {
    margin-bottom: 1.5rem;
    color: var(--text-color);
    font-size: 1.8rem;
}

.card h3 {
    margin: 1.5rem 0 1rem;
    color: var(--text-color);
    font-size: 1.4rem;
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: var(--bg-color);
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(102, 126, 234, 0.1);
}

.upload-placeholder svg {
    color: var(--text-light);
    margin-bottom: 1rem;
}

.upload-placeholder p {
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.upload-hint {
    font-size: 0.9rem;
    color: var(--text-light);
}

.preview-container {
    margin-bottom: 1.5rem;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.preview-container img {
    width: 100%;
    height: auto;
    display: block;
}

.controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--bg-color);
    border-radius: 8px;
}

.controls label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.controls input[type="range"] {
    width: 150px;
    accent-color: var(--primary-color);
}

.btn {
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.palette-display,
.generated-palette {
    margin-top: 2rem;
}

.palette-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.color-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
    cursor: pointer;
}

.color-card:hover {
    transform: translateY(-4px);
}

.color-swatch {
    height: 100px;
    width: 100%;
}

.color-info {
    padding: 0.75rem;
    text-align: center;
}

.color-hex {
    font-family: monospace;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-color);
}

.color-rgb {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

.palette-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.palette-generation-methods {
    display: grid;
    gap: 1.5rem;
}

.method-selector,
.color-picker-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.method-selector label,
.color-picker-container label {
    font-weight: 600;
    color: var(--text-color);
}

.method-selector select {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

.color-picker-container input[type="color"] {
    width: 60px;
    height: 40px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#baseColorHex {
    font-family: monospace;
    font-size: 1rem;
    color: var(--text-light);
}

.gradient-builder {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--bg-color);
    border-radius: 12px;
}

.gradient-preview {
    height: 150px;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    background: linear-gradient(to right, #667eea, #764ba2);
}

.gradient-colors {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.gradient-colors input[type="color"] {
    width: 60px;
    height: 40px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.gradient-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.gradient-controls select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
}

.gradient-code {
    position: relative;
    background: #1f2937;
    color: #10b981;
    padding: 1rem;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.9rem;
}

.btn-copy {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.btn-copy:hover {
    background: var(--secondary-color);
}

.qr-type-selector {
    margin-bottom: 1.5rem;
}

.qr-type-selector label {
    font-weight: 600;
    color: var(--text-color);
    margin-right: 0.5rem;
}

.qr-type-selector select {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

.qr-input {
    display: none;
    margin-bottom: 1.5rem;
}

.qr-input.active {
    display: block;
}

.qr-input label {
    font-weight: 600;
    color: var(--text-color);
    display: block;
    margin-bottom: 0.5rem;
}

.qr-input input[type="text"],
.qr-input input[type="url"],
.qr-input input[type="email"],
.qr-input input[type="tel"],
.qr-input input[type="password"],
.qr-input select,
.qr-input textarea {
    width: 100%;
    padding: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 1rem;
    font-family: inherit;
}

.qr-input input:focus,
.qr-input textarea:focus,
.qr-input select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.branding-section,
.artistic-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--bg-color);
    border-radius: 12px;
}

.branding-controls {
    display: grid;
    gap: 1.5rem;
}

.logo-upload {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.upload-small {
    border: 2px dashed var(--border-color);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
}

.upload-small:hover {
    border-color: var(--primary-color);
    background: rgba(102, 126, 234, 0.05);
}

#logoPreview {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
}

#logoPreview img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 8px;
}

.btn-remove {
    padding: 0.5rem 1rem;
    background: var(--error-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.color-settings {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.color-settings label {
    font-weight: 500;
    color: var(--text-color);
}

.color-settings input[type="color"] {
    width: 100%;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
}

.artistic-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.artistic-controls label.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

#artisticOptions {
    display: grid;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

#artisticOptions label {
    font-weight: 500;
    color: var(--text-color);
}

.qr-size-control {
    margin: 1.5rem 0;
}

.qr-result {
    margin-top: 2rem;
    text-align: center;
}

.qr-canvas-container {
    display: inline-block;
    padding: 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

#qrCanvas {
    max-width: 100%;
    height: auto;
}

.qr-export {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.batch-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.batch-options {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: var(--bg-color);
    border-radius: 12px;
}

.batch-options h3 {
    margin-top: 0;
}

.batch-options label {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

.batch-results {
    margin-top: 2rem;
}

#batchGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.batch-qr-item {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    text-align: center;
}

.batch-qr-item canvas {
    max-width: 100%;
}

.batch-qr-item p {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-light);
    word-break: break-all;
}

.info {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

footer {
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem 0;
    text-align: center;
    margin-top: 2rem;
    box-shadow: var(--shadow);
}

footer p {
    color: var(--text-light);
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }

    .card {
        padding: 1.5rem;
    }

    .card h2 {
        font-size: 1.5rem;
    }

    .palette-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }

    .color-swatch {
        height: 80px;
    }

    .tabs {
        flex-direction: column;
    }

    .tab-btn {
        min-width: auto;
    }

    .batch-actions {
        flex-direction: column;
    }

    .qr-export {
        flex-direction: column;
    }
}

/* Loading Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: #1f2937;
    color: white;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}
