/* Variables CSS */
:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #6366f1;
    --success-color: #10b981;
    --background: #f8fafc;
    --card-background: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --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);
}

/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding: 2rem 1rem;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

header h1 i {
    margin-right: 0.5rem;
}

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

/* Layout principal */
.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

/* Sections */
.form-section,
.qr-section {
    background: var(--card-background);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
}

.form-section h2,
.qr-result h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-section h3 {
    font-size: 1.2rem;
    margin: 2rem 0 1rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

/* Formulaire */
.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.95rem;
}

label i {
    margin-right: 0.3rem;
    color: var(--primary-color);
    width: 20px;
    display: inline-block;
}

input,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background: white;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

/* Boutons */
.btn-generate {
    width: 100%;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
    box-shadow: var(--shadow);
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-download {
    padding: 0.75rem 1.5rem;
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: var(--shadow);
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    filter: brightness(1.1);
}

.btn-download.secondary {
    background: var(--primary-color);
}

/* Section QR Code */
.qr-section {
    position: sticky;
    top: 2rem;
}

.qr-result {
    text-align: center;
}

.qr-container {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    display: inline-block;
    margin: 1.5rem auto;
    box-shadow: var(--shadow);
}

#qrCanvas {
    display: block;
    max-width: 100%;
    height: auto;
}

.qr-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1.5rem 0;
}

.qr-info {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #eff6ff;
    border-left: 4px solid var(--primary-color);
    border-radius: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: left;
}

.qr-info i {
    color: var(--primary-color);
    margin-right: 0.5rem;
}

/* Placeholder QR */
.qr-placeholder {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

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

.qr-placeholder p {
    font-size: 1.1rem;
    opacity: 0.7;
}

/* États */
.hidden {
    display: none !important;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 3rem;
    color: white;
    opacity: 0.9;
    font-size: 0.9rem;
}

footer i {
    color: #ff6b6b;
}

/* Responsive */
@media (max-width: 1024px) {
    .content-wrapper {
        grid-template-columns: 1fr;
    }

    .qr-section {
        position: static;
    }
}

@media (max-width: 768px) {
    body {
        padding: 1rem 0.5rem;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .form-section,
    .qr-section {
        padding: 1.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .qr-container {
        padding: 1rem;
    }

    .qr-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }

    .form-section,
    .qr-section {
        padding: 1rem;
    }

    input,
    textarea {
        font-size: 16px; /* Évite le zoom automatique sur iOS */
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.qr-result {
    animation: fadeIn 0.5s ease;
}

/* Accessibilité */
*:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .form-section,
    footer {
        display: none;
    }

    .qr-section {
        box-shadow: none;
    }

    .qr-actions {
        display: none;
    }
}
