/**
 * Dark Studio - Gestão de Canais Dark do YouTube
 * Estilos Modernos, Responsivos e Otimizados para Mobile & Desktop
 */

:root {
  --bg-main: #0b0f19;
  --bg-card: #111827;
  --bg-card-hover: #162032;
  --bg-input: #1f2937;
  --bg-modal: #0f172a;

  --border-color: #1e293b;
  --border-focus: #ef4444;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --yt-red: #ef4444;
  --yt-red-dark: #dc2626;
  --yt-red-glow: rgba(239, 68, 68, 0.25);

  --accent-green: #10b981;
  --accent-green-bg: rgba(16, 185, 129, 0.15);
  --accent-amber: #f59e0b;
  --accent-amber-bg: rgba(245, 158, 11, 0.15);
  --accent-blue: #3b82f6;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px var(--yt-red-glow);

  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* Layout Container */
.container {
  max-width: 1380px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ========================================================
   NAVBAR & HEADER
======================================================== */
.navbar {
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  padding: 0 16px;
  max-width: 1380px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-main);
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.brand-badge {
  font-size: 0.65rem;
  text-transform: uppercase;
  background: var(--yt-red);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

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

/* Indicador de Sessão e Expiração de 1 minuto */
.session-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.7; }
}

.token-timer {
  font-variant-numeric: tabular-nums;
  color: var(--accent-amber);
  font-weight: 600;
}

/* ========================================================
   DASHBOARD STATS
======================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 16px;
  margin: 24px 0;
}

@media (min-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
}

.stat-card:hover {
  border-color: #334155;
  transform: translateY(-2px);
}

.stat-info h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}

.stat-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-red { background: rgba(239, 68, 68, 0.15); color: var(--yt-red); }
.icon-green { background: var(--accent-green-bg); color: var(--accent-green); }
.icon-blue { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.icon-amber { background: var(--accent-amber-bg); color: var(--accent-amber); }

/* ========================================================
   CONTROLS & ACTION BAR
======================================================== */
.controls-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (min-width: 768px) {
  .controls-bar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.search-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex: 1;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.search-input-wrap input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 10px 14px 10px 36px;
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}

.search-input-wrap input:focus {
  border-color: var(--yt-red);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.select-filter {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 10px 14px;
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
}

.select-filter:focus {
  border-color: var(--yt-red);
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ========================================================
   BUTTONS
======================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  outline: none;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--yt-red);
  color: #fff;
}
.btn-primary:hover {
  background: var(--yt-red-dark);
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  background: #1e293b;
  color: var(--text-main);
  border: 1px solid #334155;
}
.btn-secondary:hover {
  background: #334155;
  color: #fff;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.2);
  color: var(--yt-red);
  border: 1px solid rgba(239, 68, 68, 0.4);
}
.btn-danger:hover {
  background: var(--yt-red);
  color: #fff;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 0.8rem;
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
}
.btn-icon:hover {
  background: #1e293b;
  color: #fff;
}

/* ========================================================
   CHANNELS GRID & CARDS
======================================================== */
.channels-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 20px;
  margin-bottom: 40px;
}

@media (min-width: 640px) {
  .channels-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1100px) {
  .channels-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.channel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.channel-card:hover {
  border-color: #334155;
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.channel-card.monetized::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #10b981, #059669);
}

.channel-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.channel-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  background: #1e293b;
  border: 2px solid #334155;
  flex-shrink: 0;
}

.channel-main-info {
  flex: 1;
  min-width: 0;
}

.channel-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-handle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
}
.channel-handle:hover {
  color: var(--yt-red);
}

.badge-monetized {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

.badge-monetized.yes {
  background: var(--accent-green-bg);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

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

/* Inscritos em Tempo Real */
.subs-counter-box {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.subs-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.subs-number {
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.subs-updated {
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* Credenciais Sensíveis (Proteção & Ocultamento) */
.credentials-box {
  background: #090e17;
  border: 1px solid #1e293b;
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.cred-label {
  color: var(--text-dim);
  font-size: 0.75rem;
  min-width: 50px;
}

.cred-value {
  flex: 1;
  font-family: monospace;
  color: #cbd5e1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cred-value.revealed {
  color: #38bdf8;
  font-weight: 600;
}

.reveal-timer {
  font-size: 0.7rem;
  color: var(--accent-amber);
  margin-left: 4px;
}

/* Tags */
.channel-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-pill {
  font-size: 0.72rem;
  background: rgba(30, 41, 59, 0.7);
  color: #cbd5e1;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid #334155;
}

/* Card Footer Actions */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
  margin-top: 4px;
}

/* ========================================================
   MODALS
======================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-modal);
  border: 1px solid #334155;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: transform 0.25s ease;
}

.modal-overlay.active .modal {
  transform: scale(1);
}

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

.modal-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

/* Form Styles */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #cbd5e1;
}

.form-group input,
.form-group textarea,
.form-group select {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 10px 14px;
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--yt-red);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.input-with-action {
  display: flex;
  gap: 8px;
}
.input-with-action input {
  flex: 1;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Switch Monetizado */
.switch-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #090e17;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #334155;
  transition: 0.3s;
  border-radius: 26px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent-green);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

/* ========================================================
   TOAST NOTIFICATIONS
======================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
}

.toast {
  background: #1e293b;
  border: 1px solid #334155;
  color: #fff;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  max-width: 380px;
  animation: slideIn 0.3s ease forwards;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast.success { border-left: 4px solid var(--accent-green); }
.toast.error { border-left: 4px solid var(--yt-red); }
.toast.warning { border-left: 4px solid var(--accent-amber); }
.toast.info { border-left: 4px solid var(--accent-blue); }

/* ========================================================
   LOGIN PAGE
======================================================== */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: radial-gradient(circle at 50% 20%, #1e1b4b 0%, #090d16 60%, #04060a 100%);
}

.login-card {
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid #1e293b;
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(16px);
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo {
  width: 56px;
  height: 56px;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 16px rgba(239, 68, 68, 0.4));
}

.login-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.login-security-notice {
  margin-top: 24px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px dashed #334155;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

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

.loading-text {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 1rem;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 40px;
}
.empty-state h3 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}
.empty-state p {
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 400px;
  margin: 0 auto 20px auto;
}
