/**
 * GPT-5 Nano Transformer V4 - Styles CSS
 * Version: 15.4.6
 */

/* ============================================
   CONTAINER
   ============================================ */
.gpt5-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.gpt5-header {
    margin-bottom: 24px;
}

.gpt5-header h2 {
    margin: 0 0 8px 0;
    font-size: 24px;
}

.gpt5-header p {
    margin: 0 0 12px 0;
    color: #64748b;
}

.gpt5-info {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    align-items: center;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-primary { background: #dbeafe; color: #1e40af; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #e0e7ff; color: #3730a3; }
.badge-warning { background: #fef3c7; color: #92400e; }

/* Badges spécifiques pour le header */
#gpt5-badge-cost {
    background: #fef3c7;
    color: #92400e;
}

#gpt5-badge-balance {
    background: #e0f2fe;
    color: #075985;
}

/* ============================================
   SÉLECTEUR D'IMAGES
   ============================================ */
.gpt5-image-selector {
    margin-bottom: 24px;
    padding: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.gpt5-selector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.gpt5-selector-header h3 {
    margin: 0;
    font-size: 16px;
}

.gpt5-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.gpt5-image-item {
    position: relative;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 6px;
    overflow: hidden;
    transition: all 0.2s;
    aspect-ratio: 1;
    background: #fff;
}

.gpt5-image-item:hover {
    border-color: #94a3b8;
    transform: scale(1.02);
}

.gpt5-image-item.selected {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.gpt5-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gpt5-image-check {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    background: #4f46e5;
    color: #fff;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.gpt5-image-item.selected .gpt5-image-check {
    display: flex;
}

.gpt5-image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 11px;
    padding: 4px 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gpt5-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 30px;
    color: #64748b;
}

.gpt5-selected-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding: 10px 14px;
    background: #dcfce7;
    border: 1px solid #86efac;
    border-radius: 6px;
}

/* ============================================
   PREVIEW
   ============================================ */
.gpt5-preview {
    margin-bottom: 24px;
}

.gpt5-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.gpt5-original,
.gpt5-result {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
}

.gpt5-original h4,
.gpt5-result h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #475569;
}

.gpt5-original img,
.gpt5-result img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}

.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: #94a3b8;
    font-size: 14px;
    background: #f8fafc;
    border: 2px dashed #e2e8f0;
    border-radius: 6px;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #e2e8f0;
    border-top-color: #4f46e5;
    border-radius: 50%;
    animation: gpt5-spin 0.8s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes gpt5-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .gpt5-grid { grid-template-columns: 1fr; }
}

/* ============================================
   CONTRÔLES
   ============================================ */
.gpt5-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.gpt5-option {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
}

.gpt5-option h4 {
    margin: 0 0 8px 0;
    font-size: 15px;
    color: #1e293b;
}

.gpt5-option .description {
    margin: 0 0 12px 0;
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
}

/* ============================================
   ✅ v15.4.6 : PROFILS (Image + SVG)
   ============================================ */
.gpt5-profile-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.gpt5-profile-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
    font: inherit;
    color: inherit;
    width: 100%;
    height: 100%;
}

.gpt5-profile-btn:hover {
    border-color: #4f46e5;
}

.gpt5-profile-btn.active {
    border-color: #4f46e5;
    background: #eef2ff;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.gpt5-profile-btn .profile-label {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.gpt5-profile-btn .profile-desc {
    display: block;
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.4;
    margin-bottom: 8px;
}

.gpt5-profile-btn .profile-cost {
    display: block;
    font-size: 0.75rem;
    color: #4f46e5;
    font-weight: 600;
    margin-top: auto; /* Pousse le coût tout en bas du bouton */
    background: #e0e7ff;
    padding: 2px 8px;
    border-radius: 12px;
}

@media (max-width: 600px) {
    .gpt5-profile-buttons { grid-template-columns: 1fr; }
}

/* ============================================
   BOUTONS DE TYPE DE SORTIE
   ============================================ */
.gpt5-output-type-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

.gpt5-output-type-btn {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    position: relative;
    font-family: inherit;
}

.gpt5-output-type-btn:hover {
    border-color: #4f46e5;
    background: #f8f9ff;
    transform: translateY(-1px);
}

.gpt5-output-type-btn.active {
    border-color: #4f46e5;
    background: #eef2ff;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.gpt5-output-type-btn .output-type-icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
}

.gpt5-output-type-btn .output-type-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.gpt5-output-type-btn .output-type-label {
    font-weight: 700;
    font-size: 15px;
    color: #1a202c;
}

.gpt5-output-type-btn .output-type-desc {
    font-size: 12px;
    color: #64748b;
    line-height: 1.4;
}

.gpt5-output-type-btn .output-type-badge {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 8px;
    background: #fef3c7;
    color: #92400e;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    align-self: flex-start;
}

@media (max-width: 600px) {
    .gpt5-output-type-buttons { grid-template-columns: 1fr; }
}

/* ============================================
   MODES DE TRANSFORMATION
   ============================================ */
.gpt5-mode-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.gpt5-mode-btn {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    font-family: inherit;
}

.gpt5-mode-btn:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.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 {
    font-weight: 600;
    font-size: 14px;
    color: #1e293b;
}

.gpt5-mode-btn .mode-desc {
    font-size: 12px;
    color: #64748b;
    line-height: 1.4;
}

/* ============================================
   SWITCH SIMPLIFICATION PERSONNALISÉE
   ============================================ */
.gpt5-custom-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 0;
}

.gpt5-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.gpt5-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.gpt5-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1;
    transition: 0.3s;
    border-radius: 24px;
}

.gpt5-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.gpt5-switch input:checked + .gpt5-slider {
    background-color: #4f46e5;
}

.gpt5-switch input:checked + .gpt5-slider:before {
    transform: translateX(20px);
}

.gpt5-toggle-label {
    font-weight: 600;
    font-size: 14px;
    color: #1e293b;
}

.gpt5-toggle-desc {
    font-size: 13px;
    color: #64748b;
}

/* ============================================
   SECTION PERSONNALISÉE
   ============================================ */
.gpt5-custom-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.gpt5-elements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.gpt5-element-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.gpt5-element-item:hover {
    border-color: #94a3b8;
}

.gpt5-element-item.selected {
    background: #eef2ff;
    border-color: #4f46e5;
}

.gpt5-element-item input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.gpt5-element-item .elem-name {
    flex: 1;
    font-weight: 500;
    color: #1e293b;
}

.gpt5-element-item .elem-category {
    font-size: 11px;
    padding: 2px 6px;
    background: #f1f5f9;
    border-radius: 4px;
    color: #475569;
}

.gpt5-element-item .elem-position {
    font-size: 11px;
    color: #64748b;
}

.gpt5-custom-summary {
    margin-top: 12px;
    padding: 10px 14px;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 6px;
    font-size: 13px;
    display: flex;
    gap: 20px;
}

.gpt5-removed-count {
    color: #dc2626;
}

/* ============================================
   SLIDER DE NIVEAU
   ============================================ */
.gpt5-level-slider {
    position: relative;
    margin: 16px 0 8px 0;
}

.gpt5-level-slider input[type="range"] {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    background: linear-gradient(to right, #94a3b8, #48bb78, #68d391, #ecc94b, #ed8936, #fc8181);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.gpt5-level-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    background: #fff;
    border: 3px solid #4f46e5;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.gpt5-level-slider input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
    background: #fff;
    border: 3px solid #4f46e5;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.gpt5-level-markers {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 11px;
    color: #64748b;
}

.gpt5-level-detail {
    margin-top: 8px;
    font-size: 13px;
    color: #475569;
    font-weight: 500;
}

/* ============================================
   BARRE D'ACTIONS
   ============================================ */
.gpt5-actions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.gpt5-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    text-decoration: none;
}

.gpt5-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.gpt5-btn-primary { background: #4f46e5; color: #fff; }
.gpt5-btn-primary:hover:not(:disabled) { background: #4338ca; }

.gpt5-btn-secondary { background: #f1f5f9; color: #1e293b; border: 1px solid #e2e8f0; }
.gpt5-btn-secondary:hover:not(:disabled) { background: #e2e8f0; }

.gpt5-btn-success { background: #10b981; color: #fff; }
.gpt5-btn-success:hover:not(:disabled) { background: #059669; }

.gpt5-btn-info { background: #0ea5e9; color: #fff; }
.gpt5-btn-info:hover:not(:disabled) { background: #0284c7; }

.gpt5-btn-danger { background: #ef4444; color: #fff; }
.gpt5-btn-danger:hover:not(:disabled) { background: #dc2626; }

.gpt5-btn-large {
    padding: 12px 24px;
    font-size: 15px;
}

.gpt5-btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* ============================================
   RÉSULTAT
   ============================================ */
.gpt5-analysis-box,
.gpt5-result-box {
    padding: 14px 18px;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    margin-top: 12px;
}

.gpt5-result-box {
    background: #eef2ff;
    border-color: #c7d2fe;
}

.gpt5-analysis-content {
    font-size: 13px;
    color: #334155;
    white-space: pre-wrap;
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    background: #fff;
    border-radius: 4px;
    margin-top: 8px;
}

.gpt5-result-message {
    font-weight: 600;
    color: #065f46;
}

.gpt5-result-meta {
    font-size: 13px;
    color: #475569;
    margin-top: 6px;
}

/* ============================================
   BARRE DE PROGRESSION
   ============================================ */
.gpt5-progress {
    position: relative;
    height: 28px;
    background: #f1f5f9;
    border-radius: 14px;
    overflow: hidden;
    margin-top: 12px;
}

.gpt5-progress-bar {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    background: linear-gradient(90deg, #4f46e5, #7c3aed);
    transition: width 0.4s ease;
}

.gpt5-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
    z-index: 1;
    white-space: nowrap;
}

/* ============================================
   SVG INSÉRÉ DANS L'ÉDITEUR
   ============================================ */
.gpt5-transformed.gpt5-svg {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 10px auto;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 8px;
}