/**
 * CSS du Module Sélecteur de Pièces Détachées
 * Design adapté au template Vercel - Meilleur Poêle
 */

.mp-sparepart-container {
    margin: 0 auto;
    padding: 0 15px;
}

.mp-sparepart-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    padding: 24px;
    font-family: 'Inter', sans-serif;
    padding-bottom: 50px;
}

.mp-sparepart-title {
    font-size: 1.5rem; /* text-2xl */
    font-weight: 700; /* font-bold */
    text-align: center; /* text-center */
    margin-bottom: 2rem; /* mb-8 */
    line-height: 1.25;
    color: #1f2937; /* dark gray for modern look */
}

/* Responsive - md:text-3xl */
@media (min-width: 768px) {
    .mp-sparepart-title {
        font-size: 1.875rem; /* text-3xl */
    }
}

.mp-sparepart-form {
    max-width: 100%;
}

.mp-sparepart-selectors {
    display: flex;
    flex-direction: column;
    gap: 16px;
    /* Box shadow Vercel appliqué */
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    padding: 24px;
    /* Centrage avec largeur automatique */
    width: fit-content;
    margin: 0 auto;
}

/* Responsive layout - horizontal sur md+ */
@media (min-width: 768px) {
    .mp-sparepart-selectors {
        flex-direction: row;
        gap: 16px;
    }
}

.mp-selector-group {
    position: relative;
    width: 250px; /* TAILLE FIXE */
    min-width: 250px; /* TAILLE FIXE */
    max-width: 250px; /* TAILLE FIXE */
}

/* Style des boutons sélecteurs (comme Vercel) */
.mp-selector-button {
    display: flex;
    height: 40px; /* h-10 */
    align-items: center;
    justify-content: space-between;
    border-radius: 6px;
    border: 1px solid #d1d5db; /* border-input */
    background: white;
    padding: 8px 12px; /* px-3 py-2 */
    font-size: 14px; /* text-sm */
    width: 100%;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    /* Supprimer l'outline par défaut */
    outline: none;
}

.mp-selector-button:focus {
    outline: none;
    /* Optionnel: border focus plus discret */
    border-color: #9ca3af;
}

.mp-selector-button:focus:not(:disabled) {
    outline: none;
    border-color: #9ca3af;
}

.mp-selector-button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    background: #f9fafb;
    color: #6b7280;
    outline: none;
}

.mp-selector-text {
    pointer-events: none;
    line-height: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mp-selector-icon {
    height: 16px; /* h-4 */
    width: 16px; /* w-4 */
    opacity: 0.5;
    flex-shrink: 0;
}

/* Sélecteurs cachés COMPLÈTEMENT - PRIORITÉ ABSOLUE */
.mp-selector-hidden,
.mp-selector-hidden[size],
.mp-selector-hidden[size="1"],
.mp-selector-hidden[size="2"],
.mp-selector-hidden[size="3"],
.mp-selector-hidden[size="4"],
.mp-selector-hidden[size="5"],
.mp-selector-hidden[size="6"],
.mp-selector-hidden[size="7"],
.mp-selector-hidden[size="8"],
.mp-selector-hidden[size="9"],
.mp-selector-hidden[size="10"] {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    visibility: hidden !important;
    opacity: 0 !important;
    z-index: -9999 !important;
    display: none !important;
}

/* Dropdown personnalisé */
.mp-custom-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: max-content;
    min-width: 100%;
    max-height: 240px;
    padding: 4px 0;
    margin: 4px 0 0 0;
    overflow-y: auto;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    font-size: 14px;
    /* Pas de limite sur desktop */
}

.mp-dropdown-option {
    padding: 8px 12px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 32px;
    display: flex;
    align-items: center;
    transition: background-color 0.15s ease;
}

.mp-dropdown-option:hover {
    background: #f3f4f6;
}

/* Bouton de recherche - TAILLE ADAPTÉE */
.mp-search-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    border-radius: 6px;
    font-size: 14px; /* text-sm */
    font-weight: 500; /* font-medium */
    transition: all 0.2s ease;
    height: 40px; /* h-10 */
    padding: 8px 16px; /* px-4 py-2 */
    background: rgb(253, 72, 20); /* bg-orange-500 */
    color: white;
    border: none;
    cursor: pointer;
    flex-shrink: 0; /* Ne pas rétrécir */
    width: 140px; /* TAILLE FIXE POUR LE BOUTON */
    min-width: 140px;
    /* Supprimer l'outline par défaut */
    outline: none;
}

.mp-search-button:hover:not(:disabled) {
    background: rgb(224, 62, 0); /* hover:bg-orange-600 */
}

.mp-search-button:focus {
    outline: none;
    /* Focus plus discret pour le bouton orange */
    box-shadow: 0 0 0 2px rgba(253, 72, 20, 0.3);
}

.mp-search-button:disabled {
    pointer-events: none;
    opacity: 0.5;
    background: #6b7280;
    outline: none;
}

.mp-search-icon {
    margin-right: 8px;
    height: 16px; /* h-4 */
    width: 16px; /* w-4 */
    flex-shrink: 0;
}

/* Animation de chargement */
.mp-selector-button.loading .mp-selector-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Section référence */
.mp-ref-section {
    margin-top: 40px;
    text-align: center;
}

.mp-ref-title {
    font-size: 1.125rem; /* text-lg */
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0;
    text-align: center;
}

.mp-ref-selectors {
    justify-content: center;
    max-width: 600px;
    margin: 0 auto;
    /* Box shadow Vercel appliqué aussi à la section référence */
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    padding: 24px;
}

.mp-ref-selectors .mp-selector-group {
    width: 300px; /* TAILLE FIXE POUR LE CHAMP RÉFÉRENCE */
    min-width: 300px;
    max-width: 300px;
}

.mp-ref-input {
    display: flex;
    height: 40px; /* h-10 */
    align-items: center;
    border-radius: 6px;
    border: 1px solid #d1d5db; /* border-input */
    background: white;
    padding: 8px 12px; /* px-3 py-2 */
    font-size: 14px; /* text-sm */
    width: 100%;
    transition: all 0.2s ease;
    font-family: inherit;
    outline: none;
}

.mp-ref-input:focus {
    outline: none;
    /* Focus discret avec border */
    border-color: #9ca3af;
}

.mp-ref-input::placeholder {
    color: #6b7280; /* placeholder:text-muted-foreground */
}

/* Responsive */
@media (max-width: 767px) {
    .mp-sparepart-container {
        padding: 0 10px;
    }
    
    .mp-sparepart-content {
        padding: 20px 16px;
    }
    
    .mp-sparepart-title {
        font-size: 1.25rem;
        margin-bottom: 1.5rem;
    }
    
    .mp-ref-section {
        margin-top: 32px;
    }
    
    .mp-ref-title {
        font-size: 1rem;
        margin-bottom: 20px;
    }
    
    /* Sur mobile, tous les éléments prennent toute la largeur */
    .mp-selector-group {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
    }
    
    .mp-ref-selectors .mp-selector-group {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
    }
    
    #mp-sparepart-selector .mp-search-button {
        width: 100% !important;
        min-width: 100% !important;
    }
    
    .mp-sparepart-selectors {
        padding: 16px;
    }
    
    .mp-ref-selectors {
        padding: 16px;
    }
    
    /* Limite sur mobile pour les dropdowns */
    .mp-custom-dropdown {
        max-width: 350px;
    }
}

@media (max-width: 480px) {
    .mp-sparepart-content {
        padding: 16px 12px;
        border-radius: 6px;
    }
    
    .mp-sparepart-title {
        font-size: 1.125rem;
        margin-bottom: 1.25rem;
    }
    
    .mp-selector-button,
    .mp-search-button,
    .mp-ref-input {
        height: 36px;
        font-size: 13px;
    }
    
    .mp-sparepart-selectors {
        padding: 12px;
    }
    
    .mp-ref-selectors {
        padding: 12px;
    }
}

/* Animation d'apparition */
.mp-sparepart-container {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
} 