/* ==========================================================================
   1. VARIABLES Y RESET GLOBAL
   ========================================================================== */
:root {
  --bg-color: #09090b;
  --surface-color: #18181b;
  --surface-border: rgba(255, 255, 255, 0.05);
  --text-main: #fafafa;
  --text-muted: #a1a1aa;
  --accent-blue: #3b82f6;
  --accent-blue-hover: #2563eb;
  --accent-green: #1db954;
  --accent-green-hover: #1ed760;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body.premium-layout { 
    background: var(--bg-color); 
    color: var(--text-main); 
    font-family: 'Inter', system-ui, sans-serif; 
    margin: 0; 
    min-height: 100vh; 
    overflow-x: hidden;
    overflow-y: scroll;
}

/* ==========================================================================
   2. NAVBAR MODERNA (NAV-PREMIUM)
   ========================================================================== */
.nav-premium { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 0 32px; 
    height: 70px; 
    background: rgba(9, 9, 11, 0.85); 
    backdrop-filter: blur(12px); 
    border-bottom: 1px solid var(--surface-border); 
    position: sticky; 
    top: 0; 
    z-index: 100; 
}

.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; letter-spacing: 0.5px; color: #fff; }

.nav-links { display: flex; justify-content: center; gap: 8px; background: rgba(255, 255, 255, 0.03); padding: 4px; border-radius: 10px; border: 1px solid var(--surface-border); width: fit-content; margin: 0 auto; }

.nav-item svg { width: 16px;}
.nav-item { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    padding: 8px 16px; 
    border-radius: 6px; 
    color: var(--text-muted); 
    text-decoration: none; 
    font-size: 0.85rem; 
    font-weight: 500; 
    transition: all 0.2s ease;
    border: 1px solid transparent; 
    box-sizing: border-box;
}
.nav-item:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.nav-item.active { background: rgba(29, 185, 84, 0.15) !important; color: var(--accent-green) !important; border: 1px solid rgba(29, 185, 84, 0.4) !important; box-shadow: 0 0 10px rgba(29, 185, 84, 0.1) !important; }
.nav-item.active svg { opacity: 1 !important; color: var(--accent-green) !important; }

/* 🛡️ PERFIL CONGELADO: Anchos fijos para evitar que empuje la interfaz */
.perfil-dropdown-container { display: flex; justify-content: flex-end; position: relative; }
.btn-perfil { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    background: transparent; 
    border: 1px solid rgba(255, 255, 255, 0.1); 
    padding: 4px 16px 4px 4px; 
    border-radius: 30px; 
    cursor: pointer; 
    color: #fff; 
    transition: all 0.2s; 
    font-size: 0.85rem; 
    font-weight: 500; 
    font-family: inherit;
    min-width: 150px; 
    justify-content: flex-end;
}
.btn-perfil:hover { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.2); }

#navUserName {
    width: 70px; 
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; 
    display: inline-block;
}

.avatar { width: 32px; height: 32px; background: linear-gradient(135deg, #1db954, #10b981); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.9rem; color: #000; overflow: hidden; }

.dropdown-menu { position: absolute; top: 120%; right: 0; background: var(--surface-color); border: 1px solid #27272a; border-radius: 10px; width: 220px; padding: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); display: none; flex-direction: column; gap: 4px; z-index: 101; }
.dropdown-menu.show { display: flex !important; }
.dropdown-item { background: transparent; border: none; color: var(--text-muted); text-align: left; padding: 10px 12px; border-radius: 6px; cursor: pointer; font-size: 0.85rem; display: flex; align-items: center; gap: 10px; transition: all 0.2s; font-family: inherit; text-decoration: none;}
.dropdown-item:hover { background: #27272a; color: #fff; }
.dropdown-item.text-danger:hover { background: rgba(239, 68, 68, 0.1); color: #ef4444; }

/* ==========================================================================
   3. LAYOUTS Y UTILIDADES GLOBALES
   ========================================================================== */
.dashboard-container { padding: 40px 32px; max-width: 1400px; margin: 0 auto; }
.glass-panel { background: var(--surface-color); border: 1px solid var(--surface-border); border-radius: var(--radius-lg); padding: 30px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }

.vista-oculta { display: none !important; }
.vista-activa { display: flex !important; }
#vista-catalogo.vista-activa { display: block !important; }

/* Inputs y Formularios Base */
.campo-grupo { display: flex; flex-direction: column; gap: 6px; border-color: var(--surface-border) !important; }
.campo-label { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
input[type="text"], textarea, .input-select, select { width: 100%; background: #09090b !important; border: 1px solid #27272a !important; color: #fff !important; font-family: inherit; transition: border 0.2s; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.9rem;}
input[type="text"]:focus, textarea:focus, .input-select:focus, select:focus { border-color: var(--accent-green) !important; outline: none; }
textarea { resize: vertical; min-height: 80px; }

.estado-mensaje { padding: 20px; text-align: center; color: var(--text-muted); font-size: 0.9rem; border: 1px dashed #27272a; border-radius: var(--radius-md); margin-bottom: 12px; }
.estado-mensaje.error { color: #f85149; border-color: rgba(248, 81, 73, 0.4); background: rgba(248, 81, 73, 0.05); }

/* ==========================================================================
   4. VISTA CM: CATÁLOGO DE PUBLICACIÓN (GRILLA HORIZONTAL DE CARPETAS)
   ========================================================================== */
.lista-videos-grid { 
    display: grid !important; 
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)) !important; 
    gap: 20px !important; 
    align-items: start !important; 
    width: 100% !important; 
}

.grupo-partido, div[id^="grupo-"] { 
    background: rgba(24, 24, 27, 0.6) !important; 
    border: 1px solid var(--surface-border) !important; 
    border-radius: var(--radius-lg) !important; 
    padding: 18px !important; 
    width: 100% !important; 
    box-sizing: border-box !important; 
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4) !important;
    backdrop-filter: blur(10px) !important;
    transition: transform 0.2s ease, border-color 0.2s ease !important;
}
.grupo-partido:hover {
    border-color: rgba(29, 185, 84, 0.3) !important;
}

.grupo-partido h3, div[id^="grupo-"] h3 { 
    color: #fff !important; 
    font-size: 0.95rem !important; 
    border-bottom: 1px solid var(--surface-border) !important; 
    padding-bottom: 10px !important; 
    margin-top: 0 !important; 
    margin-bottom: 14px !important; 
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
}

.grid-videos-grupo, .videos-grid { display: flex !important; flex-direction: column !important; gap: 10px !important; }

.video-card, .video-item, .card-video { background: #09090b !important; border: 1px solid var(--surface-border) !important; border-radius: 8px !important; padding: 10px 12px !important; transition: transform 0.2s, border-color 0.2s !important; display: flex !important; flex-direction: column !important; gap: 8px !important; cursor: pointer !important;}
.video-card:hover, .video-item:hover, .card-video:hover { transform: translateY(-2px) !important; border-color: rgba(29, 185, 84, 0.5) !important; box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important; }

.video-card h3, .video-title { font-size: 0.8rem !important; font-weight: 500 !important; margin: 0 !important; line-height: 1.2 !important; border: none !important; padding: 0 !important; color: #e4e4e7 !important; white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important; }

.card-header-row { display: flex !important; justify-content: space-between !important; align-items: center !important; }
.badge-row-id { font-size: 0.65rem !important; font-weight: 600 !important; color: var(--text-muted) !important; background: rgba(255,255,255,0.05) !important; padding: 2px 6px !important; border-radius: 4px !important; }
.badge-estado-red { display: inline-flex !important; align-items: center !important; font-size: 0.6rem !important; font-weight: 700 !important; padding: 2px 6px !important; border-radius: 8px !important; text-transform: uppercase !important; }

.video-card button, .video-item button, .card-video button { background: var(--accent-green) !important; color: #000 !important; border: none !important; padding: 6px !important; border-radius: 6px !important; font-weight: 700 !important; font-size: 0.75rem !important; cursor: pointer !important; transition: 0.2s !important; width: 100% !important; margin-top: 4px !important;}
.video-card button:hover, .video-item button:hover, .card-video button:hover { background: var(--accent-green-hover) !important; }

/* ==========================================================================
   5. VISTA 2: EDITOR / PROGRAMADOR DE REDES
   ========================================================================== */
.vista-editor-layout { flex-direction: column; height: 100%; width: 100%; overflow: hidden; }
.editor-top-nav { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid var(--surface-border); flex-shrink: 0; background: rgba(0,0,0,0.2); }
.btn-volver { background: transparent; border: none; color: var(--text-muted); font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: color 0.2s; display: flex; align-items: center; gap: 6px; }
.btn-volver:hover { color: #fff; }

.editor-columnas { display: grid; grid-template-columns: 380px 1fr; gap: 30px; height: calc(100vh - 200px); min-height: 500px;}
.editor-col-izq { background-color: #09090b; border: 1px solid var(--surface-border); border-radius: var(--radius-lg); padding: 20px; display: flex; flex-direction: column; align-items: center; overflow: hidden; }
.preview-container { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; }
.editor-col-der { background-color: var(--surface-color); border: 1px solid var(--surface-border); border-radius: var(--radius-lg); padding: 24px; display: flex; flex-direction: column; overflow: hidden; }

.formulario-scrollable { flex: 1; overflow-y: auto; padding-right: 15px; display: flex; flex-direction: column; min-height: 0; }
.formulario-scrollable::-webkit-scrollbar { width: 6px; }
.formulario-scrollable::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

.btn-modal-plataforma { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); color: #fff; padding: 10px 16px; border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all 0.2s; flex: 1; min-width: 150px;}
.btn-modal-plataforma:hover { background: #27272a; transform: translateY(-1px); }

/* Toggles (Checkboxes Visuales) */
.checkbox-container { display: flex; align-items: center; cursor: pointer; user-select: none; transition: opacity 0.3s; }
.checkbox-container input[type="checkbox"] { display: none; }
.custom-toggle { width: 44px; height: 24px; background-color: #444; border-radius: 12px; position: relative; margin-right: 10px; transition: background-color 0.3s; flex-shrink: 0; }
.custom-toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; background-color: white; border-radius: 50%; transition: transform 0.3s; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
#chkRedYoutube:checked ~ .custom-toggle { background-color: #ff0000; }
#chkRedTiktok:checked ~ .custom-toggle { background-color: #25F4EE; }
input[type="checkbox"]:checked + .custom-toggle.instagram { background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); }
input[type="checkbox"]:checked ~ .custom-toggle { background-color: var(--accent-blue); }
.checkbox-container input:checked ~ .custom-toggle::after { transform: translateX(20px); }

.programacion-box { background-color: rgba(255, 255, 255, 0.02); border: 1px solid var(--surface-border); border-radius: var(--radius-md); padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.btn-elegir-fecha { background: #27272a; color: #fff; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 500; cursor: pointer; border: none; }

.bloque-anclado-inferior { flex-shrink: 0; margin-top: 15px; padding-top: 15px; border-top: 1px solid var(--surface-border); background: var(--surface-color); }
.resumen-caja { background: rgba(0,0,0,0.3); border: 1px solid var(--surface-border); border-radius: var(--radius-md); padding: 15px; margin-bottom: 15px; }
.acciones-form { display: flex; gap: 15px; width: 100%; box-sizing: border-box; }
.btn-accion { flex: 1; padding: 14px; border-radius: var(--radius-sm); font-size: 0.9rem; font-weight: 600; border: none; cursor: pointer; transition: 0.2s; }
.btn-publicar { background-color: var(--accent-green); color: #000; }
.btn-programar { background-color: rgba(255,255,255,0.05); color: #fff; border: 1px solid rgba(255,255,255,0.2); }

/* ==========================================================================
   6. MODALES GLOBALES
   ========================================================================== */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 16px; }
.modal-card { background: var(--surface-color); border: 1px solid var(--surface-border); border-radius: var(--radius-lg); width: 100%; padding: 24px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); color: var(--text-main); }
.modal-card.amplia { max-width: 650px; }
.modal-card.normal { max-width: 400px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; border-bottom: 1px solid var(--surface-border); padding-bottom: 12px; }
.modal-header h3 { margin: 0; font-size: 1.15rem; font-weight: 600; color: white; display: flex; align-items: center; }
.btn-close { background: transparent; border: none; color: var(--text-muted); font-size: 1.6rem; cursor: pointer; padding: 0 6px; }
.btn-close:hover { color: #fff; }
.modal-footer { margin-top: 14px; border-top: 1px solid var(--surface-border); padding-top: 15px; display: flex; justify-content: flex-end; gap: 10px; background: rgba(0,0,0,0.2); margin: 20px -24px -24px -24px; padding: 20px 24px;}
.btn-confirmar { background: var(--accent-green); color: #000; border: none; padding: 10px 20px; border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 700; cursor: pointer; transition: background 0.2s; }

.btn-snippet { background: rgba(255,255,255,0.05); border: none; color: #ccc; padding: 4px 8px; border-radius: 4px; font-size: 0.75rem; cursor: pointer; margin-right: 10px; font-weight: bold; }
.configuracion-extra { background: rgba(0,0,0,0.2); padding: 16px; border-radius: 8px; border: 1px solid #27272a; }

/* Calendario UI */
.calendario-contenedor { background: #09090b; border: 1px solid var(--surface-border); border-radius: 8px; margin-bottom: 15px; padding: 15px;}
.calendario-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; border-bottom: 1px solid var(--surface-border); padding-bottom: 10px;}
.btn-cal-nav { background: #27272a; border: none; color: #fff; border-radius: 4px; width: 26px; height: 26px; cursor: pointer; }
.calendario-dias-semana { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 0.7rem; color: var(--text-muted); margin-bottom: 4px; }
.calendario-grilla { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.dia-btn { background: transparent; border: 1px solid transparent; color: #fff; padding: 7px 0; border-radius: 6px; font-size: 0.8rem; cursor: pointer; }
.dia-btn:hover:not(:disabled) { background: #27272a; }
.dia-btn.seleccionado { background: var(--accent-green) !important; color: #000 !important; font-weight: 700; }
.dia-btn:disabled { color: #3b4252; cursor: not-allowed; }

/* Cuentas */
.btn-cuentas { background: transparent; border: 1px solid rgba(255,255,255,0.1); color: #fff; padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 0.85rem; transition: all 0.2s; }
.btn-cuentas:hover { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.2); }
.cuenta-item { display: flex; justify-content: space-between; align-items: center; padding: 15px 0; border-bottom: 1px solid #27272a; }
.cuenta-info { display: flex; align-items: center; gap: 15px; }
.estado-cuenta.conectado { color: #4CAF50; font-weight: 600; }
.estado-cuenta.desconectado { color: #F44336; }
.btn-yt-connect { background-color: #2a2a2a; color: white; border: 1px solid #444; padding: 6px 12px; border-radius: 6px; cursor: pointer; }

/* ==========================================================================
   7. FEEDBACK VISUAL: Spinners, Toasts y Trackers
   ========================================================================== */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 12px; }
.toast { min-width: 280px; padding: 14px 20px; border-radius: 8px; color: #fff; font-weight: 500; font-size: 0.9rem; box-shadow: 0 10px 25px rgba(0,0,0,0.5); transform: translateX(120%); opacity: 0; transition: all 0.4s ease; display: flex; align-items: center; gap: 12px; }
.toast.show { transform: translateX(0); opacity: 1; }
.toast.success { background-color: var(--surface-color); border-left: 4px solid var(--accent-green); }
.toast.error { background-color: var(--surface-color); border-left: 4px solid var(--accent-red); }

.spinner { border: 3px solid rgba(255,255,255,0.3); border-radius: 50%; border-top: 3px solid #fff; width: 18px; height: 18px; animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Tracker en Vivo */
.tracker-timeline { list-style: none; padding: 10px 0; margin: 0; display: flex; flex-direction: column; gap: 20px; position: relative; }
.tracker-timeline::before { content: ''; position: absolute; top: 10px; bottom: 30px; left: 17px; width: 2px; background: var(--surface-border); z-index: 1; }
.tracker-step { display: flex; gap: 15px; align-items: flex-start; position: relative; z-index: 2; opacity: 0.4; transition: all 0.3s ease; }
.tracker-step.activo, .tracker-step.completado, .tracker-step.error { opacity: 1; }
.step-icon { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-color); border: 2px solid var(--surface-border); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.9rem; color: var(--text-muted); transition: all 0.3s ease; }
.tracker-step.activo .step-icon { border-color: var(--accent-blue); background: rgba(47, 129, 247, 0.2); color: var(--accent-blue); box-shadow: 0 0 10px rgba(47, 129, 247, 0.4); }
.tracker-step.completado .step-icon { border-color: var(--accent-green); background: var(--accent-green); color: #000; }
.step-text { display: flex; flex-direction: column; padding-top: 6px; }
.step-text strong { color: #fff; font-size: 1rem; margin-bottom: 2px; }
.step-text span { color: var(--text-muted); font-size: 0.85rem; }

#btnIndicadorProceso { display: inline-flex; align-items: center; gap: 8px; margin-left: 12px; padding: 6px 12px; background: #18181b; border: 1px solid #27272a; border-radius: 6px; color: #22c55e; font-size: 0.85rem; cursor: pointer; white-space: nowrap; }

/* =========================================================
   MEJORAS VISUALES: Pestaña Activa, Botones y Modales
   ========================================================= */
.btn-header-action {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e4e4e7;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}
.btn-header-action:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.2); color: #fff; }
.btn-header-action.highlight { color: #60a5fa; border-color: rgba(59, 130, 246, 0.3); background: rgba(59, 130, 246, 0.05); }
.btn-header-action.highlight:hover { background: rgba(59, 130, 246, 0.15); }

.modal-card.cuentas { max-width: 550px !important; }

.btn-cuenta-accion {
    background: #27272a !important;
    color: #fff !important;
    border: 1px solid #3f3f46 !important;
    padding: 8px 14px !important;
    border-radius: 6px !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}
.btn-cuenta-accion:hover { background: #3f3f46 !important; border-color: #52525b !important; }

/* =========================================================
   MODAL DE SEGURIDAD (PIN MAESTRO)
   ========================================================= */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(9, 9, 11, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.modal-overlay.vista-activa { opacity: 1; pointer-events: auto; }
.modal-overlay.vista-oculta { display: none !important; }

.modal-content {
    background: #18181b;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.02);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}
.modal-overlay.vista-activa .modal-content { transform: translateY(0); }

.pin-input {
    width: 160px !important;
    text-align: center !important;
    font-size: 1.8rem !important;
    letter-spacing: 16px !important;
    text-indent: 16px !important;
    font-weight: 700 !important;
    color: #1db954 !important;
    background: #09090b !important;
    border: 2px solid #27272a !important;
    padding: 15px !important;
    border-radius: 12px !important;
    transition: all 0.2s;
    caret-color: transparent !important;
}
.pin-input:focus {
    border-color: #1db954 !important;
    box-shadow: 0 0 0 4px rgba(29, 185, 84, 0.15) !important;
    outline: none;
}

/* =========================================================
   BOTONES PREMIUM GLOBALES
   ========================================================= */
.btn-submit { 
    width: 100%; 
    background: #1db954; 
    color: #000; 
    font-weight: 600; 
    border: none; 
    padding: 12px 20px; 
    border-radius: 8px; 
    font-size: 0.95rem; 
    cursor: pointer; 
    transition: all 0.2s ease; 
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-family: 'Inter', sans-serif;
}
.btn-submit:hover { 
    background: #1ed760; 
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(29, 185, 84, 0.2);
}

.btn-back { 
    background: #09090b; 
    border: 1px solid #27272a; 
    color: #a1a1aa; 
    font-size: 0.95rem; 
    font-weight: 500;
    display: inline-flex; 
    justify-content: center;
    align-items: center; 
    gap: 6px; 
    cursor: pointer; 
    padding: 12px 20px; 
    border-radius: 8px;
    transition: all 0.2s ease; 
    font-family: 'Inter', sans-serif;
}
.btn-back:hover { 
    background: rgba(255,255,255,0.05);
    color: #fff; 
    border-color: rgba(255,255,255,0.15);
}

/* =========================================================
   MODAL HORIZONTAL: INVITAR AL EQUIPO
   ========================================================= */
.invite-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 40px !important;
}
.invite-column { display: flex !important; flex-direction: column !important; }

.role-grid-vertical { display: flex !important; flex-direction: column !important; gap: 12px !important; }
.role-card {
    background: rgba(255,255,255,0.02) !important;
    border: 1px solid rgba(255,255,255,0.05) !important;
    border-radius: 8px !important;
    padding: 16px !important;
    display: flex !important;
    align-items: center !important;
    text-align: left !important;
    gap: 15px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    color: #a1a1aa !important;
}
.role-card:hover { background: rgba(255,255,255,0.05) !important; }
.role-card.selected {
    background: rgba(29, 185, 84, 0.05) !important;
    border-color: rgba(29, 185, 84, 0.3) !important;
    color: #fff !important;
}
.role-card.selected .role-icon { color: #1db954 !important; }

.premium-input-group {
    display: flex !important;
    background: #09090b !important;
    border: 1px solid #27272a !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    align-items: stretch !important;
}
.premium-input-group input {
    flex: 1 !important;
    background: transparent !important;
    border: none !important;
    color: #fff !important;
    padding: 12px 16px !important;
    font-size: 0.95rem !important;
    outline: none !important;
}
.premium-input-group button {
    background: #1db954 !important;
    color: #000 !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 20px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: background 0.2s !important;
    white-space: nowrap !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    margin: 0 !important;
}
.premium-input-group button:hover { background: #1ed760 !important; }

.manual-code-section {
    min-height: 120px !important; 
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
}
.code-box-container {
    display: flex !important;
    background: #000 !important;
    border: 1px dashed #1db954 !important;
    border-radius: 8px !important;
    align-items: center !important;
    padding: 6px !important;
    margin-bottom: 12px !important;
    gap: 10px !important;
}
.code-box-container .code-display {
    flex: 1 !important;
    color: #1db954 !important;
    text-align: center !important;
    font-family: monospace !important;
    font-size: 1.25rem !important;
    letter-spacing: 2px !important;
    font-weight: 600 !important;
    border: none !important;
    background: transparent !important;
    padding: 8px !important;
    margin: 0 !important;
}
.btn-copy-inline {
    background: #18181b !important;
    border: 1px solid #27272a !important;
    color: #a1a1aa !important;
    border-radius: 6px !important;
    padding: 10px 14px !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.1rem !important;
    margin: 0 !important;
}
.btn-copy-inline:hover {
    background: rgba(255,255,255,0.1) !important;
    color: #fff !important;
}

/* ==========================================================================
   🧠 MOTOR DE VISIBILIDAD DE NAVEGACIÓN (Data-Roles en HTML)
   ========================================================================== */

/* 1. Ocultar TODO por defecto */
.tab-admin, .tab-miembro, .tab-creador, .tab-editor, .tab-cm, .tab-equipo {
    display: none !important; 
}

/* 2. UNIVERSO ADMIN */
html[data-roles*="admin"] .tab-admin,
html[data-roles*="admin"] .tab-creador,
html[data-roles*="admin"] .tab-editor,
html[data-roles*="admin"] .tab-cm,
html[data-roles*="admin"] .tab-equipo {
    display: flex !important;
}
/* Al Admin NO se le habilita .tab-miembro (Inicio) */

/* 3. UNIVERSO MIEMBRO */
html:not([data-roles*="admin"]) .tab-miembro { 
    display: flex !important; 
}
html:not([data-roles*="admin"])[data-roles*="creador"] .tab-creador { 
    display: flex !important; 
}
html:not([data-roles*="admin"])[data-roles*="editor"] .tab-editor { 
    display: flex !important; 
}
html:not([data-roles*="admin"])[data-roles*="cm"] .tab-cm { 
    display: flex !important; 
}

/* =========================================================
   DISEÑO DE PERFIL (Estilo Google)
   ========================================================= */

/* 🎯 ACÁ ESTABA EL ERROR DEL CUADRADO GRIS: Faltaba esta clase completa */
.btn-avatar-solo {
    appearance: none;
    -webkit-appearance: none;
    background: transparent !important;
    border: 2px solid var(--accent-green); 
    padding: 2px;
    border-radius: 50% !important;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
}
.btn-avatar-solo:hover { 
    border-color: var(--accent-green-hover); 
    transform: scale(1.05); 
}
.btn-avatar-solo:focus { 
    outline: none; 
    box-shadow: 0 0 0 3px rgba(29, 185, 84, 0.25); 
}

.dropdown-menu.google-style {
    width: 260px; 
    padding: 12px;
}
.dropdown-header-google {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 10px 0 16px 0;
}
.avatar-grande {
    width: 64px;
    height: 64px;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #1db954, #10b981);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #000;
    overflow: hidden;
}
.nombre-completo { color: #fff; font-size: 1rem; margin-bottom: 2px; }
.email-muted { color: var(--text-muted); font-size: 0.8rem; }

.dropdown-org-badge {
    display: flex; align-items: center; gap: 12px; background: rgba(29, 185, 84, 0.05);
    border: 1px solid rgba(29, 185, 84, 0.2); padding: 10px 12px; border-radius: 8px; margin-bottom: 8px;
}
.org-avatar-mini {
    width: 28px; height: 28px; border-radius: 50% !important; background: var(--accent-green);
    color: #000; display: flex; align-items: center; justify-content: center; font-weight: 700;
    font-size: 0.8rem; overflow: hidden;
}
.org-info { display: flex; flex-direction: column; }
.org-label { font-size: 0.65rem; text-transform: uppercase; color: var(--text-muted); font-weight: 600; letter-spacing: 0.5px; }
.org-info strong { color: var(--accent-green); font-size: 0.85rem; }

/* 🛡️ BLINDAJE VISUAL: Ocultar Conexiones del menú si no es Admin */
html:not([data-roles*="admin"]) .dropdown-menu .tab-admin {
    display: none !important;
}

/* =========================================================
   REDISEÑO ONBOARDING APAISADO
   ========================================================= */
.onboarding-card.horizontal {
    display: flex; flex-direction: row; background: #18181b; border: 1px solid rgba(255,255,255,0.05);
    border-radius: 16px; overflow: hidden; max-width: 900px; width: 100%; margin: 0 auto; box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.panel-izquierdo {
    flex: 1; background: rgba(255,255,255,0.02); padding: 40px; border-right: 1px solid rgba(255,255,255,0.05);
    display: flex; flex-direction: column; align-items: center; text-align: center; justify-content: center;
}

.panel-derecho { flex: 1.5; padding: 40px; }

.logo-preview-onboarding {
    width: 140px; height: 140px; border-radius: 50%; background: #27272a; border: 2px dashed #3f3f46;
    display: flex; align-items: center; justify-content: center; margin: 25px auto; font-size: 2rem;
    color: #71717a; cursor: pointer; overflow: hidden; transition: border 0.3s;
}

.logo-preview-onboarding:hover { border-color: var(--accent-green); }

.acciones-form {
    display: flex; justify-content: space-between; align-items: center; margin-top: 35px;
    border-top: 1px solid rgba(255,255,255,0.05); padding-top: 20px;
}

/* Responsividad para celulares */
@media (max-width: 768px) {
    .onboarding-card.horizontal { flex-direction: column; }
    .panel-izquierdo { border-right: none; border-bottom: 1px solid rgba(255,255,255,0.05); padding: 30px 20px; }
    .panel-derecho { padding: 30px 20px; }
}

/* ==========================================================================
   8. NUEVA ARQUITECTURA DEL EDITOR (MENÚS CUSTOM Y ACORDEÓN)
   ========================================================================== */

/* Tabla Base */
.table-responsive { width: 100%; overflow-x: auto; padding: 10px 20px 30px 20px; }
.tabla-editor { width: 100%; border-collapse: separate; border-spacing: 0 8px; text-align: left; }
.tabla-editor th { color: #71717a; padding: 12px 10px; font-weight: 600; font-size: 0.75rem; text-transform: uppercase; border: none; background: transparent; letter-spacing: 1px; }
.tabla-editor td { padding: 14px 10px; background: #18181b; border-top: 1px solid var(--surface-border); border-bottom: 1px solid var(--surface-border); vertical-align: middle; font-size: 0.9rem; color: #fff; position: relative; }
.tabla-editor td:first-child { border-left: 1px solid var(--surface-border); border-top-left-radius: 12px; border-bottom-left-radius: 12px; }
.tabla-editor td:last-child { border-right: 1px solid var(--surface-border); border-top-right-radius: 12px; border-bottom-right-radius: 12px; text-align: right; }
.tabla-editor tbody tr { transition: transform 0.2s ease, background 0.2s ease; }
.tabla-editor tbody tr:hover td { background: #1f1f23; border-color: rgba(255,255,255,0.15); }

/* Fila Verde Blindada */
tr.row-editado td {
    background: rgba(29, 185, 84, 0.12) !important;
    border-color: rgba(29, 185, 84, 0.25) !important;
}

/* Acordeón Retráctil */
.match-header-row { 
    background: rgba(255, 255, 255, 0.02) !important; 
    border-top: 1px solid rgba(255,255,255,0.05) !important; 
    border-bottom: 1px solid rgba(255,255,255,0.05) !important; 
    cursor: pointer !important; 
    user-select: none !important;
    transition: background 0.2s ease;
}
.match-header-row:hover { background: rgba(255, 255, 255, 0.05) !important; }
.toggle-arrow { display: inline-block; transition: transform 0.2s ease; margin-right: 8px; color: var(--accent-green); font-size: 0.8rem; }
.match-header-row.collapsed .toggle-arrow { transform: rotate(-90deg); }

/* Etiquetas Básicas */
.badge-dinamica { background: rgba(59, 130, 246, 0.12); border: 1px solid rgba(59, 130, 246, 0.3); color: #60a5fa; padding: 6px 12px; border-radius: 8px; font-size: 0.8rem; font-weight: 700; display: inline-block; box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1); }
.link-crudos { background: rgba(255,255,255,0.03); border: 1px solid #27272a; color: #d4d4d8; padding: 8px 14px; border-radius: 8px; font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; white-space: nowrap !important; }
.link-crudos:hover { color: #fff; border-color: var(--accent-green); background: rgba(29, 185, 84, 0.15); }

/* 🎯 SELECTORES CORREGIDOS: Espacio extra y tamaño optimizado */
.select-minimal {
    appearance: none; 
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 14px;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 8px 24px 8px 10px; 
    border-radius: 8px;
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
}
.select-minimal:hover { background-color: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.2); }
.select-minimal:focus { outline: none; border-color: var(--accent-blue); box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2); }
.select-minimal option { background-color: #18181b; color: #fff; padding: 12px; }

/* Menús Desplegables Personalizados (Reemplazo del <select> nativo) */
.custom-dropdown { 
    position: relative; 
    width: 100%; 
    min-width: 120px; 
    font-family: inherit; 
    user-select: none;
}
.custom-dropdown-trigger { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: 8px 10px; 
    background: rgba(255, 255, 255, 0.03); 
    border: 1px solid rgba(255, 255, 255, 0.1); 
    border-radius: 8px; 
    font-size: 0.8rem; 
    font-weight: 600; 
    cursor: pointer; 
    transition: all 0.2s; 
    color: #fff; 
}
.custom-dropdown-trigger:hover { 
    background: rgba(255, 255, 255, 0.06); 
    border-color: rgba(255, 255, 255, 0.2); 
}
.custom-dropdown-trigger svg { width: 14px; height: 14px; opacity: 0.5; transition: transform 0.2s ease; }
.custom-dropdown.open .custom-dropdown-trigger svg { transform: rotate(180deg); }

.custom-dropdown-options { 
    position: absolute; top: calc(100% + 4px); left: 0; width: 100%; 
    background: #18181b; border: 1px solid #27272a; border-radius: 8px; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.5); z-index: 100; display: none; 
    flex-direction: column; max-height: 200px; overflow-y: auto; padding: 4px;
}
.custom-dropdown-options::-webkit-scrollbar { width: 4px; }
.custom-dropdown-options::-webkit-scrollbar-thumb { background: #3f3f46; border-radius: 4px; }
.custom-dropdown.open .custom-dropdown-options { display: flex; }

.custom-option { 
    padding: 8px 10px; cursor: pointer; transition: background 0.2s; 
    border-radius: 6px; margin-bottom: 2px; display: flex; align-items: center;
    font-size: 0.8rem; font-weight: 500;
}
.custom-option:hover { background: #27272a; }

/* Pastillas de Color Estilo Notion/Google Sheets para el Dropdown Custom */
.color-pill { 
    padding: 4px 10px; border-radius: 6px; font-weight: 700; font-size: 0.75rem; 
    text-align: center; display: inline-block; width: 100%;
}