/* ========================================================
   RosaFM Video Panel - Tipografía Montserrat Global
   ======================================================== */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,400&display=swap');

:root {
  --font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --bg-main: #0b0f19;
  --bg-card: #111827;
  --bg-card-sub: #162032;
  --bg-input: #1e293b;
  --border-color: #243248;
  --border-focus: #e11d48;
  --primary: #f43f5e;
  --primary-hover: #e11d48;
  --primary-gradient: linear-gradient(135deg, #f43f5e 0%, #be123c 100%);
  --accent-purple: #8b5cf6;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 35px -5px rgba(0, 0, 0, 0.7);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-family) !important;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ==================== VISTA LOGIN ==================== */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: radial-gradient(circle at 50% 20%, #201735 0%, #0b0f19 70%);
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 40px 36px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(244, 63, 94, 0.15);
  color: var(--primary);
  border: 1px solid rgba(244, 63, 94, 0.3);
  padding: 6px 14px;
  border-radius: 30px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 20px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 10px var(--primary);
  animation: pulse 1.5s infinite;
}

.live-dot-red {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 10px #ef4444;
  animation: pulse 1.5s infinite;
}

.auth-card h2 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #ffffff 40%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 30px;
}

.auth-footer {
  margin-top: 25px;
  color: var(--text-dim);
  font-size: 0.8rem;
}

/* ==================== FORMULARIOS ==================== */
.form-group {
  text-align: left;
  margin-bottom: 20px;
}

.form-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="text"],
input[type="password"],
select {
  width: 100%;
  padding: 13px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s ease;
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.2);
}

.input-password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-password-wrapper input {
  padding-right: 48px;
}

.btn-eye {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
}

.btn-eye:hover {
  color: var(--text-main);
}

.hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 5px;
}

.input-disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ==================== BOTONES ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary-gradient);
  color: white;
  box-shadow: 0 4px 15px rgba(244, 63, 94, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #e11d48 0%, #9f1239 100%);
  transform: translateY(-1px);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-copy {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
}

.btn-copy:hover {
  color: #fff;
  border-color: var(--primary);
  background: rgba(244, 63, 94, 0.1);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.82rem;
}

.btn-xs {
  padding: 5px 10px;
  font-size: 0.75rem;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-color: #ef4444;
}

/* ==================== ALERTAS ==================== */
.alert-box {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.alert-box.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.alert-box.success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
}

.alert-box.info {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #93c5fd;
}

/* ==================== NAVBAR ==================== */
.top-nav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 14px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: white;
  box-shadow: 0 4px 12px rgba(244, 63, 94, 0.4);
}

.nav-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.nav-sub {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-pill {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
}

.badge-role {
  background: var(--primary);
  color: white;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.user-name {
  font-weight: 600;
  color: var(--text-main);
}

/* ==================== CONTENEDOR PRINCIPAL ==================== */
.main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 24px;
}

/* Banner de Cupos */
.dashboard-banner {
  background: linear-gradient(135deg, #162032 0%, #1e1b4b 100%);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 26px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  flex-wrap: wrap;
  gap: 20px;
}

.dashboard-banner h2 {
  font-size: 1.45rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.dashboard-banner p {
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 550px;
}

.slots-card {
  background: rgba(11, 15, 25, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 16px 20px;
  min-width: 260px;
}

.slots-info {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.slots-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.slots-count {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary);
}

.slots-progress {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 14px;
}

.slots-bar {
  height: 100%;
  background: var(--primary-gradient);
  border-radius: 10px;
  transition: width 0.4s ease;
}

/* ==================== TARJETAS DE USUARIOS ==================== */
.section-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.section-title-bar h3 {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 24px;
  margin-bottom: 35px;
}

.user-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, border-color 0.2s;
}

.user-card:hover {
  transform: translateY(-2px);
  border-color: #3b82f6;
}

.user-card.is-live {
  border-color: var(--primary);
  box-shadow: 0 0 20px rgba(244, 63, 94, 0.2);
}

.card-header {
  padding: 18px 20px;
  background: var(--bg-card-sub);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title-box h4 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 3px;
}

.card-title-box small {
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 600;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.status-badge.live {
  background: rgba(244, 63, 94, 0.2);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.4);
}

.status-badge.offline {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.status-badge.paused {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.status-badge.live .status-dot {
  animation: pulse 1.5s infinite;
}

.card-body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cred-item {
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cred-item-info {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.cred-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.cred-code {
  font-size: 0.85rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.cred-code.highlight-m3u8 {
  color: #38bdf8;
  font-weight: 600;
}

.card-actions {
  padding: 14px 20px;
  background: var(--bg-card-sub);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* ==================== GUÍA DE OPERACIÓN ==================== */
.guide-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  margin-top: 20px;
}

.guide-header h4 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.guide-card {
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 18px;
}

.guide-card h5 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 6px;
}

.guide-card ol {
  padding-left: 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guide-card li strong {
  color: var(--text-main);
}

.copy-inline {
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: 4px;
  color: #f43f5e;
  font-size: 0.8rem;
  font-weight: 600;
}

/* ==================== VISTA DE USUARIO EMISOR ==================== */
.user-welcome-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 26px 30px;
  margin-bottom: 25px;
}

.user-status-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 25px;
  flex-wrap: wrap;
  gap: 14px;
}

.user-status-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-top: 8px;
  margin-bottom: 4px;
}

.user-status-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.credentials-box {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cred-row {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.cred-row.highlight {
  border-color: rgba(244, 63, 94, 0.4);
  background: linear-gradient(90deg, rgba(244, 63, 94, 0.08) 0%, rgba(17, 24, 39, 0.5) 100%);
}

.cred-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}

.cred-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cred-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  word-break: break-all;
}

.cred-value.link {
  color: #38bdf8;
}

.cred-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==================== REPRODUCTOR EN VIVO ==================== */
.user-player-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 24px;
}

.hint-text {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.player-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  margin-top: 14px;
}

.player-wrapper video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.player-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(11, 15, 25, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 5;
  text-align: center;
  padding: 20px;
}

.player-overlay h4 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 12px;
  margin-bottom: 6px;
}

.player-overlay p {
  color: var(--text-muted);
  font-size: 0.85rem;
  max-width: 420px;
}

.pulse-icon {
  font-size: 3rem;
  color: var(--primary);
  animation: pulse 2s infinite;
}

/* ==================== MODALES ==================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalFade 0.2s ease-out;
}

.modal-box.modal-lg {
  max-width: 820px;
}

@keyframes modalFade {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 18px 24px;
  background: var(--bg-card-sub);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: #fff;
}

.modal-box form {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.modal-body-player {
  padding: 20px;
}

.player-meta-box {
  margin-top: 14px;
  background: var(--bg-input);
  border-radius: 10px;
  padding: 12px 16px;
}

.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.85rem;
}

.meta-row code {
  color: #38bdf8;
  word-break: break-all;
}

/* ==================== TOAST ==================== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card-sub);
  border: 1px solid var(--primary);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ==================== ANIMACIONES ==================== */
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.95); }
}

/* Responsive */
@media (max-width: 640px) {
  .top-nav {
    padding: 12px 16px;
  }
  .main-container {
    padding: 20px 12px;
  }
  .users-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-banner {
    padding: 20px;
  }
  .slots-card {
    width: 100%;
  }
}
