/* ✅ CSS CORRIGÉ ET COMPLET POUR QR-XP */

/* Reset et styles de base */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

/* Layout principal */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 
                 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 
                 'Meiryo', sans-serif;
    background: #f8fafc;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 20px;
    color: #1e293b;
    position: relative;
}

.container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    padding: 32px;
    max-width: 480px;
    width: 100%;
    margin-bottom: 40px;
}

/* ✅ SÉLECTEUR DE LANGUE AVEC DRAPEAUX SVG */
.language-selector {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.lang-flag {
    width: 32px;
    height: 24px;
    cursor: pointer;
    border-radius: 4px;
    border: 2px solid transparent;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.lang-flag svg {
    width: 20px;
    height: 15px;
    display: block;
    border-radius: 2px;
}

.lang-flag:hover {
    transform: scale(1.1);
    border-color: #3b82f6;
    background: #f8fafc;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.lang-flag.active {
    border-color: #3b82f6;
    background: #e0f2fe;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.lang-flag:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Typographie */
h1 {
    font-size: 28px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 24px;
    color: #0f172a;
}

h2 {
    font-size: 24px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 16px;
}

h3 {
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 12px;
}

/* Statut utilisateur */
.user-status {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #0ea5e9;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 24px;
    box-shadow: 0 2px 4px rgba(14, 165, 233, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-status.premium {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-color: #10b981;
}

.user-status.blocked {
    background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
    border-color: #ef4444;
}

.status-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.status-text {
    flex: 1;
}

.status-title {
    font-weight: 600;
    font-size: 16px;
    color: #1e293b;
    margin-bottom: 2px;
}

.status-subtitle {
    font-size: 14px;
    color: #64748b;
}

/* Formulaire */
.form-group {
    margin-bottom: 24px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
    font-size: 14px;
}

.text-input, 
.promo-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    transition: all 0.2s;
}

.text-input:focus,
.promo-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.input-counter {
    font-size: 12px;
    color: #6b7280;
    text-align: right;
    margin-top: 4px;
}

.input-counter.warning {
    color: #f59e0b;
}

.input-counter.error {
    color: #ef4444;
}

/* Contrôles de taille */
.size-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.size-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: #6b7280;
}

#sizeValue {
    font-weight: 600;
    color: #3b82f6;
    font-size: 16px;
}

#sizeRange {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e2e8f0;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
}

#sizeRange::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#sizeRange::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.size-description {
    text-align: center;
    margin: 8px 0;
    font-size: 13px;
    color: #9ca3af;
    font-style: italic;
    min-height: 18px;
}

/* Options de style */
.style-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 8px;
}

.style-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.style-option:hover {
    border-color: #3b82f6;
    background: #f8fafc;
}

.style-option input[type="radio"] {
    display: none;
}

.style-option input[type="radio"]:checked + .style-preview {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.style-option:has(input[type="radio"]:checked) {
    border-color: #3b82f6;
    background: #f0f9ff;
}

.style-preview {
    width: 40px;
    height: 40px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    position: relative;
    transition: all 0.2s;
}

.style-preview.bg-white {
    background: white;
}

.style-preview.bg-white::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: black;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 2px;
}

.style-preview.bg-transparent-black {
    background: transparent;
    border-style: dashed;
}

.style-preview.bg-transparent-black::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: black;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 2px;
}

.style-preview.bg-black {
    background: black;
}

.style-preview.bg-black::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 2px;
}

.style-preview.bg-transparent-white {
    background: transparent;
    border-style: dashed;
    border-color: #9ca3af;
}

.style-preview.bg-transparent-white::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border: 1px solid #d1d5db;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 2px;
}

.style-text {
    font-size: 12px;
    color: #6b7280;
    text-align: center;
    font-weight: 500;
}

/* Upload de logo */
.logo-upload {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.file-input {
    display: none;
}

.file-label {
    display: inline-block;
    padding: 8px 16px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    color: #374151;
}

.file-label:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.remove-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.remove-btn:hover {
    background: #dc2626;
}

.logo-preview {
    margin-top: 12px;
    text-align: center;
}

.logo-preview img {
    max-width: 80px;
    max-height: 80px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.logo-note {
    font-size: 12px;
    color: #6b7280;
    margin-top: 8px;
    font-style: italic;
}

/* Section promo */
.promo-section {
    margin-top: 16px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.promo-controls {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.promo-btn {
    background: #16a34a;
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.promo-btn:hover {
    background: #15803d;
}

.promo-hint {
    font-size: 12px;
    color: #6b7280;
    font-style: italic;
    margin-top: 8px;
}

/* Boutons */
.generate-btn {
    width: 100%;
    background: #3b82f6;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.generate-btn:hover:not(:disabled) {
    background: #2563eb;
}

.generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Section résultat */
.result-section {
    margin-top: 32px;
    text-align: center;
}

.qr-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.qr-image {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.download-btn {
    background: #16a34a;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.download-btn:hover {
    background: #15803d;
}

/* ✅ MESSAGES D'ERREUR ET SUCCÈS */
#loading {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
    text-align: center;
    color: #92400e;
    font-weight: 500;
}

#error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #ef4444;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 16px 0;
    text-align: center;
}

#success {
    background: #ecfdf5;
    color: #166534;
    border: 1px solid #16a34a;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 16px 0;
    text-align: center;
}

/* ✅ MESSAGES UTILISATEUR CORRIGÉS */
.user-messages {
    margin-top: 24px;
}

.limit-message {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
}

.upgrade-options {
    margin-top: 12px;
}

.buy-link {
    display: inline-block;
    background: #3b82f6;
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    margin: 4px 0;
    transition: background-color 0.2s;
}

.buy-link:hover {
    background: #2563eb;
    text-decoration: none;
}

.premium-message {
    background: #ecfdf5;
    border: 1px solid #16a34a;
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
}

.promo-message {
    margin: 16px 0;
}

.success-message {
    background: #ecfdf5;
    color: #166534;
    border: 1px solid #16a34a;
    border-radius: 8px;
    padding: 12px 16px;
    text-align: center;
}

.error-message {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #ef4444;
    border-radius: 8px;
    padding: 12px 16px;
    text-align: center;
}

/* ✅ BOUTON TOGGLE POUR INFORMATIONS SEO */
.seo-toggle {
    margin: 32px 0 16px 0;
    text-align: center;
}

.info-toggle-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.info-toggle-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1e3a8a 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.info-toggle-btn.expanded {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.info-toggle-btn.expanded:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.toggle-arrow {
    transition: transform 0.2s;
    font-size: 12px;
}

.info-toggle-btn.expanded .toggle-arrow {
    transform: rotate(180deg);
}

/* ✅ CONTENU SEO PLIABLE */
.seo-content {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin: 16px 0;
    transition: all 0.3s ease;
}

.seo-section {
    margin-bottom: 24px;
}

.seo-section:last-child {
    margin-bottom: 0;
}

.seo-section h2 {
    color: #1e293b;
    font-size: 22px;
    margin-bottom: 12px;
}

.seo-section h3 {
    color: #374151;
    font-size: 18px;
    margin-bottom: 12px;
}

.seo-section p {
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 12px;
}

.seo-section ul {
    list-style: none;
    padding: 0;
}

.seo-section li {
    color: #374151;
    margin-bottom: 8px;
    padding-left: 0;
}

/* ✅ GRILLE DES AVANTAGES */
.advantages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.advantage-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    transition: all 0.2s;
}

.advantage-item:hover {
    border-color: #3b82f6;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

.advantage-item strong {
    display: block;
    color: #1e293b;
    font-size: 14px;
    margin-bottom: 8px;
}

.advantage-item span {
    color: #6b7280;
    font-size: 12px;
}

/* ✅ FAQ SECTION */
.faq-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.faq-item strong {
    display: block;
    color: #1e293b;
    font-size: 14px;
    margin-bottom: 8px;
}

.faq-item p {
    color: #6b7280;
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
}

.faq-item + a {
    display: inline-block;
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
    margin-top: 12px;
    transition: color 0.2s;
}

.faq-item + a:hover {
    color: #2563eb;
    text-decoration: underline;
}

/* ✅ NOTIFICATIONS */
.notifications {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.notification {
    background: white;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 300px;
}

.notification-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
}

.notification-close:hover {
    color: #6b7280;
}

/* ✅ FOOTER */
.footer {
    background: #1e293b;
    color: white;
    width: 100%;
    margin-top: 40px;
    padding: 20px 0;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
}

.footer-content p {
    color: #9ca3af;
    font-size: 13px;
    margin-bottom: 8px;
}

.footer-content p:last-child {
    margin-bottom: 0;
}

/* ✅ ANIMATIONS */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLang {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.language-switching {
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.language-switched {
    animation: fadeInLang 0.4s ease-out;
}

/* ✅ SUPPORT DES POLICES JAPONAISES */
[lang="ja"], .lang-ja {
    font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
    line-height: 1.7;
    letter-spacing: 0.5px;
}

.lang-ja h1, .lang-ja h2, .lang-ja h3 {
    font-weight: 500;
    letter-spacing: 1px;
}

.lang-ja .btn {
    letter-spacing: 0.5px;
    font-weight: 500;
}

.lang-ja label {
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* ✅ RESPONSIVE DESIGN */
@media (max-width: 768px) {
    body {
        padding: 15px;
    }
    
    .container { 
        padding: 24px; 
    }
    
    .language-selector {
        gap: 8px;
        margin-bottom: 20px;
    }
    
    .lang-flag {
        width: 28px;
        height: 21px;
    }
    
    .lang-flag svg {
        width: 18px;
        height: 13px;
    }
    
    .style-options { 
        grid-template-columns: 1fr;
        gap: 8px; 
    }
    
    .promo-controls {
        flex-direction: column;
    }
    
    .notifications {
        right: 10px;
        left: 10px;
    }
    
    .notification {
        min-width: auto;
    }
    
    .advantages-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    h1 {
        font-size: 24px;
    }

    h2 {
        font-size: 20px;
    }

    h3 {
        font-size: 18px;
    }
    
    .seo-content {
        padding: 16px;
    }
    
    .info-toggle-btn {
        padding: 10px 20px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .language-selector {
        gap: 6px;
    }
    
    .lang-flag {
        width: 24px;
        height: 18px;
    }
    
    .lang-flag svg {
        width: 16px;
        height: 12px;
    }
    
    .container {
        padding: 20px;
    }
    
    .advantages-grid {
        grid-template-columns: 1fr;
    }
    
    .advantage-item {
        padding: 12px;
    }
}

/* ✅ SUPPORT MOUVEMENT RÉDUIT (ACCESSIBILITÉ) */
@media (prefers-reduced-motion: reduce) {
    .lang-flag,
    .language-switching,
    .language-switched,
    .info-toggle-btn,
    .advantage-item {
        transition: none;
        animation: none;
        transform: none;
    }
}

/* ✅ MODE SOMBRE (SI PRÉFÉRÉ PAR L'UTILISATEUR) */
@media (prefers-color-scheme: dark) {
    /* Le mode sombre peut être ajouté ici si nécessaire */
}

/* ✅ FOCUS VISIBLE POUR L'ACCESSIBILITÉ */
.generate-btn:focus-visible,
.download-btn:focus-visible,
.promo-btn:focus-visible,
.info-toggle-btn:focus-visible,
.file-label:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* ✅ AMÉLIORATION DES CONTRASTES POUR L'ACCESSIBILITÉ */
.style-text {
    color: #4b5563; /* Contraste amélioré */
}

.logo-note,
.promo-hint,
.size-description {
    color: #6b7280; /* Contraste amélioré */
}

/* ✅ ÉTATS DE CHARGEMENT AMÉLIORÉS */
.generate-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.generate-btn.loading {
    position: relative;
    color: transparent;
}

.generate-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ✅ CORRECTION POUR LES RADIOS CACHÉS */
.style-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* ✅ AMÉLIORATION DES MESSAGES D'ÉTAT */
.user-status.free {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-color: #0ea5e9;
}

.user-status.paid-active {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-color: #10b981;
}

.user-status.promo-active {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-color: #f59e0b;
}

.user-status.regeneration-active {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    border-color: #0ea5e9;
}

.user-status.limit-reached {
    background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
    border-color: #ef4444;
}