/* =====================================================
   MultiLive — Design System
   Fonte: Space Grotesk (display) + Inter (corpo)
   Paleta: dark void, roxo profundo, violeta brilhante
===================================================== */

:root {
  /* Cores base */
  --void:      #07070a;
  --surface:   #10101a;
  --panel:     #15151f;
  --border:    rgba(255,255,255,0.07);
  --border-hi: rgba(108,63,255,0.45);

  /* Acento */
  --accent:    #6c3fff;
  --accent-hi: #9b6bff;
  --accent-glow: rgba(108,63,255,0.35);

  /* Texto */
  --text:      #e8e8f0;
  --muted:     rgba(232,232,240,0.45);
  --label:     rgba(232,232,240,0.70);

  /* Feedback */
  --red:       #ff4d6a;
  --green:     #3ddc84;
  --red-bg:    rgba(255,77,106,0.12);
  --green-bg:  rgba(61,220,132,0.12);

  /* Motion */
  --ease: cubic-bezier(.4,0,.2,1);
  --fast: 160ms;
  --mid:  300ms;
}

/* ===== RESET ===== */
*, *::before, *::after {
  margin: 0; padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html { font-size: 16px; }

body {
  background: var(--void);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ===== TIPOGRAFIA ===== */
.logo,
.auth-logo,
h1, h2, h3 {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  letter-spacing: -0.02em;
}

/* ===== AUTH SCREEN ===== */
#auth-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  background: var(--void);
  overflow-y: auto;
  padding: 2rem 1rem;
}

#auth-screen.hidden { display: none; }

/* Glow de fundo decorativo */
.auth-bg-glow {
  position: fixed;
  top: -30%;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: 500px;
  background: radial-gradient(ellipse at center,
    rgba(108,63,255,0.18) 0%,
    transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.auth-container {
  position: relative;
  z-index: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow:
    0 0 0 1px rgba(108,63,255,0.1),
    0 30px 80px rgba(0,0,0,0.6),
    0 0 60px rgba(108,63,255,0.08);
  padding: 2.75rem 2.5rem;
  width: 100%;
  max-width: 440px;
  animation: slideUp var(--mid) var(--ease) both;
}

@keyframes slideUp {
  from { opacity:0; transform:translateY(24px); }
  to   { opacity:1; transform:translateY(0); }
}

.auth-header {
  text-align: center;
  margin-bottom: 2.25rem;
}

.auth-logo {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 10px;
  font-size: 1rem;
  color: #fff;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.auth-subtitle {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Abas */
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 2rem;
  gap: 4px;
}

.auth-tab {
  background: transparent;
  color: var(--muted);
  border: none;
  border-radius: 9px;
  padding: 0.7rem 1rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background var(--fast) var(--ease),
              color var(--fast) var(--ease);
}

.auth-tab:hover { color: var(--text); }

.auth-tab.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}

/* Formulários */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  margin-bottom: 1.25rem;
}

.auth-form.hidden { display: none; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--label);
  letter-spacing: 0.01em;
}

.label-hint {
  font-weight: 400;
  color: var(--muted);
}

.form-group input {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  color: var(--text);
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  transition: border-color var(--fast) var(--ease),
              box-shadow var(--fast) var(--ease);
  width: 100%;
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent-hi);
  box-shadow: 0 0 0 3px rgba(108,63,255,0.18);
}

.form-group input::placeholder { color: rgba(255,255,255,0.25); }

/* Wrapper de senha com botão olho */
.input-password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-password-wrap input {
  padding-right: 2.8rem;
}

.btn-toggle-pw {
  position: absolute;
  right: 0.75rem;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.25rem;
  font-size: 1rem;
  border-radius: 4px;
  transition: color var(--fast);
  line-height: 1;
}

.btn-toggle-pw:hover { color: var(--text); }

/* Indicador de força de senha */
.password-strength {
  height: 3px;
  border-radius: 99px;
  background: var(--border);
  overflow: hidden;
  transition: background var(--mid);
  margin-top: 0.2rem;
}

.password-strength::after {
  content: '';
  display: block;
  height: 100%;
  width: var(--strength, 0%);
  border-radius: 99px;
  background: var(--strength-color, var(--accent));
  transition: width var(--mid) var(--ease), background var(--mid);
}

/* Erro de auth */
.auth-error {
  display: none;
  background: var(--red-bg);
  border: 1px solid rgba(255,77,106,0.25);
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  color: var(--red);
  font-size: 0.84rem;
  text-align: center;
  animation: shake var(--fast) var(--ease);
}

.auth-error.show { display: block; }

@keyframes shake {
  0%,100% { transform:translateX(0); }
  25%      { transform:translateX(-6px); }
  75%      { transform:translateX(6px); }
}

/* Botão primário de auth */
.auth-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.88rem 1rem;
  font-weight: 700;
  font-size: 0.95rem;
  font-family: 'Space Grotesk', sans-serif;
  cursor: pointer;
  transition: background var(--fast) var(--ease),
              transform var(--fast) var(--ease),
              box-shadow var(--fast) var(--ease);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  position: relative;
}

.auth-btn:hover:not(:disabled) {
  background: var(--accent-hi);
  box-shadow: 0 6px 24px var(--accent-glow);
  transform: translateY(-1px);
}

.auth-btn:active:not(:disabled) { transform: translateY(0); }

.auth-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Spinner de carregamento */
.btn-spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.btn-spinner.hidden { display: none; }

@keyframes spin { to { transform: rotate(360deg); } }

/* Divider */
.auth-divider {
  text-align: center;
  color: var(--muted);
  margin: 1.25rem 0 1rem;
  font-size: 0.82rem;
  position: relative;
}

.auth-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0; right: 0;
  height: 1px;
  background: var(--border);
  z-index: 0;
}

.auth-divider span {
  background: var(--panel);
  padding: 0 0.75rem;
  position: relative;
  z-index: 1;
}

/* Botão visitante */
.guest-btn {
  width: 100%;
  padding: 0.82rem 1rem;
  background: transparent;
  color: var(--label);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: color var(--fast) var(--ease),
              border-color var(--fast) var(--ease),
              background var(--fast) var(--ease);
}

.guest-btn:hover {
  color: var(--text);
  border-color: var(--border-hi);
  background: rgba(108,63,255,0.06);
}

/* ===== HEADER ===== */
header {
  padding: 0.9rem 1.75rem;
  background: rgba(10,10,16,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 200;
  gap: 1rem;
  transition: transform var(--mid) var(--ease),
              opacity var(--mid) var(--ease);
}

body.header-hidden header {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.logo {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  user-select: none;
}

.logo .logo-icon {
  width: 28px;
  height: 28px;
  font-size: 0.75rem;
  border-radius: 7px;
}

/* Badge contador de lives */
.live-count-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-hi);
  background: rgba(108,63,255,0.15);
  border: 1px solid rgba(108,63,255,0.25);
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
  display: none;
}

.live-count-badge.visible { display: block; }

.controls-top {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex: 1;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* Input de URL */
.input-group {
  display: flex;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color var(--fast) var(--ease),
              box-shadow var(--fast) var(--ease);
  max-width: 380px;
  width: 100%;
}

.input-group:focus-within {
  border-color: var(--accent-hi);
  box-shadow: 0 0 0 3px rgba(108,63,255,0.14);
}

.input-icon {
  padding: 0 0 0 0.85rem;
  color: var(--muted);
  font-size: 0.9rem;
  pointer-events: none;
  flex-shrink: 0;
}

#live-url {
  background: transparent;
  border: none;
  padding: 0.7rem 0.75rem;
  color: var(--text);
  font-size: 0.88rem;
  flex: 1;
  min-width: 0;
  outline: none;
  font-family: 'Inter', sans-serif;
}

#live-url::placeholder { color: var(--muted); }

.btn-add {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.7rem 1.1rem;
  font-weight: 700;
  font-size: 0.85rem;
  font-family: 'Space Grotesk', sans-serif;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background var(--fast) var(--ease);
  border-radius: 0;
}

.btn-add:hover { background: var(--accent-hi); }

/* Ações do header */
.header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

.btn-icon {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.05);
  color: var(--label);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  padding: 0;
  transition: background var(--fast) var(--ease),
              color var(--fast) var(--ease),
              border-color var(--fast) var(--ease);
}

.btn-icon:hover {
  background: rgba(255,255,255,0.09);
  color: var(--text);
  border-color: var(--border-hi);
}

/* Badge do usuário */
.user-badge {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--label);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  padding: 0.35rem 0.75rem;
  border-radius: 99px;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-logout {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--fast), background var(--fast), border-color var(--fast);
}

.btn-logout:hover {
  color: var(--red);
  border-color: rgba(255,77,106,0.4);
  background: var(--red-bg);
}

/* ===== MINI HEADER ===== */
#mini-header {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15,15,22,0.92);
  color: var(--label);
  padding: 0.45rem 1.25rem;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  z-index: 9999;
  display: none;
  border: 1px solid var(--border-hi);
  backdrop-filter: blur(12px);
  transition: background var(--fast), color var(--fast), box-shadow var(--fast);
  user-select: none;
}

#mini-header:hover {
  background: rgba(108,63,255,0.2);
  color: var(--text);
  box-shadow: 0 4px 16px var(--accent-glow);
}

body.header-hidden #mini-header { display: block; }

/* ===== MAIN ===== */
main {
  flex: 1;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

#lives-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 1rem;
  width: 100%;
  transition: all var(--mid) var(--ease);
}

/* ===== LIVE CONTAINER ===== */
.live-container {
  position: relative;
  background: var(--surface);
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border);
  box-shadow: 0 8px 30px rgba(0,0,0,0.35);
  animation: fadeIn 0.4s var(--ease) both;
  transition: border-color var(--fast) var(--ease),
              box-shadow var(--fast) var(--ease);
}

.live-container:hover {
  border-color: rgba(108,63,255,0.3);
  box-shadow: 0 8px 30px rgba(0,0,0,0.35),
              0 0 0 1px rgba(108,63,255,0.15);
}

.live-container iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

@keyframes fadeIn {
  from { opacity:0; transform:scale(0.97); }
  to   { opacity:1; transform:scale(1); }
}

/* Overlay de controles */
.live-overlay {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity var(--fast) var(--ease),
              transform var(--fast) var(--ease);
  z-index: 10;
}

.live-container:hover .live-overlay {
  opacity: 1;
  transform: translateY(0);
}

/* Indicador de plataforma */
.live-platform-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
  backdrop-filter: blur(6px);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity var(--fast) var(--ease),
              transform var(--fast) var(--ease);
  pointer-events: none;
  z-index: 10;
}

.live-container:hover .live-platform-badge {
  opacity: 1;
  transform: translateY(0);
}

.live-platform-badge.youtube {
  background: rgba(255,0,0,0.75);
  color: #fff;
}

.live-platform-badge.twitch {
  background: rgba(100,65,165,0.85);
  color: #fff;
}

.control-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(7,7,10,0.8);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  padding: 0;
  cursor: pointer;
  transition: background var(--fast) var(--ease),
              border-color var(--fast) var(--ease),
              transform var(--fast) var(--ease);
  backdrop-filter: blur(8px);
}

.control-btn:hover {
  background: var(--accent);
  border-color: transparent;
  transform: scale(1.08);
}

.btn-remove:hover {
  background: var(--red);
}

/* Estado vazio */
.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  gap: 1rem;
  color: var(--muted);
  text-align: center;
}

.empty-state-icon {
  font-size: 3rem;
  opacity: 0.4;
}

.empty-state-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--label);
}

.empty-state-hint {
  font-size: 0.85rem;
  max-width: 320px;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.85rem 1.4rem;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  transform: translateY(80px);
  opacity: 0;
  transition: transform var(--mid) var(--ease),
              opacity var(--mid) var(--ease);
  z-index: 2000;
  font-size: 0.88rem;
  font-weight: 500;
  max-width: 320px;
  pointer-events: none;
}

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

.toast.error  { border-left: 3px solid var(--red);   }
.toast.success{ border-left: 3px solid var(--green);  }
.toast.info   { border-left: 3px solid var(--accent); }

/* ===== FULLSCREEN ===== */
body.fullscreen-mode header,
body.fullscreen-mode #mini-header { display: none !important; }

body.fullscreen-mode main {
  padding: 0;
  height: 100vh;
}

body.fullscreen-mode #lives-grid {
  height: 100%;
  gap: 0;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  grid-auto-rows: 1fr;
}

body.fullscreen-mode .live-container {
  border-radius: 0;
  border: 1px solid rgba(255,255,255,0.03);
}

#exit-fs {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: none;
  background: rgba(10,10,16,0.9);
  border: 1px solid var(--border-hi);
  border-radius: 99px;
  padding: 0.7rem 1.75rem;
  color: var(--text);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: background var(--fast), box-shadow var(--fast);
}

body.fullscreen-mode #exit-fs { display: flex; }

#exit-fs:hover {
  background: rgba(108,63,255,0.3);
  box-shadow: 0 4px 20px var(--accent-glow);
}

/* ===== RESPONSIVO ===== */
@media (max-width: 768px) {
  header {
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    gap: 0.75rem;
  }

  .controls-top {
    width: 100%;
    justify-content: stretch;
  }

  .input-group {
    max-width: 100%;
    flex: 1;
  }

  #lives-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .live-container {
    aspect-ratio: 16 / 9;
  }

  .auth-container {
    padding: 2rem 1.5rem;
  }
}

@media (max-width: 480px) {
  .logo { font-size: 1.2rem; }

  .btn-add {
    padding: 0.7rem 0.85rem;
    font-size: 0.82rem;
  }

  .control-btn { width: 30px; height: 30px; font-size: 0.85rem; }

  .auth-container { padding: 1.75rem 1.25rem; }
  .auth-logo { font-size: 1.9rem; }
}

/* ===== ACESSIBILIDADE ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

:focus-visible {
  outline: 2px solid var(--accent-hi);
  outline-offset: 2px;
  border-radius: 4px;
}