/* Generateur QR Code, styles propres a l'outil.
   DA ToolBox : fond degrade violet, conteneur blanc arrondi, cards. */

/* L'attribut hidden doit gagner sur tout display pose par une classe
   (le script masque des elements via el.hidden). */
[hidden] {
    display: none !important;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1100px;
    margin: 20px auto;
    padding: 20px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.tool-content {
    padding: 20px 0;
}

.tool-intro {
    color: #3d4852;
    font-size: 1.05em;
    line-height: 1.6;
    max-width: 60em;
    margin: 0 0 25px;
}

/* Disposition outil : options a gauche, apercu a droite */
.tool-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

/* Cards */
.card {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
}

.card h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2em;
    font-weight: 600;
}

.card h3 i {
    color: #764ba2;
}

/* Formulaires */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #2c3e50;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ced4da;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #f8f9fa;
    transition: border-color 0.2s ease, background 0.2s ease;
}

textarea.form-control {
    resize: vertical;
    min-height: 90px;
}

.form-control:focus {
    border-color: #764ba2;
    background: white;
    outline: 2px solid #764ba2;
    outline-offset: 1px;
}

.color-control {
    padding: 4px;
    height: 46px;
    cursor: pointer;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 15px;
}

.input-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-top: 6px;
}

.field-hint {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.5;
    color: #495057;
}

.input-meta .field-hint {
    margin-top: 0;
}

.char-count {
    font-size: 13px;
    color: #495057;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Apercu */
.qr-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 20px;
    min-height: 260px;
}

.qr-preview svg {
    width: 100%;
    max-width: 300px;
    height: auto;
    display: block;
}

.qr-placeholder {
    color: #495057;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.qr-info {
    margin-top: 10px;
    font-size: 13px;
    color: #495057;
    text-align: center;
    min-height: 1.2em;
}

/* Boutons d'export */
.export-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn.btn-primary {
    background: linear-gradient(145deg, #764ba2, #5b3a7e);
}

.btn.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(118, 75, 162, 0.35);
}

.btn.btn-secondary {
    background: linear-gradient(145deg, #5a6268, #495057);
}

.btn.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(90, 98, 104, 0.35);
}

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

.btn:disabled {
    background: #adb5bd;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn:focus-visible,
.form-control:focus-visible {
    outline: 2px solid #2c3e50;
    outline-offset: 2px;
}

.copy-status {
    margin-top: 8px;
    font-size: 13px;
    color: #1e7e34;
    min-height: 1.2em;
}

.privacy-note {
    margin-top: 15px;
    padding: 10px 12px;
    background: #f0ebf7;
    border-radius: 8px;
    font-size: 13px;
    color: #4a3268;
}

.privacy-note i {
    margin-right: 6px;
}

/* Messages */
.warning-box {
    background: #fff3cd;
    border: 1px solid #ffe69c;
    border-radius: 8px;
    color: #664d03;
    padding: 12px 15px;
    margin-bottom: 15px;
    font-size: 14px;
    line-height: 1.5;
}

.error-box {
    background: #f8d7da;
    border: 1px solid #f1aeb5;
    border-radius: 8px;
    color: #58151c;
    padding: 12px 15px;
    margin-bottom: 15px;
    font-size: 14px;
    line-height: 1.5;
}

/* Contenu editorial */
.seo-content {
    margin-top: 40px;
}

.seo-content h2 {
    color: #2c3e50;
    font-size: 1.35em;
    font-weight: 600;
    margin: 35px 0 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.seo-content h2 i {
    color: #764ba2;
    font-size: 0.9em;
}

.seo-content p {
    color: #3d4852;
    line-height: 1.7;
    margin-bottom: 12px;
    max-width: 70em;
}

.tips-list {
    margin: 0 0 12px 20px;
    color: #3d4852;
    line-height: 1.7;
}

.tips-list li {
    margin-bottom: 10px;
}

/* Tableau des niveaux de correction */
.table-wrap {
    overflow-x: auto;
    margin-bottom: 15px;
}

.levels-table {
    width: 100%;
    min-width: 480px;
    border-collapse: collapse;
    font-size: 14px;
}

.levels-table th,
.levels-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
    color: #3d4852;
    line-height: 1.5;
}

.levels-table thead th {
    background: #764ba2;
    color: white;
    font-weight: 600;
}

.levels-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

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

/* FAQ */
.faq-item {
    margin-bottom: 20px;
}

.faq-item h3 {
    color: #2c3e50;
    font-size: 1.05em;
    font-weight: 600;
    margin-bottom: 6px;
}

.faq-item p {
    color: #3d4852;
    line-height: 1.7;
    max-width: 70em;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        margin: 10px;
        padding: 15px;
        border-radius: 10px;
    }

    .tool-layout {
        grid-template-columns: 1fr;
    }

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

    .export-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .export-actions .btn {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .card {
        padding: 15px;
    }

    .btn {
        padding: 10px 15px;
        font-size: 13px;
    }

    .form-control {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* Impression : on ne garde que l'essentiel */
@media print {
    body {
        background: white;
    }

    .container {
        box-shadow: none;
        margin: 0;
    }

    .export-actions,
    .copy-status {
        display: none;
    }
}
