/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #1f2937;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.title {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.title svg {
    width: 32px;
    height: 32px;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 400;
}

/* Main Content */
.main {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    background: white;
    border-radius: 20px;
    padding: 40px;
}

/* Input Section */
.input-section {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-label {
    font-weight: 500;
    color: #374151;
    font-size: 0.9rem;
}

.input-wrapper {
    position: relative;
}

.qr-input {
    width: 100%;
    padding: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
    transition: all 0.2s ease;
    background: #fafafa;
}

.qr-input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
}

.input-controls {
    position: absolute;
    top: 12px;
    right: 12px;
}

.clear-btn {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

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

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.char-count {
    font-size: 0.8rem;
    color: #6b7280;
}

.quick-actions {
    display: flex;
    gap: 8px;
}

.quick-action-btn {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    color: #374151;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-action-btn:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
}

/* Options Section */
.options-section {
    border-top: 1px solid #e5e7eb;
    padding-top: 24px;
}

.options-title {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 16px;
    color: #374151;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.option-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #4b5563;
}

.option-select {
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.option-select:focus {
    outline: none;
    border-color: #667eea;
}

/* Color Section */
.color-section {
    border-top: 1px solid #e5e7eb;
    padding-top: 20px;
    margin-top: 20px;
}

.color-section-title {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 12px;
    color: #374151;
}

.color-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.color-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.color-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #4b5563;
}

.color-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: white;
}

.color-input {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
}

.color-input::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-input::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.color-value {
    font-size: 0.8rem;
    font-family: monospace;
    color: #6b7280;
    user-select: all;
}

.color-presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.preset-btn {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    color: #374151;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.preset-btn:active {
    transform: translateY(1px);
}

/* Logo Section */
.logo-section {
    border-top: 1px solid #e5e7eb;
    padding-top: 20px;
    margin-top: 20px;
}

.logo-section-title {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 12px;
    color: #374151;
}

.logo-upload {
    margin-bottom: 16px;
}

.logo-input {
    display: none;
}

.logo-upload-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    background: #f9fafb;
    color: #4b5563;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 12px;
}

.logo-upload-btn:hover {
    border-color: #667eea;
    background: #f0f4ff;
    color: #667eea;
}

.logo-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fafafa;
    position: relative;
}

.logo-placeholder {
    color: #9ca3af;
    font-size: 0.85rem;
}

.logo-preview img {
    max-width: 50px;
    max-height: 50px;
    border-radius: 4px;
    object-fit: contain;
}

.logo-options {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-option-group {
    flex: 1;
}

.remove-logo-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fef2f2;
    color: #dc2626;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.remove-logo-btn:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}

/* Output Section */
.output-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.qr-container {
    position: relative;
    background: #f9fafb;
    border-radius: 16px;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #d1d5db;
    overflow: hidden;
}

.qr-placeholder,
.qr-loading,
.qr-error {
    text-align: center;
    color: #6b7280;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px;
}

.qr-placeholder.active,
.qr-loading.active,
.qr-error.active {
    display: flex;
}

.qr-placeholder svg,
.qr-error svg {
    opacity: 0.5;
}

.qr-placeholder p,
.qr-error p {
    font-weight: 500;
    font-size: 1.1rem;
}

.qr-placeholder span,
.qr-error span {
    font-size: 0.9rem;
    opacity: 0.8;
}

.qr-loading p {
    font-weight: 500;
    margin-top: 8px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.qr-output {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.qr-output.active {
    display: flex;
}

.qr-output canvas,
.qr-output img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* Download Section */
.download-section {
    display: none;
    flex-direction: column;
    gap: 16px;
}

.download-section.active {
    display: flex;
}

.download-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.download-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-size: 0.9rem;
    text-decoration: none;
}

.download-btn.primary {
    background: #667eea;
    color: white;
}

.download-btn.primary:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

.download-btn.secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
}

.download-btn.secondary:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}

.download-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.copy-success {
    display: none;
    align-items: center;
    gap: 8px;
    color: #059669;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 8px 0;
}

.copy-success.active {
    display: flex;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 40px;
    color: white;
    opacity: 0.8;
}

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

    .title {
        font-size: 2rem;
    }

    .title svg {
        width: 28px;
        height: 28px;
    }

    .main {
        grid-template-columns: 1fr;
        gap: 30px;
        padding: 24px;
    }

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

    .color-options {
        grid-template-columns: 1fr;
    }

    .color-presets {
        justify-content: center;
    }

    .logo-options {
        flex-direction: column;
        gap: 16px;
    }

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

    .download-btn {
        justify-content: center;
    }

    .input-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .quick-actions {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 1.8rem;
        flex-direction: column;
        gap: 8px;
    }

    .main {
        padding: 20px;
    }

    .qr-container {
        min-height: 300px;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }

    .container {
        max-width: none;
        margin: 0;
        padding: 0;
    }

    .header,
    .input-section,
    .download-section,
    .footer {
        display: none;
    }

    .main {
        display: block;
        background: white;
        padding: 0;
    }

    .qr-container {
        border: none;
        background: white;
        min-height: auto;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .main {
        background: #1f2937;
        color: #f9fafb;
    }

    .qr-input {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }

    .qr-input:focus {
        background: #4b5563;
        border-color: #667eea;
    }

    .qr-container {
        background: #374151;
        border-color: #4b5563;
    }

    .option-select {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }

    .download-btn.secondary {
        background: #374151;
        color: #f9fafb;
        border-color: #4b5563;
    }

    .download-btn.secondary:hover {
        background: #4b5563;
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles for keyboard navigation */
button:focus,
select:focus,
textarea:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Animation for smooth transitions */
.qr-container > * {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.download-section {
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
