/* CSS Custom Properties for Dark Mode */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #e2e8f0;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-tertiary: #718096;
    --border-color: #e2e8f0;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --success-color: #10b981;
    --error-color: #ef4444;
    --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);
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1a202c;
        --bg-secondary: #2d3748;
        --bg-tertiary: #4a5568;
        --text-primary: #f7fafc;
        --text-secondary: #e2e8f0;
        --text-tertiary: #a0aec0;
        --border-color: #4a5568;
        --accent-color: #60a5fa;
        --accent-hover: #3b82f6;
        --success-color: #34d399;
        --error-color: #f87171;
        --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
        --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    }
}

/* 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: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 20px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Main content */
.main-content {
    background: var(--bg-secondary);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 1000px;
    overflow: hidden;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.generator-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 2rem;
}

/* Input section */
.input-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

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

.input-label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.text-input {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: all 0.3s ease;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.text-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.text-input::placeholder {
    color: var(--text-tertiary);
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.clear-btn {
    background: none;
    border: none;
    color: var(--error-color);
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.clear-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* QR Type Navbar */
.qr-type-navbar {
    display: flex;
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 4px;
    border: 2px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.type-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.type-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.type-btn.active {
    background: var(--accent-color);
    color: white;
    box-shadow: var(--shadow);
}

.type-btn i {
    font-size: 0.8rem;
}

/* Form rows for WiFi and Contact forms */
.form-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.form-row:last-child {
    margin-bottom: 0;
}

.wifi-form, .contact-form {
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-color);
}

/* Style Presets */
.preset-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.preset-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.preset-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

/* Options section - removed since moved to advanced */

/* Advanced Options */
.advanced-section {
    margin-top: 1rem;
}

.advanced-toggle {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
}

.advanced-toggle:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.advanced-toggle i:first-child {
    margin-right: 0.5rem;
}

.advanced-toggle i:last-child {
    transition: transform 0.3s ease;
}

.advanced-toggle.expanded i:last-child {
    transform: rotate(180deg);
}

.advanced-content {
    margin-top: 1rem;
    padding: 1.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.file-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.3s ease;
    cursor: pointer;
}

.file-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.file-input::-webkit-file-upload-button {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    margin-right: 1rem;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
}

.file-input::-webkit-file-upload-button:hover {
    background: var(--accent-hover);
}

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

.option-label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.select-input {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.select-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.range-input {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-tertiary);
    outline: none;
    -webkit-appearance: none;
}

.range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    box-shadow: var(--shadow);
}

.range-input::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow);
}

.range-value {
    text-align: center;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.color-input {
    width: 100%;
    height: 40px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-primary);
}

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

/* Output section */
.output-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.qr-container {
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.qr-placeholder {
    text-align: center;
    color: var(--text-tertiary);
    padding: 2rem;
}

.qr-placeholder i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.qr-placeholder p {
    font-size: 1rem;
    font-weight: 500;
}

.qr-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.action-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.download-btn {
    background: var(--success-color);
    color: white;
}

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

.copy-btn {
    background: var(--accent-color);
    color: white;
}

.copy-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

/* Responsive design */
@media (max-width: 768px) {
    .generator-section {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1.5rem;
    }

    .qr-type-navbar {
        flex-direction: column;
        gap: 4px;
    }

    .type-btn {
        flex: none;
    }

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

    .preset-buttons {
        justify-content: center;
    }

    .qr-actions {
        flex-direction: column;
        width: 100%;
    }

    .action-btn {
        width: 100%;
        justify-content: center;
    }

    .container {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0.5rem;
    }

    .generator-section {
        padding: 1rem;
    }
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--accent-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Success animation */
.success-animation {
    animation: successPulse 0.6s ease-in-out;
}

@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Error state */
.error {
    border-color: var(--error-color) !important;
    background: rgba(239, 68, 68, 0.1) !important;
}

.error-message {
    color: var(--error-color);
    font-size: 0.8rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}