@import url('reset.css?v=6');
@import url('variables.css?v=6');
@import url('animations.css?v=6');
@import url('components.css?v=6');

/* ======================================================
   STYLE.CSS — layout geral, tela de auth, app shell
   ====================================================== */

html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-base);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
}

/* ===== Loading ===== */
#loading-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 999;
}
.loading-inner { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.loading-logo {
  font-size: 2.5rem;
  color: var(--primary);
  animation: pulseSoft 1.4s ease-in-out infinite;
}
.loading-bar {
  width: 160px; height: 4px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.loading-fill {
  height: 100%;
  width: 60%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 999px;
  animation: shimmer 1.5s ease-in-out infinite;
  background-size: 200% auto;
}

/* ===== Config error ===== */
#config-error {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.config-error-box {
  max-width: 420px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 24px;
  box-shadow: var(--shadow);
}
.config-error-box i { font-size: 2rem; color: var(--warning); margin-bottom: 12px; display: block; }
.config-error-box h2 { font-size: 1.1rem; margin-bottom: 10px; }
.config-error-box p { color: var(--text-muted); font-size: 0.88rem; }
.config-error-box code { font-family: var(--font-mono); color: var(--accent); font-size: 0.82rem; }

/* ===== Auth ===== */
#auth-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  position: relative;
}
.auth-bg {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(0,229,160,0.06) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(56,189,248,0.05) 0%, transparent 60%);
  pointer-events: none;
}
.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow);
}
@media (min-width: 480px) { .auth-card { padding: 32px 28px; } }

.auth-header { text-align: center; margin-bottom: 22px; }
.auth-logo {
  width: 60px; height: 60px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: var(--primary-dim);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 0 24px var(--primary-glow);
}
.auth-header h1 { font-size: 1.3rem; font-weight: 700; }
.auth-tagline { color: var(--text-muted); font-size: 0.82rem; margin-top: 4px; }

.auth-tabs {
  display: flex;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 20px;
  gap: 2px;
}
.auth-tab {
  flex: 1;
  min-height: 40px;
  border-radius: 6px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.88rem;
  transition: background 0.15s, color 0.15s;
}
.auth-tab:hover { color: var(--text); }
.auth-tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.invite-note {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.auth-error {
  background: var(--danger-dim);
  border: 1px solid rgba(244,63,94,0.2);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.82rem;
  margin-bottom: 14px;
}

/* ===== App shell ===== */
#app { display: flex; min-height: 100dvh; }

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 60;
  overflow: hidden;
  transition: width 0.2s ease;
}

/* Collapsed on tablet */
@media (min-width: 768px) and (max-width: 1099px) {
  .sidebar { width: var(--sidebar-w-sm); }
  .sidebar-brand-name,
  .sidebar-link .link-label,
  .sidebar-logout .link-label,
  .suc-info,
  .sidebar-footer .sidebar-logout { }
}

/* Hidden on mobile */
@media (max-width: 767px) {
  .sidebar { display: none; }
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-brand-icon {
  width: 36px; height: 36px;
  background: var(--primary-dim);
  color: var(--primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
  box-shadow: 0 0 12px var(--primary-glow);
}
.sidebar-brand-name {
  font-weight: 700;
  font-size: 0.88rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
}
/* Hide text on tablet-sized sidebar */
@media (max-width: 1099px) {
  .sidebar-brand-name { display: none; }
  .sidebar-link .link-label,
  .sidebar-logout .link-label { display: none; }
  .suc-info { display: none; }
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.88rem;
  text-align: left;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  position: relative;
  min-height: 44px;
}
.sidebar-link i { font-size: 1rem; flex-shrink: 0; width: 20px; text-align: center; }
.sidebar-link:hover { background: var(--surface-2); color: var(--text); }
.sidebar-link.active { background: var(--primary-dim); color: var(--primary); }
.sidebar-link.active i { color: var(--primary); }

/* Tooltip on collapsed sidebar */
.nav-tooltip {
  display: none;
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.78rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  z-index: 200;
  box-shadow: var(--shadow-sm);
}
.nav-tooltip::before {
  content: '';
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-right-color: var(--surface-3);
}
@media (min-width: 768px) and (max-width: 1099px) {
  .sidebar-link:hover .nav-tooltip,
  .sidebar-logout:hover .nav-tooltip { display: block; }
}

.sidebar-footer {
  padding: 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  text-align: left;
  width: 100%;
  overflow: hidden;
}
.sidebar-user-card:hover { background: var(--surface-2); }
.suc-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.88rem;
  flex-shrink: 0;
  color: #fff;
}
.suc-info { min-width: 0; flex: 1; overflow: hidden; }
.suc-name {
  font-weight: 600;
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}
.suc-level-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  margin-top: 2px;
}
.suc-level-wrap i { font-size: 0.68rem; }

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  text-align: left;
  width: 100%;
  position: relative;
  min-height: 44px;
}
.sidebar-logout i { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-logout:hover { background: var(--danger-dim); color: var(--danger); }

/* ===== App body (right of sidebar) ===== */
.app-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  overflow-x: hidden;
}
@media (min-width: 768px) and (max-width: 1099px) {
  .app-body { margin-left: var(--sidebar-w-sm); }
}
@media (min-width: 1100px) {
  .app-body { margin-left: var(--sidebar-w); }
}
@media (max-width: 767px) {
  .app-body { margin-left: 0; }
}

/* ===== Mobile header ===== */
.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px 10px;
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(10,14,20,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
@media (max-width: 767px) { .mobile-header { display: flex; } }
.mobile-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
}
.mobile-brand i { color: var(--primary); }
.mobile-header-right {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
#header-user-name {
  font-size: 0.78rem;
  color: var(--text-muted);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.level-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* ===== Desktop tab header ===== */
.tab-page-header {
  padding: 28px 28px 0;
  margin-bottom: 20px;
}
.tab-page-header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.tab-page-header p { color: var(--text-muted); font-size: 0.88rem; }

/* ===== Main content ===== */
.app-main {
  flex: 1;
  width: 100%;
  padding: 24px 32px calc(24px + env(safe-area-inset-bottom, 0px));
}
@media (max-width: 767px) {
  .app-main {
    padding: 16px 16px calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 16px);
  }
}
@media (min-width: 768px) and (max-width: 1099px) {
  .app-main { padding: 24px 20px; }
}

.tab { animation: fadeUp 0.25s cubic-bezier(0.22,1,0.36,1) both; }

/* ===== Palpites top ===== */
.palpites-top {
  margin-bottom: 4px;
}

/* ===== Bottom nav (mobile only) ===== */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(17,23,34,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  justify-content: center;
  z-index: 60;
}
@media (max-width: 767px) { .bottom-nav { display: flex; } }
.nav-btn {
  flex: 1;
  max-width: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 600;
  transition: color 0.15s;
  position: relative;
}
.nav-btn i { font-size: 1.1rem; }
.nav-btn.active { color: var(--primary); }

/* ===== Section header on desktop ===== */
.desktop-section-header {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 0 0 20px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
@media (min-width: 768px) { .desktop-section-header { display: flex; } }
.desktop-section-header h1 { font-size: 1.4rem; font-weight: 700; }
.desktop-section-header p { color: var(--text-muted); font-size: 0.85rem; }
.dsh-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  background: var(--primary-dim);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
