/**
 * WIDGETS GRID - Style TikFinity
 * Design moderne avec aperçus visibles en grille
 */

/* Conteneur principal de la grille */
.widgets-grid-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Grille des widgets */
.widgets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

/* Carte widget individuelle */
.widget-card {
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid rgba(0, 217, 255, 0.2);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.widget-card:hover {
    border-color: rgba(0, 217, 255, 0.5);
    box-shadow: 0 4px 24px rgba(0, 217, 255, 0.15);
    transform: translateY(-2px);
}

/* Header de la carte */
.widget-card-header {
    padding: 16px 20px;
    background: rgba(0, 217, 255, 0.05);
    border-bottom: 1px solid rgba(0, 217, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.widget-card-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.widget-card-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.widget-card-title-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.widget-card-name {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.widget-card-desc {
    font-size: 12px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.3;
}

/* STATUTS AMÉLIORÉS - Plus gros, plus visible */
.widget-card-status {
    font-size: 13px;
    padding: 8px 14px;
    border-radius: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.widget-card-status.active {
    background: rgba(0, 255, 153, 0.2);
    color: #00ff99;
    border: 1px solid rgba(0, 255, 153, 0.4);
    box-shadow: 
        0 0 20px rgba(0, 255, 153, 0.3),
        0 0 40px rgba(0, 255, 153, 0.1);
    animation: statusGlowActive 2s ease-in-out infinite;
}

.widget-card-status.inactive {
    background: rgba(100, 100, 100, 0.2);
    color: #888;
    border: 1px solid rgba(100, 100, 100, 0.3);
}

/* Animation glow pour statut actif */
@keyframes statusGlowActive {
    0%, 100% {
        box-shadow: 
            0 0 20px rgba(0, 255, 153, 0.3),
            0 0 40px rgba(0, 255, 153, 0.1);
    }
    50% {
        box-shadow: 
            0 0 30px rgba(0, 255, 153, 0.5),
            0 0 60px rgba(0, 255, 153, 0.2);
    }
}

/* Aperçu du widget */
.widget-card-preview {
    position: relative;
    width: 100%;
    height: 250px;
    background: #000000;
    overflow: hidden;
}

.widget-card-preview iframe {
    width: 100%;
    height: 100%;
    border: none;
    transform-origin: top left;
}

/* Empty state */
.widget-preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
    font-size: 14px;
}

.widget-preview-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* Actions de la carte */
.widget-card-actions {
    padding: 16px 20px;
    background: rgba(10, 10, 10, 0.5);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.widget-card-btn {
    flex: 1;
    min-width: 100px;
    padding: 10px 14px;
    background: rgba(0, 217, 255, 0.1);
    border: 1px solid rgba(0, 217, 255, 0.3);
    border-radius: 8px;
    color: #00d9ff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
}

.widget-card-btn:hover {
    background: rgba(0, 217, 255, 0.2);
    border-color: rgba(0, 217, 255, 0.5);
    transform: translateY(-1px);
}

/* Bouton principal - Plus gros et voyant */
.widget-card-btn.primary {
    background: linear-gradient(135deg, #00d9ff 0%, #00ff99 100%);
    border: none;
    color: #000;
    font-weight: 700;
    font-size: 14px;
    padding: 12px 18px;
    flex: 1.5;
}

.widget-card-btn.primary:hover {
    box-shadow: 0 4px 20px rgba(0, 217, 255, 0.5);
    transform: translateY(-2px);
}

/* Boutons secondaires - Plus discrets */
.widget-card-btn.secondary {
    background: rgba(60, 60, 60, 0.3);
    border-color: rgba(80, 80, 80, 0.4);
    color: #999;
    font-size: 12px;
    padding: 8px 12px;
    min-width: 80px;
    flex: 0.8;
}

.widget-card-btn.secondary:hover {
    background: rgba(80, 80, 80, 0.4);
    border-color: rgba(100, 100, 100, 0.6);
    color: #ccc;
}

/* Bouton success (démarrer) */
.widget-card-btn.success {
    background: rgba(0, 255, 153, 0.15);
    border: 1px solid rgba(0, 255, 153, 0.4);
    color: #00ff99;
    font-weight: 700;
    padding: 10px 16px;
    min-width: 110px;
}

.widget-card-btn.success:hover {
    background: rgba(0, 255, 153, 0.25);
    border-color: rgba(0, 255, 153, 0.6);
    box-shadow: 0 2px 16px rgba(0, 255, 153, 0.4);
}

/* Bouton danger (arrêter) */
.widget-card-btn.danger {
    background: rgba(255, 68, 68, 0.15);
    border: 1px solid rgba(255, 68, 68, 0.4);
    color: #ff4444;
    font-weight: 700;
    padding: 10px 16px;
    min-width: 110px;
}

.widget-card-btn.danger:hover {
    background: rgba(255, 68, 68, 0.25);
    border-color: rgba(255, 68, 68, 0.6);
    box-shadow: 0 2px 16px rgba(255, 68, 68, 0.4);
}

/* Bouton warning (test) */
.widget-card-btn.warning {
    background: rgba(255, 196, 0, 0.15);
    border: 1px solid rgba(255, 196, 0, 0.4);
    color: #ffc400;
    font-weight: 700;
    padding: 10px 16px;
    min-width: 90px;
}

.widget-card-btn.warning:hover {
    background: rgba(255, 196, 0, 0.25);
    border-color: rgba(255, 196, 0, 0.6);
    box-shadow: 0 2px 16px rgba(255, 196, 0, 0.4);
}

/* Tooltips natifs améliorés */
.widget-card-btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.95);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 400;
    white-space: nowrap;
    pointer-events: none;
    z-index: 1000;
    border: 1px solid rgba(0, 217, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    animation: tooltipFadeIn 0.2s ease;
}

.widget-card-btn[title]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.95);
    pointer-events: none;
    z-index: 1001;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Menu déroulant compact */
.widget-config-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(15, 15, 15, 0.98);
    border: 1px solid rgba(0, 217, 255, 0.3);
    border-top: none;
    border-radius: 0 0 12px 12px;
    padding: 20px;
    max-height: 500px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    display: none;
    animation: dropdownSlide 0.3s ease;
}

@keyframes dropdownSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.widget-config-dropdown.open {
    display: block;
}

.widget-card {
    position: relative;
}

/* Scrollbar pour le dropdown */
.widget-config-dropdown::-webkit-scrollbar {
    width: 6px;
}

.widget-config-dropdown::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.widget-config-dropdown::-webkit-scrollbar-thumb {
    background: rgba(0, 217, 255, 0.3);
    border-radius: 3px;
}

.widget-config-dropdown::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 217, 255, 0.5);
}

/* Badge de notification */
.widget-notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff4444;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 12px;
    z-index: 10;
}

/* Responsive */
@media (max-width: 1200px) {
    .widgets-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

@media (max-width: 768px) {
    .widgets-grid {
        grid-template-columns: 1fr;
    }
    
    .widget-card-preview {
        height: 200px;
    }
}

/* Bouton de copie du lien */
.widget-copy-link {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 0;
}

.widget-copy-link input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #888;
    font-size: 12px;
    padding: 8px 12px;
    border-radius: 6px;
}

.widget-copy-link button {
    padding: 8px 16px;
    font-size: 13px;
    white-space: nowrap;
}
