/**
 * WIDGET MODALS - Style TikFinity
 * Modales de configuration pour chaque widget
 */

/* Overlay sombre derrière la modale */
.widget-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.widget-modal-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Conteneur de la modale */
.widget-modal {
    background: rgba(20, 20, 20, 0.98);
    border: 1px solid rgba(0, 217, 255, 0.3);
    border-radius: 16px;
    max-width: 1800px;
    width: 95%;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 217, 255, 0.2);
    animation: slideUp 0.3s ease;
    display: flex;
    flex-direction: column;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Header de la modale */
.widget-modal-header {
    padding: 24px 28px;
    background: rgba(0, 217, 255, 0.05);
    border-bottom: 1px solid rgba(0, 217, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.widget-modal-title {
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 12px;
}

.widget-modal-title-icon {
    font-size: 28px;
}

.widget-modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 68, 68, 0.2);
    color: #ff4444;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.widget-modal-close:hover {
    background: rgba(255, 68, 68, 0.3);
    transform: scale(1.1);
}

/* Corps de la modale (scrollable) */
.widget-modal-body {
    padding: 0;
    overflow: hidden;
    flex: 1;
    display: flex;
    gap: 0;
}

/* Layout 2 colonnes : Options à gauche, Aperçu à droite */
.widget-modal-options {
    flex: 1;
    padding: 28px;
    overflow-y: auto;
    border-right: 1px solid rgba(0, 217, 255, 0.1);
}

/* FORCER le masquage de tous les aperçus dans la partie options (gauche) */
.widget-modal-options .preview-section,
.widget-modal-options .obs-preview,
.widget-modal-options .preview-container,
.widget-modal-options [id*="preview-container"],
.widget-modal-options [id*="preview-section"],
.widget-modal-options [id*="obs-preview"],
.widget-modal-options [class*="preview-section"],
.widget-modal-options iframe[id*="preview"],
.widget-modal-options iframe[id*="obs-iframe"] {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
}

.widget-modal-preview {
    width: 350px;
    background: #000;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.widget-modal-preview-header {
    padding: 16px 20px;
    background: rgba(0, 217, 255, 0.05);
    border-bottom: 1px solid rgba(0, 217, 255, 0.1);
    font-size: 14px;
    font-weight: 600;
    color: #00d9ff;
    text-align: center;
}

.widget-modal-preview-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
}

.widget-modal-preview-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
}

.widget-modal-options::-webkit-scrollbar {
    width: 8px;
}

.widget-modal-options::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.widget-modal-options::-webkit-scrollbar-thumb {
    background: rgba(0, 217, 255, 0.3);
    border-radius: 4px;
}

.widget-modal-options::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 217, 255, 0.5);
}

/* Footer de la modale */
.widget-modal-footer {
    padding: 20px 28px;
    background: rgba(10, 10, 10, 0.5);
    border-top: 1px solid rgba(0, 217, 255, 0.1);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-shrink: 0;
}

.widget-modal-btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.widget-modal-btn.primary {
    background: linear-gradient(135deg, #00d9ff 0%, #00ff99 100%);
    color: #000;
}

.widget-modal-btn.primary:hover {
    box-shadow: 0 4px 16px rgba(0, 217, 255, 0.4);
    transform: translateY(-2px);
}

.widget-modal-btn.secondary {
    background: rgba(100, 100, 100, 0.2);
    border: 1px solid rgba(100, 100, 100, 0.3);
    color: #aaa;
}

.widget-modal-btn.secondary:hover {
    background: rgba(100, 100, 100, 0.3);
    color: #fff;
}

/* Sections dans la modale */
.modal-config-section {
    background: rgba(0, 217, 255, 0.02);
    border: 1px solid rgba(0, 217, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.modal-config-section:last-child {
    margin-bottom: 0;
}

.modal-config-section-title {
    font-size: 18px;
    font-weight: 700;
    color: #00d9ff;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Groupes de formulaire dans la modale */
.modal-form-group {
    margin-bottom: 20px;
}

.modal-form-group:last-child {
    margin-bottom: 0;
}

.modal-form-group label {
    display: block;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.modal-form-group small {
    display: block;
    color: #888;
    font-size: 12px;
    margin-top: 6px;
}

.modal-form-group .input,
.modal-form-group select,
.modal-form-group textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.modal-form-group .input:focus,
.modal-form-group select:focus,
.modal-form-group textarea:focus {
    border-color: rgba(0, 217, 255, 0.5);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.1);
}

/* Form row (2 colonnes) */
.modal-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.modal-form-row:last-child {
    margin-bottom: 0;
}

/* Color picker dans la modale */
.modal-color-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.modal-color-group input[type="color"] {
    width: 60px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
}

.modal-color-group input[type="text"] {
    flex: 1;
}

/* Range slider dans la modale */
.modal-range-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.modal-range-group input[type="range"] {
    flex: 1;
}

.modal-range-group .range-value {
    color: #00ff99;
    font-weight: bold;
    min-width: 50px;
    text-align: right;
}

/* Checkbox/Switch dans la modale */
.modal-checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Preview dans la modale */
.modal-preview-box {
    background: #000;
    border: 1px solid rgba(0, 217, 255, 0.2);
    border-radius: 8px;
    padding: 20px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-preview-box iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Copy URL dans la modale */
.modal-copy-url-group {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.modal-copy-url-group input {
    flex: 1;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #888;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
}

.modal-copy-url-group button {
    padding: 10px 20px;
    background: rgba(0, 217, 255, 0.2);
    border: 1px solid rgba(0, 217, 255, 0.3);
    color: #00d9ff;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.modal-copy-url-group button:hover {
    background: rgba(0, 217, 255, 0.3);
    transform: translateY(-1px);
}

/* Responsive */
@media (max-width: 768px) {
    .widget-modal {
        width: 95%;
        max-height: 90vh;
    }
    
    .modal-form-row {
        grid-template-columns: 1fr;
    }
    
    .widget-modal-body {
        flex-direction: column;
    }
    
    .widget-modal-options {
        border-right: none;
        border-bottom: 1px solid rgba(0, 217, 255, 0.1);
    }
    
    .widget-modal-preview {
        width: 100%;
        height: 250px;
    }
}

/* ==========================================
   WIDGET SCORE - STYLES DONATEURS
   ========================================== */

.stat-card {
    background: var(--bg-tertiary);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.stat-value {
    font-size: 28px;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 8px;
}

.stat-label {
    font-size: 13px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.donor-row {
    display: grid;
    grid-template-columns: 60px 1fr auto auto;
    gap: 16px;
    align-items: center;
    padding: 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.donor-row:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
    transform: translateX(4px);
}

.donor-rank {
    font-size: 24px;
    font-weight: bold;
    text-align: center;
}

.donor-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.donor-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.donor-id {
    font-size: 13px;
    color: var(--muted);
}

.donor-stats {
    display: flex;
    gap: 24px;
    align-items: center;
}

.donor-points {
    font-size: 18px;
    font-weight: bold;
    color: var(--primary);
}

.donor-gifts {
    font-size: 14px;
    color: var(--muted);
}

.donor-last-gift {
    font-size: 12px;
    color: var(--muted);
}

.donor-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.btn-icon.danger {
    background: rgba(255, 59, 48, 0.1);
    border-color: rgba(255, 59, 48, 0.3);
    color: #ff3b30;
}

.btn-icon.danger:hover {
    background: rgba(255, 59, 48, 0.2);
    border-color: #ff3b30;
}

@media (max-width: 768px) {
    .donor-row {
        grid-template-columns: 50px 1fr;
    }

    .donor-stats {
        grid-column: 2;
        margin-top: 8px;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .donor-actions {
        grid-column: 2;
        margin-top: 8px;
        justify-content: flex-end;
    }
}
