/* ============================================================ */
/* GPT-5 NANO TRANSFORMER V4 - STYLE ACCESSIBLE HARMONISÉ      */
/* ============================================================ */

/* Container principal */
.gpt5-container {
    max-width: 1200px;
    margin: 20px 0;
    padding: 20px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1a1a2e;
}

/* ============================================================ */
/* HEADER - Accessible                                           */
/* ============================================================ */

.gpt5-header {
    padding: 16px 20px;
    background: #f8fafc;
    border-radius: 8px 8px 0 0;
    border-bottom: 2px solid #e2e8f0;
    margin: -20px -20px 16px -20px;
    padding: 1.25rem 2rem;
}

.gpt5-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0 0 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gpt5-header p {
    font-size: 1rem;
    color: #475569;
    margin: 0 0 12px 0;
}

.gpt5-info {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.gpt5-info .badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    background: #f1f5f9;
    color: #1a1a2e;
    border: 1px solid #d1d5db;
    min-height: 32px;
}

.gpt5-info .badge-primary {
    background: #4f46e5;
    color: #ffffff;
    border-color: #4f46e5;
}

.gpt5-info .badge-success {
    background: #16a34a;
    color: #ffffff;
    border-color: #16a34a;
}

.gpt5-info .badge-warning {
    background: #d97706;
    color: #ffffff;
    border-color: #d97706;
}

.gpt5-info .badge-danger {
    background: #991b1b;
    color: #ffffff;
    border-color: #991b1b;
}

/* ============================================================ */
/* IMAGE SELECTOR - Accessible                                  */
/* ============================================================ */

.gpt5-image-selector {
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 16px;
}

.gpt5-selector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

.gpt5-selector-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a2e;
}

.gpt5-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
    padding: 4px;
}

.gpt5-selector-grid .gpt5-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #94a3b8;
}

/* Image items */
.gpt5-image-item {
    position: relative;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #f8fafc;
    aspect-ratio: 1;
}

.gpt5-image-item:hover {
    border-color: #4f46e5;
    transform: scale(1.02);
}

.gpt5-image-item:focus-visible {
    outline: 3px solid #4f46e5;
    outline-offset: 2px;
}

.gpt5-image-item.selected {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.3);
}

.gpt5-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gpt5-image-item .gpt5-image-check {
    position: absolute;
    top: 6px;
    right: 6px;
    background: #4f46e5;
    color: #ffffff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
}

.gpt5-image-item.selected .gpt5-image-check {
    display: flex;
}

.gpt5-image-item .gpt5-image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.75);
    color: #ffffff;
    padding: 4px 8px;
    font-size: 0.75rem;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gpt5-image-item:hover .gpt5-image-overlay {
    opacity: 1;
}

.gpt5-selected-info {
    margin-top: 10px;
    padding: 10px 16px;
    background: #f0fdf4;
    border-radius: 6px;
    border: 1px solid #86efac;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.gpt5-selected-info strong {
    color: #1a1a2e;
}

/* ============================================================ */
/* PREVIEW - Accessible                                         */
/* ============================================================ */

.gpt5-preview .gpt5-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 16px;
    background: #ffffff;
    padding: 16px 20px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
}

.gpt5-preview h4 {
    margin: 0 0 8px 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a1a2e;
}

.gpt5-preview img {
    max-width: 100%;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    max-height: 400px;
    object-fit: contain;
    background: #f8fafc;
}

.gpt5-preview .placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    background: #f8fafc;
    border-radius: 6px;
    border: 2px dashed #d1d5db;
    color: #94a3b8;
    padding: 20px;
    text-align: center;
}

.gpt5-preview .placeholder .hint {
    font-size: 0.85rem;
    margin-top: 8px;
    color: #94a3b8;
}

.gpt5-preview .placeholder .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #4f46e5;
    border-radius: 50%;
    animation: gpt5-spin 1s linear infinite;
    margin: 10px auto;
}

@keyframes gpt5-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================================ */
/* BOUTONS - Accessibles (WCAG 2.1 AA)                          */
/* ============================================================ */

.gpt5-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 20px;
    border: 2px solid transparent;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
    text-decoration: none;
    line-height: 1.2;
}

.gpt5-btn:focus-visible {
    outline: 3px solid #4f46e5;
    outline-offset: 3px;
}

.gpt5-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Primary */
.gpt5-btn-primary {
    background: #4f46e5;
    color: #ffffff;
    border-color: #4f46e5;
}

.gpt5-btn-primary:hover:not(:disabled) {
    background: #4338ca;
    border-color: #4338ca;
}

/* Secondary */
.gpt5-btn-secondary {
    background: #f1f5f9;
    color: #1a1a2e;
    border-color: #64748b;
}

.gpt5-btn-secondary:hover:not(:disabled) {
    background: #e2e8f0;
    border-color: #475569;
}

/* Success */
.gpt5-btn-success {
    background: #16a34a;
    color: #ffffff;
    border-color: #16a34a;
}

.gpt5-btn-success:hover:not(:disabled) {
    background: #15803d;
    border-color: #15803d;
}

/* Danger */
.gpt5-btn-danger {
    background: #fee2e2;
    color: #991b1b;
    border-color: #991b1b;
}

.gpt5-btn-danger:hover:not(:disabled) {
    background: #fecaca;
}

/* Info */
.gpt5-btn-info {
    background: #1e40af;
    color: #ffffff;
    border-color: #1e40af;
}

.gpt5-btn-info:hover:not(:disabled) {
    background: #1e3a8a;
    border-color: #1e3a8a;
}

/* Sizes */
.gpt5-btn-large {
    padding: 12px 32px;
    font-size: 1.05rem;
}

.gpt5-btn-sm {
    padding: 4px 14px;
    font-size: 0.85rem;
    min-height: 34px;
}

/* ============================================================ */
/* CONTROLS - Accessible                                        */
/* ============================================================ */

.gpt5-controls {
    margin-top: 16px;
}

.gpt5-option {
    margin-bottom: 16px;
    padding: 16px 20px;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #d1d5db;
}

.gpt5-option h4 {
    margin: 0 0 4px 0;
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a2e;
}

.gpt5-option .description {
    margin: 0 0 12px 0;
    color: #475569;
    font-size: 0.9rem;
}

/* Mode buttons */
.gpt5-mode-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.gpt5-mode-btn {
    padding: 12px 16px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    min-height: 60px;
}

.gpt5-mode-btn:hover {
    border-color: #4f46e5;
    transform: translateY(-2px);
}

.gpt5-mode-btn:focus-visible {
    outline: 3px solid #4f46e5;
    outline-offset: 2px;
}

.gpt5-mode-btn.active {
    border-color: #4f46e5;
    background: #eef2ff;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.gpt5-mode-btn .mode-label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: #1a1a2e;
}

.gpt5-mode-btn .mode-desc {
    display: block;
    font-size: 0.8rem;
    color: #475569;
    margin-top: 4px;
}

/* ============================================================ */
/* LEVEL SLIDER - Accessible                                    */
/* ============================================================ */

.gpt5-level-slider {
    padding: 8px 0 4px 0;
}

.gpt5-level-slider input[type="range"] {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #a0aec0, #48bb78, #ecc94b, #fc8181);
    outline: none;
    cursor: pointer;
}

.gpt5-level-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4f46e5;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.gpt5-level-slider input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4f46e5;
    cursor: pointer;
    border: 2px solid #ffffff;
}

.gpt5-level-slider input[type="range"]:focus-visible {
    outline: 3px solid #4f46e5;
    outline-offset: 2px;
}

.gpt5-level-slider input[type="range"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.gpt5-level-markers {
    display: flex;
    justify-content: space-between;
    padding: 3px 0 0 0;
    font-size: 0.75rem;
    color: #94a3b8;
}

.gpt5-level-detail {
    margin-top: 6px;
    font-size: 0.85rem;
    color: #475569;
}

/* ============================================================ */
/* TOGGLE SWITCH - Accessible                                   */
/* ============================================================ */

.gpt5-custom-toggle {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.gpt5-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
}

.gpt5-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.gpt5-switch input:focus-visible + .gpt5-slider {
    outline: 3px solid #4f46e5;
    outline-offset: 2px;
}

.gpt5-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #94a3b8;
    border-radius: 34px;
    transition: 0.3s ease;
}

.gpt5-slider:before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background: #ffffff;
    border-radius: 50%;
    transition: 0.3s ease;
}

.gpt5-switch input:checked + .gpt5-slider {
    background: #4f46e5;
}

.gpt5-switch input:checked + .gpt5-slider:before {
    transform: translateX(24px);
}

.gpt5-toggle-label {
    font-weight: 600;
    font-size: 0.95rem;
    color: #1a1a2e;
}

.gpt5-toggle-desc {
    font-size: 0.85rem;
    color: #475569;
}

/* ============================================================ */
/* CUSTOM SECTION - Accessible                                  */
/* ============================================================ */

.gpt5-custom-section {
    border-left: 4px solid #4f46e5 !important;
    background: #f8fafc !important;
}

.gpt5-custom-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

.gpt5-elements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 6px;
    max-height: 250px;
    overflow-y: auto;
    padding: 10px;
    background: #ffffff;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    margin: 10px 0;
}

.gpt5-element-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: #ffffff;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
    cursor: default;
}

.gpt5-element-item:hover {
    border-color: #4f46e5;
}

.gpt5-element-item.selected {
    border-color: #16a34a;
    background: #f0fdf4;
}

.gpt5-element-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: #4f46e5;
}

.gpt5-element-item input[type="checkbox"]:focus-visible {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

.gpt5-element-item .elem-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: #1a1a2e;
}

.gpt5-element-item .elem-category {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-left: 4px;
}

.gpt5-element-item .elem-position {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-left: 4px;
}

.gpt5-custom-summary {
    padding: 8px 14px;
    background: #f0fdf4;
    border-radius: 6px;
    border: 1px solid #86efac;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 8px;
}

.gpt5-custom-summary .gpt5-removed-count {
    color: #991b1b;
}

/* ============================================================ */
/* ANALYSIS BOX - Accessible                                    */
/* ============================================================ */

.gpt5-analysis-box {
    margin-top: 16px;
    padding: 16px 20px;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 4px solid #4f46e5;
    border: 1px solid #d1d5db;
}

.gpt5-analysis-box h4 {
    margin: 0 0 8px 0;
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a2e;
}

.gpt5-analysis-content {
    max-height: 300px;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.7;
    white-space: pre-wrap;
    background: #ffffff;
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    color: #1a1a2e;
}

/* ============================================================ */
/* RESULT BOX - Accessible                                      */
/* ============================================================ */

.gpt5-result-box {
    margin-top: 16px;
    padding: 16px 20px;
    background: #f0fdf4;
    border-radius: 8px;
    border-left: 4px solid #16a34a;
    border: 1px solid #86efac;
}

.gpt5-result-message {
    font-weight: 500;
    color: #1a1a2e;
}

.gpt5-result-meta {
    font-size: 0.85rem;
    color: #475569;
    margin-top: 4px;
}

/* ============================================================ */
/* PROGRESS BAR - Accessible                                    */
/* ============================================================ */

.gpt5-progress {
    margin-top: 16px;
    padding: 14px 18px;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #d1d5db;
}

.gpt5-progress .gpt5-progress-bar {
    height: 8px;
    background: #4f46e5;
    border-radius: 4px;
    width: 0%;
    transition: width 0.5s ease;
}

.gpt5-progress .gpt5-progress-text {
    display: block;
    text-align: center;
    margin-top: 6px;
    font-size: 0.85rem;
    color: #475569;
}

/* ============================================================ */
/* ACTIONS BAR - Accessible                                     */
/* ============================================================ */

.gpt5-actions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 16px 0;
}

/* ============================================================ */
/* RESPONSIVE - Accessible                                      */
/* ============================================================ */

@media (max-width: 768px) {
    .gpt5-container {
        padding: 12px;
    }
    
    .gpt5-header {
        margin: -12px -12px 12px -12px;
        padding: 1rem 1.25rem;
    }
    
    .gpt5-preview .gpt5-grid {
        grid-template-columns: 1fr;
        padding: 12px 14px;
    }
    
    .gpt5-selector-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
    
    .gpt5-mode-buttons {
        grid-template-columns: 1fr 1fr;
    }
    
    .gpt5-elements-grid {
        grid-template-columns: 1fr;
    }
    
    .gpt5-option {
        padding: 12px 14px;
    }
    
    .gpt5-custom-toggle {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .gpt5-actions-bar {
        flex-direction: column;
    }
    
    .gpt5-actions-bar .gpt5-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .gpt5-container {
        padding: 10px;
    }
    
    .gpt5-header {
        margin: -10px -10px 10px -10px;
        padding: 0.75rem 1rem;
    }
    
    .gpt5-header h2 {
        font-size: 1.1rem;
    }
    
    .gpt5-mode-buttons {
        grid-template-columns: 1fr;
    }
    
    .gpt5-preview .gpt5-grid {
        padding: 10px;
    }
    
    .gpt5-image-item {
        aspect-ratio: 1;
    }
}

/* ============================================================ */
/* IMPRESSION - Accessible                                      */
/* ============================================================ */

@media print {
    .gpt5-container {
        border: 1px solid #000;
        background: #fff;
    }
    
    .gpt5-btn {
        border: 1px solid #000;
        background: #fff !important;
        color: #000 !important;
    }
    
    .gpt5-analysis-box {
        border: 1px solid #000;
    }
    
    .gpt5-result-box {
        border: 1px solid #000;
    }
}

/* ============================================================ */
/* RÉDUCTION DE MOUVEMENT - Accessible                          */
/* ============================================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .gpt5-preview .placeholder .spinner {
        animation: none;
        border-top-color: #4f46e5;
    }
}

/* ============================================================ */
/* CONTRAST ÉLEVÉ - Accessible                                  */
/* ============================================================ */

@media (prefers-contrast: high) {
    .gpt5-container {
        border-width: 2px;
        border-color: #000;
    }
    
    .gpt5-btn {
        border-width: 2px;
    }
    
    .gpt5-btn-primary {
        background: #000;
        color: #fff;
        border-color: #000;
    }
    
    .gpt5-btn-secondary {
        background: #fff;
        color: #000;
        border-color: #000;
    }
    
    .gpt5-mode-btn {
        border-width: 2px;
        border-color: #000;
    }
    
    .gpt5-mode-btn.active {
        border-color: #000;
        background: #eef2ff;
    }
    
    .gpt5-image-item {
        border-width: 2px;
        border-color: #000;
    }
    
    .gpt5-image-item.selected {
        border-color: #000;
    }
    
    .gpt5-switch input:checked + .gpt5-slider {
        background: #000;
    }
}