/* Style du formulaire */
.fairy-tale-generator {
    max-width: 600px;
    margin: 2rem auto;
    padding: 2rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.fairy-tale-generator a {
	color: #fff;
	font-weight: bold;
}

form#fairy-tale-form .form-group {
    display: inline-block;
    width: 49%;
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #333;
    position: relative;
}

/* Icône d'aide */
.ftg-help-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    background: #4a90e2;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    cursor: help;
    margin-left: 6px;
    position: relative;
    vertical-align: middle;
    transition: background 0.2s ease;
}

.ftg-help-icon:hover {
    background: #357abd;
}

/* Tooltip au clic */
.ftg-help-icon::after {
    content: attr(data-help);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: normal;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.ftg-help-icon::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(0px);
    border: 6px solid transparent;
    border-top-color: #333;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 1000;
}

.ftg-help-icon.active::after,
.ftg-help-icon.active::before {
    opacity: 1;
    transform: translateX(-50%) translateY(-8px);
}

.ftg-help-icon.active::before {
    transform: translateX(-50%) translateY(-2px);
}

.form-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

/* Styles pour les select multiple custom (personnages secondaires et méchants) */
.ftg-multiselect {
    position: relative;
    width: 100%;
}

.ftg-multiselect-toggle {
    width: 100%;
    padding: 0.0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color 0.2s ease;
}

.ftg-multiselect-toggle:hover {
    border-color: #4a90e2;
}

.ftg-multiselect-toggle:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.1);
}

.ftg-multiselect-label {
    flex: 1;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0.5rem;
}

.ftg-multiselect-label.placeholder {
    color: #999;
}

.ftg-multiselect-arrow {
    color: #666;
    font-size: 0.8rem;
    margin: 0.5rem;
    transition: transform 0.2s ease;
}

.ftg-multiselect.open .ftg-multiselect-arrow {
    transform: rotate(180deg);
}

.ftg-multiselect-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 2px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.ftg-multiselect.open .ftg-multiselect-dropdown {
    display: block;
}

.ftg-multiselect-dropdown label {
    display: flex;
    align-items: center;
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
    border-bottom: 1px solid #f0f0f0;
    margin: 0;
    font-weight: normal;
}

.ftg-multiselect-dropdown label:last-child {
    border-bottom: none;
}

.ftg-multiselect-dropdown label:hover {
    background-color: #f5f8fc;
}

.ftg-multiselect-dropdown input[type="checkbox"] {
    margin: 0 0.5rem 0 0;
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #4a90e2;
}

.ftg-multiselect-dropdown label input[type="checkbox"]:checked + span {
    font-weight: 600;
    color: #4a90e2;
}

/* Ajustement scrollbar pour le dropdown */
.ftg-multiselect-dropdown::-webkit-scrollbar {
    width: 8px;
}

.ftg-multiselect-dropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.ftg-multiselect-dropdown::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.ftg-multiselect-dropdown::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Styles pour textarea et input text */
.form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

/* Masquer les petites notes d'aide (remplacées par les icônes ?) */
.form-group small {
    display: none;
}

button[type="submit"] {
    width: 100%;
    padding: 1rem;
    background: #4a90e2;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

button[type="submit"]:hover {
    background: #357abd;
}

/* Style de la grille des contes */
.tales-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.tale-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.3s ease;
}

.tale-card:hover {
    transform: translateY(-5px);
}

.tale-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.tale-card h3 {
    padding: 1rem;
    margin: 0;
    font-size: 1.2rem;
}

.tale-card .status {
    padding: 0 1rem;
    color: #666;
    font-size: 0.9rem;
}

.tale-card .read-tale {
    display: block;
    padding: 1rem;
    text-align: center;
    background: #f5f5f5;
    color: #333;
    text-decoration: none;
    border-top: 1px solid #eee;
}

.tale-card .read-tale:hover {
    background: #eee;
}

/* Style de la page d'administration */
.fairy-tale-management {
    padding: 2rem;
}

.fairy-tale-management table {
    width: 100%;
    border-collapse: collapse;
}

.fairy-tale-management th,
.fairy-tale-management td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.fairy-tale-management th {
    background: #f5f5f5;
    font-weight: bold;
}

/* Loader et messages */
.tale-loader {
    display: none;
    text-align: center;
    padding: 2rem;
}

.tale-loader::after {
    content: "";
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4a90e2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.tale-message {
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 4px;
}

.tale-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.tale-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Encart de résumé des critères */
.ftg-criteria-summary {
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ftg-criteria-summary h4 {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ftg-cost-estimate {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ftg-cost-estimate strong {
    color: #2c5aa0;
}

/* Style des idées de contes */
#tale-ideas ul {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

#tale-ideas ul li {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

#tale-ideas ul li:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border-color: #4a90e2;
}

#tale-ideas ul li p {
    margin: 0 0 15px 0;
    line-height: 1.6;
    color: #333;
}

#tale-ideas ul li button {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#tale-ideas ul li button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

#tale-ideas ul li button:disabled {
    background: #cccccc;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ==========================================================================
   Liste des idées : neutraliser les bullets injectées par le thème (Divi, etc.)
   Les styles inline ne suffisent pas car Divi utilise !important sur ses
   règles ul/li ; on contre-attaque avec !important dédié.
   ========================================================================== */
#tale-ideas ul.ftg-ideas-list,
#tale-ideas ul.ftg-ideas-list li {
    list-style: none !important;
    list-style-type: none !important;
    padding-left: 0 !important;
    margin-left: 0 !important;
    background: none !important;
}

/* ::marker est le pseudo-élément introduit par les navigateurs pour les puces.
   Le rendre invisible garantit qu'aucun point/chiffre ne s'affiche même si
   le thème force un list-style différent. */
#tale-ideas ul.ftg-ideas-list > li::marker,
#tale-ideas ul.ftg-ideas-list > li::before {
    content: '' !important;
    display: none !important;
}

#tale-ideas ul.ftg-ideas-list > li {
    margin: 0 0 12px 0 !important;
    padding: 0 !important;
}

/* Style responsive */
@media (max-width: 768px) {
    .tales-grid {
        grid-template-columns: 1fr;
    }

    .fairy-tale-generator {
        margin: 0;
        padding: 0;
        text-align: center;
    }

    form#fairy-tale-form .form-group {
        width: 100%;
    }

    .ftg-cost-estimate {
        font-size: 13px;
    }
}
