/* ============================================================
   LumoTV - CSS compartilhado entre páginas (Servers + Apps)
   ============================================================ */
:root {
  --bg: #0a0a0a;
  --card-bg: #161616;
  --card-hover: #1d1d1d;
  --border: #262626;
  --accent: #d4d4d8;
  --accent-hover: #e4e4e7;
  --accent-soft: rgba(255, 255, 255, 0.08);
  --success: #22c55e;
  --warning: #a3a3a3;
  --danger: #a3a3a3;
  --text: #ffffff;
  --text-muted: #a3a3a3;
  --text-faint: #6b6b6b;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; }

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

/* ===== NAV superior ===== */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1100px;
  margin: 0 auto;
}
.nav-logo {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
  text-decoration: none;
}
.nav-links { display: flex; gap: 4px; }
.nav-link {
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: var(--card-hover); color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--accent); }

/* ===== Container ===== */
.container { max-width: 720px; margin: 0 auto; padding: 28px 16px; }
.container-wide { max-width: 1100px; margin: 0 auto; padding: 28px 16px; }

/* ===== Header da página ===== */
.page-header { margin-bottom: 32px; }
.page-header h1 {
  font-size: clamp(1.5rem, 6vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}
.subtitle {
  color: var(--text-muted);
  font-size: clamp(0.9rem, 3vw, 1rem);
  max-width: 500px;
}
.updated {
  margin-top: 12px;
  font-size: 0.75rem;
  color: var(--text-faint);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.updated::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
  display: inline-block;
}

/* ===== Cards (servidor / app) ===== */
.server-card, .app-card, .app-section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 16px;
}

/* ===== Cabeçalho de servidor ===== */
.server-header {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--border);
}
.server-logo {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.server-logo.anubys {
  background: linear-gradient(135deg, #d97706, #f59e0b);
}
.server-info { flex: 1; min-width: 0; }
.server-name {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.server-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.status-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  flex-shrink: 0;
}
.status-badge.online {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

/* ===== Lista de DNS ===== */
.dns-section { padding: 16px 20px; }
.dns-section-title {
  font-size: 0.75rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}
.dns-list { display: flex; flex-direction: column; gap: 8px; }
.dns-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.dns-row-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.dns-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.dns-badge.primary { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.dns-badge.backup { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.dns-host {
  font-family: "SF Mono", Monaco, "Courier New", monospace;
  font-size: 0.9rem;
  font-weight: 600;
  word-break: break-all;
}
.btn-copy {
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
  transition: background 0.15s;
}
.btn-copy:hover { background: rgba(255, 255, 255, 0.12); }
.btn-copy.copied { background: var(--success); color: white; border-color: var(--success); }

/* ===== WebPlayer ===== */
.webplayer-section { padding: 0 20px 20px; }
.webplayer-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--accent-soft);
  border: 1px solid rgba(37, 99, 235, 0.25);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s;
}
.webplayer-link:hover { background: rgba(37, 99, 235, 0.2); }
.wp-left { flex: 1; min-width: 0; }
.wp-title { font-size: 0.9rem; font-weight: 600; }
.wp-url {
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--accent);
  margin-top: 2px;
}
.wp-arrow { color: var(--text-muted); flex-shrink: 0; }

/* ===== Apps (catálogo) ===== */
.apps-list { display: flex; flex-direction: column; gap: 20px; }
.app-header {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--border);
}
.app-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.app-icon.ibo { background: linear-gradient(135deg, #1565c0, #42a5f5); }
.app-icon.smarters { background: linear-gradient(135deg, #c2410c, #f97316); }
.app-info { flex: 1; min-width: 0; }
.app-title { font-size: 1.1rem; font-weight: 700; }
.app-tagline { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

.platforms { padding: 8px; }
.platform {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s;
  border: none;
  width: 100%;
  font-family: inherit;
  font-size: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.platform:hover { background: var(--card-hover); }
.platform + .platform { margin-top: 4px; }
.platform-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.platform-icon svg { width: 20px; height: 20px; }
.platform-text { flex: 1; min-width: 0; }
.platform-name { font-weight: 600; font-size: 0.9rem; }
.platform-meta { font-size: 0.78rem; color: var(--text-faint); margin-top: 1px; }
.platform-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 6px;
  text-transform: uppercase;
  flex-shrink: 0;
}
.platform-badge.free { background: var(--accent-soft); color: var(--text-muted); }
.platform-badge.paid { background: var(--accent-soft); color: var(--text-muted); }
.arrow { color: var(--text-faint); flex-shrink: 0; transition: transform 0.15s; }
.platform:hover .arrow { transform: translateX(3px); }
.arrow svg { width: 18px; height: 18px; display: block; }

/* Code box (Downloader) */
.code-box {
  margin: 8px;
  padding: 14px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.code-info { flex: 1; min-width: 0; }
.code-label {
  font-size: 0.7rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}
.code-value {
  font-family: "SF Mono", Monaco, monospace;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 2px;
}

/* ===== Loading / erro ===== */
.loading { text-align: center; padding: 60px 0; color: var(--text-faint); }
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.error-box {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
}
.error-sub { margin-top: 8px; font-size: 0.85rem; }

/* ===== Footer ===== */
.footer {
  max-width: 1100px;
  margin: 40px auto 0;
  padding: 24px 16px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-faint);
  font-size: 0.85rem;
}
.footer a { color: var(--accent); text-decoration: none; font-weight: 500; }
.copyright { margin-top: 8px; font-size: 0.8rem; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--success);
  color: white;
  padding: 12px 24px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  opacity: 0;
  transition: all 0.3s;
  z-index: 100;
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

@media (max-width: 480px) {
  .container { padding: 20px 12px; }
  .server-header, .app-header { padding: 16px; gap: 12px; }
  .platform { padding: 12px; }
  .nav { padding: 12px 16px; }
}

/* Util */
.hidden { display: none !important; }

/* Descricao expansivel (orientacoes do app) */
.app-orientation {
  margin: 8px;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.orientation-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}
.orientation-toggle:hover { color: var(--text); }
.orientation-arrow {
  transition: transform 0.2s;
  flex-shrink: 0;
}
.orientation-toggle.open .orientation-arrow { transform: rotate(180deg); }
.orientation-content {
  margin-top: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, margin-top 0.3s ease;
}
.orientation-content.open {
  max-height: 500px;
  margin-top: 12px;
}
.orientation-content p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 8px;
}
.orientation-content p:last-child { margin-bottom: 0; }
.orientation-content strong { color: var(--text); font-weight: 600; }

/* ============================================================
   Apps - Toggle de layout (lista / grade)
   ============================================================ */

/* Barra de controle (toggle) */
.layout-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 16px;
}
.layout-toggle {
  display: inline-flex;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.layout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  border-radius: 999px;
  transition: all 0.15s;
  font-family: inherit;
}
.layout-btn:hover { color: var(--text-muted); }
.layout-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.layout-btn svg { width: 18px; height: 18px; }

/* ===== Layout LISTA (padrao) ===== */
.apps-list.layout-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.apps-list.layout-list .app-section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

/* ===== Layout GRADE = App Store por dispositivo ===== */
.store { display: flex; flex-direction: column; gap: 32px; }

.device-section { }
.device-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 0 4px;
}
.device-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--text);
}
.device-icon svg { width: 22px; height: 22px; }
.device-header h2 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.2px;
  flex: 1;
}
.device-count {
  font-size: 0.72rem;
  color: var(--text-faint);
  background: var(--accent-soft);
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 600;
}

.device-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

/* Card de app na loja (compacto, horizontal) */
.store-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s, background 0.15s;
}
.store-card:hover {
  border-color: var(--text-faint);
  background: var(--card-hover);
}
.store-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.store-card-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3f3f46, #52525b);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.store-card-icon svg { width: 24px; height: 24px; }
.store-card-name {
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.store-card-badge {
  font-size: 0.58rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  display: inline-block;
  background: var(--accent-soft);
  color: var(--text-muted);
}
.store-card-tag {
  font-size: 0.68rem;
  color: var(--text-faint);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Botao de download / codigo */
.store-card-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  margin-top: auto;
}
.store-card-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.store-card-btn.code {
  background: var(--accent-soft);
  border-color: var(--border);
  color: var(--text-muted);
  flex-direction: column;
  gap: 4px;
  padding: 6px 10px;
}
.store-card-btn.code .code-num {
  font-family: "SF Mono", Monaco, monospace;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 1px;
}
.store-card-btn.code .code-hint {
  font-size: 0.6rem;
  color: var(--text-faint);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Responsivo da loja */
@media (max-width: 980px) {
  .device-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 720px) {
  .device-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .device-grid { grid-template-columns: 1fr; }
}
