/* Modales stylisées, toasts et menu contextuel - remplace confirm()/alert() natifs
   et les reload() de page pour un rendu cohérent avec le reste du site. */

.ui-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 12, 25, 0.75);
    backdrop-filter: blur(3px);
    z-index: var(--layer-confirmation, 14000);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: ui-modal--uiModalFadeIn 0.15s ease forwards;
}
@keyframes ui-modal--uiModalFadeIn { to { opacity: 1; } }

.ui-modal-box {
    background: linear-gradient(180deg, #1a2d47 0%, #0f1c30 100%);
    border: 1px solid rgba(127, 216, 255, 0.25);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    max-width: 480px;
    width: 92%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 1.5em;
    color: #e0f7fa;
    transform: translateY(10px);
    animation: ui-modal--uiModalSlideIn 0.18s ease forwards;
}
@keyframes ui-modal--uiModalSlideIn { to { transform: translateY(0); } }

.ui-modal-box.ui-modal-wide { max-width: 640px; }

.ui-modal-title {
    display: flex;
    align-items: center;
    gap: 0.5em;
    font-size: 1.2em;
    font-weight: bold;
    color: #7fd8ff;
    margin-bottom: 1em;
}
.ui-modal-title svg { flex-shrink: 0; }

.ui-modal-body { margin-bottom: 1.2em; font-size: 0.98em; line-height: 1.5; }
.ui-modal-body ul { padding-left: 1.2em; margin: 0.5em 0; }

.ui-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.7em;
    flex-wrap: wrap;
}
.ui-modal-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    padding: 0.55em 1.2em;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.92em;
    transition: all 0.15s;
}
.ui-modal-btn.primary { background: linear-gradient(135deg, #7fd8ff, #4fc3f7); color: #0a223a; }
.ui-modal-btn.primary:hover { filter: brightness(1.1); }
.ui-modal-btn.danger { background: linear-gradient(135deg, #ff5a5a, #d32f2f); color: #fff; }
.ui-modal-btn.danger:hover { filter: brightness(1.1); }
.ui-modal-btn.secondary { background: rgba(255,255,255,0.1); color: #e0f7fa; border: 1px solid rgba(255,255,255,0.2); }
.ui-modal-btn.secondary:hover { background: rgba(255,255,255,0.18); }
.ui-modal-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.ui-modal-close {
    position: absolute;
    top: 0.8em;
    right: 0.9em;
    background: none;
    border: none;
    color: #7fd8ff;
    cursor: pointer;
    opacity: 0.7;
}
.ui-modal-close:hover { opacity: 1; }
.ui-modal-box { position: relative; }

/* Sections internes (modération : demandes / membres) */
.ui-modal-section-title {
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #7fd8ff;
    opacity: 0.8;
    margin: 1em 0 0.5em 0;
}
.ui-modal-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.5em; }
.ui-modal-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8em;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    padding: 0.5em 0.8em;
}
.ui-modal-list-item .item-name { font-weight: 600; color: #b2eaff; }
.ui-modal-list-item .item-msg { font-size: 0.85em; opacity: 0.75; font-style: italic; display: block; }
.ui-modal-list-actions { display: flex; gap: 0.4em; flex-shrink: 0; }
.ui-modal-icon-btn {
    width: 30px; height: 30px;
    border-radius: 50%;
    border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
}
.ui-modal-icon-btn.accept { background: rgba(76, 175, 80, 0.2); color: #4caf50; }
.ui-modal-icon-btn.accept:hover { background: #4caf50; color: #fff; }
.ui-modal-icon-btn.refuse { background: rgba(255, 90, 90, 0.2); color: #ff5a5a; }
.ui-modal-icon-btn.refuse:hover { background: #ff5a5a; color: #fff; }
.ui-modal-icon-btn.kick { background: rgba(255, 193, 7, 0.2); color: #ffc107; }
.ui-modal-icon-btn.kick:hover { background: #ffc107; color: #1a1a2e; }
.ui-modal-empty { opacity: 0.6; font-size: 0.9em; padding: 0.5em 0; }

/* Grille de la modale garde-robe (chat.php) */
.wardrobe-modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.8em;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 0.3em;
}
.wardrobe-modal-item {
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(127,216,255,0.15);
    border-radius: 10px;
    padding: 0.5em;
    text-align: center;
}
.wardrobe-modal-item img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 0.4em;
}
.wardrobe-modal-item-name {
    font-size: 0.85em;
    color: #b2eaff;
    margin-bottom: 0.5em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.wardrobe-modal-item-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4em;
}
.wardrobe-modal-item-actions .ui-modal-btn {
    padding: 0.35em 0.7em;
    font-size: 0.8em;
    flex: 1;
}

.ui-modal-select, .ui-modal-input {
    width: 100%;
    padding: 0.6em 0.8em;
    background: #0a2845;
    color: #fff;
    border: 1px solid rgba(127, 216, 255, 0.3);
    border-radius: 8px;
    font-size: 0.95em;
}

/* Toasts (notifications temporaires en bas à droite) */
.ui-toast-container {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: var(--layer-toast, 15000);
    display: flex;
    flex-direction: column;
    gap: 0.6em;
    max-width: 360px;
}
.ui-toast {
    background: linear-gradient(180deg, #22334a 0%, #1a2d47 100%);
    border: 1px solid rgba(127, 216, 255, 0.3);
    border-radius: 10px;
    padding: 0.8em 1em;
    box-shadow: 0 6px 20px rgba(0,0,0,0.35);
    color: #e0f7fa;
    display: flex;
    align-items: flex-start;
    gap: 0.6em;
    animation: ui-modal--uiToastIn 0.2s ease;
    font-size: 0.92em;
}
@keyframes ui-modal--uiToastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
.ui-toast.success { border-color: rgba(76, 175, 80, 0.5); }
.ui-toast.danger { border-color: rgba(255, 90, 90, 0.5); }
.ui-toast-icon { flex-shrink: 0; margin-top: 0.15em; }
.ui-toast-body { flex: 1; }
.ui-toast-actions { display: flex; gap: 0.5em; margin-top: 0.5em; }
.ui-toast-close { background: none; border: none; color: #7fd8ff; opacity: 0.6; cursor: pointer; flex-shrink: 0; }
.ui-toast-close:hover { opacity: 1; }

/* Menu contextuel (clic droit sur les cartes) */
.ctx-menu {
    position: fixed;
    z-index: var(--layer-confirmation, 14000);
    background: linear-gradient(180deg, #1a2d47 0%, #0f1c30 100%);
    border: 1px solid rgba(127, 216, 255, 0.25);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.45);
    padding: 0.4em;
    min-width: 210px;
    max-width: 280px;
    max-height: min(380px, 70vh);
    overflow-y: auto;
    display: none;
}
.ctx-menu.open { display: block; }
.ctx-menu.ctx-submenu { z-index: calc(var(--layer-confirmation, 14000) + 1); }
.ctx-menu-item {
    display: flex;
    align-items: center;
    gap: 0.7em;
    padding: 0.55em 0.8em;
    border-radius: 6px;
    color: #e0f7fa;
    cursor: pointer;
    font-size: 0.92em;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ctx-menu-item:hover { background: rgba(127, 216, 255, 0.12); color: #7fd8ff; }
.ctx-menu-item svg { flex-shrink: 0; opacity: 0.85; }
.ctx-menu-item.danger:hover { background: rgba(255, 90, 90, 0.15); color: #ff5a5a; }
.ctx-menu-item-main {
    display: flex;
    align-items: center;
    gap: 0.7em;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ctx-menu-item.has-submenu { justify-content: space-between; }
.ctx-menu-arrow { flex-shrink: 0; opacity: 0.6; margin-left: 0.5em; font-size: 0.8em; }
.ctx-menu-sep { height: 1px; background: rgba(127, 216, 255, 0.15); margin: 0.3em 0.4em; }
