@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Barlow:wght@700;800;900&display=swap');

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

:root {
  /* Cores navy */
  --navy:       #0b1829;
  --navy-2:     #0f2030;
  --navy-3:     #132840;
  --navy-card:  #0e1f33;
  --border:     #1a3050;
  --border-h:   #234570;
  /* Accent */
  --cyan:       #00d4ff;
  --cyan-2:     #00b8e0;
  --cyan-dim:   rgba(0,212,255,.12);
  --green:      #00e676;
  --green-dim:  rgba(0,230,118,.12);
  /* Texto */
  --white:      #ffffff;
  --gray-1:     #ccd8e8;
  --gray-2:     #7a9ab8;
  --gray-3:     #354d65;
  /* Sidebar */
  --sidebar-w:  300px;
  --topbar-h:   56px;
  /* Fontes */
  --font:       'Inter', sans-serif;
  --font-head:  'Barlow', sans-serif;
  --radius:     10px;
}

html { scroll-behavior: smooth; }
body {
  background: var(--navy);
  color: var(--white);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ══════════════════════════════════════════════
   TOPBAR
══════════════════════════════════════════════ */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--navy-2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 1.25rem; gap: 1.5rem;
  z-index: 300;
}

.topbar-left { display: flex; align-items: center; gap: .75rem; }

.sidebar-toggle {
  background: none; border: none; cursor: pointer;
  color: var(--gray-2); padding: .4rem;
  border-radius: 8px; display: flex; align-items: center;
  transition: color .2s, background .2s;
}
.sidebar-toggle:hover { color: var(--cyan); background: var(--cyan-dim); }

.topbar-logo {
  font-family: var(--font-head);
  font-size: 1.25rem; font-weight: 900;
  color: var(--white); text-decoration: none;
  letter-spacing: -.02em; white-space: nowrap;
}
.topbar-logo span { color: var(--cyan); }

.topbar-nav { display: flex; gap: 1.25rem; }
.tlink {
  font-size: .83rem; font-weight: 500;
  color: var(--gray-2); text-decoration: none;
  transition: color .2s;
}
.tlink:hover, .tlink.active { color: var(--white); }

.topbar-right {
  margin-left: auto; display: flex;
  align-items: center; gap: .75rem;
}

.search-box {
  display: flex; align-items: center; gap: .45rem;
  background: var(--navy-3); border: 1px solid var(--border);
  border-radius: 8px; padding: .38rem .75rem;
  color: var(--gray-2);
  transition: border-color .2s;
}
.search-box:focus-within { border-color: var(--cyan); color: var(--cyan); }
#searchInput {
  background: none; border: none; outline: none;
  color: var(--white); font-family: var(--font);
  font-size: .83rem; width: 180px;
}
#searchInput::placeholder { color: var(--gray-3); }

.live-pill {
  display: flex; align-items: center; gap: .4rem;
  background: var(--green-dim);
  border: 1px solid rgba(0,230,118,.25);
  border-radius: 20px; padding: .28rem .7rem;
  font-size: .68rem; font-weight: 700;
  color: var(--green); text-transform: uppercase; letter-spacing: .06em;
}
.live-dot {
  width: 6px; height: 6px; background: var(--green);
  border-radius: 50%; animation: pulse 1.8s ease infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.2} }

/* ══════════════════════════════════════════════
   LAYOUT: sidebar + main
══════════════════════════════════════════════ */
.layout {
  display: flex;
  padding-top: var(--topbar-h);
  min-height: 100vh;
}

/* ══════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--navy-2);
  border-right: 1px solid var(--border);
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  display: flex; flex-direction: column;
  transition: width .3s ease, min-width .3s ease, opacity .3s ease;
  overflow-x: hidden;
}

/* Sidebar fechada */
.layout.sidebar-closed .sidebar {
  width: 0; min-width: 0; opacity: 0; pointer-events: none;
}

.sidebar-head {
  padding: 1.25rem 1rem 1rem;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo {
  display: flex; align-items: center; gap: .65rem;
}
.sidebar-logo-icon { font-size: 1.6rem; line-height: 1; }
.sidebar-name {
  font-family: var(--font-head);
  font-size: 1.1rem; font-weight: 900;
  color: var(--white); line-height: 1;
}
.sidebar-tagline {
  font-size: .68rem; color: var(--gray-2);
  font-weight: 500; margin-top: 2px; letter-spacing: .03em;
}

/* Tabs */
.sidebar-tabs {
  display: flex; border-bottom: 1px solid var(--border);
  padding: .5rem .75rem 0;
}
.stab {
  flex: 1; display: flex; align-items: center; justify-content: center;
  gap: .4rem;
  font-family: var(--font); font-size: .75rem; font-weight: 600;
  color: var(--gray-2); background: none; border: none;
  border-bottom: 2px solid transparent;
  padding: .5rem .5rem .65rem; cursor: pointer;
  transition: color .2s, border-color .2s;
  white-space: nowrap;
}
.stab:hover { color: var(--white); }
.stab.active { color: var(--cyan); border-bottom-color: var(--cyan); }

/* Lista de projetos */
.sidebar-list {
  flex: 1; padding: .75rem;
  display: flex; flex-direction: column; gap: .6rem;
  overflow-y: auto;
}

.proj-card {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem;
  transition: border-color .2s, background .2s;
  cursor: default;
}
.proj-card:hover { border-color: var(--border-h); background: var(--navy-3); }

.proj-card-top {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: .5rem;
  margin-bottom: .4rem;
}
.proj-title {
  font-size: .88rem; font-weight: 700;
  color: var(--white); line-height: 1.3;
}
.proj-status {
  font-size: .6rem; font-weight: 700;
  padding: .15rem .45rem; border-radius: 20px;
  text-transform: uppercase; letter-spacing: .05em;
  white-space: nowrap; flex-shrink: 0;
}
.proj-status.ativo    { background: var(--green-dim); color: var(--green); border: 1px solid rgba(0,230,118,.3); }
.proj-status.andamento{ background: var(--cyan-dim);  color: var(--cyan);  border: 1px solid rgba(0,212,255,.3); }
.proj-status.pausado  { background: rgba(255,180,0,.1); color: #ffd54f; border: 1px solid rgba(255,213,79,.3); }

.proj-desc {
  font-size: .76rem; color: var(--gray-2);
  line-height: 1.5; margin-bottom: .6rem;
  display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden;
}

.proj-tags {
  display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .6rem;
}
.proj-tag {
  font-size: .62rem; font-weight: 600;
  color: var(--gray-3); background: var(--navy-3);
  border: 1px solid var(--border); border-radius: 5px;
  padding: .1rem .4rem;
}

.proj-links { display: flex; gap: .5rem; }
.proj-link {
  font-size: .68rem; font-weight: 600;
  color: var(--cyan); background: var(--cyan-dim);
  border: 1px solid rgba(0,212,255,.25);
  border-radius: 6px; padding: .22rem .55rem;
  text-decoration: none; display: flex; align-items: center; gap: .3rem;
  transition: background .2s;
}
.proj-link:hover { background: rgba(0,212,255,.22); }

.sidebar-loading {
  display: flex; justify-content: center; padding: 2rem;
}
.mini-spinner {
  width: 22px; height: 22px;
  border: 2px solid var(--border); border-top-color: var(--cyan);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Add project hint */
.add-hint {
  margin: .5rem; padding: .75rem;
  border: 1px dashed var(--border); border-radius: var(--radius);
  text-align: center;
  font-size: .72rem; color: var(--gray-3); line-height: 1.5;
}
.add-hint a { color: var(--cyan); text-decoration: none; }
.add-hint a:hover { text-decoration: underline; }

/* Sidebar footer */
.sidebar-footer {
  padding: .75rem;
  border-top: 1px solid var(--border);
}
.github-link {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  font-size: .75rem; font-weight: 600; color: var(--gray-2);
  text-decoration: none; padding: .5rem;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--navy-3);
  transition: color .2s, border-color .2s;
}
.github-link:hover { color: var(--white); border-color: var(--border-h); }

/* ══════════════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════════════ */
.main-content {
  flex: 1; min-width: 0;
  padding: 1.5rem 2rem 3rem;
  max-width: 960px;
}

/* Filter bar */
.filter-bar {
  display: flex; align-items: center;
  gap: .6rem; flex-wrap: wrap;
  margin-bottom: 2.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.filter-group { display: flex; gap: .4rem; flex-wrap: wrap; flex: 1; }

.filter-btn {
  font-family: var(--font); font-size: .73rem; font-weight: 600;
  color: var(--gray-2); background: var(--navy-3);
  border: 1px solid var(--border); border-radius: 20px;
  padding: .3rem .75rem; cursor: pointer;
  transition: all .18s ease; white-space: nowrap;
}
.filter-btn:hover { border-color: var(--cyan); color: var(--cyan); }
.filter-btn.active { background: var(--cyan); border-color: var(--cyan); color: #000; font-weight: 700; }
.filter-btn .cnt { opacity: .65; }

.sort-sel {
  background: var(--navy-3); border: 1px solid var(--border);
  color: var(--gray-2); font-family: var(--font);
  font-size: .78rem; border-radius: 8px; padding: .32rem .75rem;
  cursor: pointer; outline: none; margin-left: auto;
}

/* ── Section títulos ─────────────────────────────────────── */
.news-section { margin-bottom: 3.5rem; }

.sec-title {
  font-family: var(--font-head);
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 900; letter-spacing: -.02em; line-height: 1;
  color: var(--cyan); text-transform: uppercase;
  margin-bottom: .4rem;
}
.sec-sub {
  font-size: .9rem; color: var(--gray-2); margin-bottom: 1.5rem; line-height: 1.5;
}
.sec-sub strong { color: var(--white); font-weight: 600; }
.sec-header-row {
  display: flex; justify-content: space-between;
  align-items: flex-start; gap: 1rem; flex-wrap: wrap;
  margin-bottom: .25rem;
}
.sec-date { font-size: .82rem; color: var(--gray-2); white-space: nowrap; padding-top: .25rem; }

/* ── Top Semana: grid 2 colunas ──────────────────────────── */
.week-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.1rem;
}

.week-card {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex; gap: .9rem;
  padding: .9rem; overflow: hidden;
  text-decoration: none;
  transition: border-color .2s, background .2s;
  animation: fadeUp .4s ease both;
}
.week-card:hover { border-color: var(--cyan); background: var(--navy-3); }

.week-img {
  width: 140px; min-width: 140px; height: 105px;
  border-radius: 7px; overflow: hidden;
  background: var(--navy-3); flex-shrink: 0;
}
.week-img img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .3s ease;
}
.week-card:hover .week-img img { transform: scale(1.05); }
.week-img-ph {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
  background: linear-gradient(135deg, var(--navy-3), var(--border));
}

.week-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .4rem; }
.week-rank {
  font-family: var(--font-head); font-size: .7rem; font-weight: 900;
  color: var(--cyan); letter-spacing: .05em;
}
.week-title {
  font-family: var(--font-head);
  font-size: 1rem; font-weight: 800;
  color: var(--white); line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden;
  transition: color .2s;
}
.week-card:hover .week-title { color: var(--cyan); }
.week-meta {
  font-size: .7rem; color: var(--gray-3); margin-top: auto;
  display: flex; gap: .75rem;
}
.week-views {
  display: flex; align-items: center; gap: .3rem; color: var(--cyan);
  font-size: .68rem; font-weight: 600;
}

/* ── Lista notícias recentes ─────────────────────────────── */
.news-list { display: flex; flex-direction: column; }

.news-item {
  display: flex; gap: 1.1rem; align-items: flex-start;
  padding: 1.4rem 0; border-bottom: 1px solid var(--border);
  text-decoration: none;
  animation: fadeUp .35s ease both;
}
.news-item:first-child { border-top: 1px solid var(--border); }
.news-item:hover .news-item-title { color: var(--cyan); }

.news-thumb {
  width: 260px; min-width: 260px; height: 170px;
  border-radius: 8px; overflow: hidden;
  background: var(--navy-3); flex-shrink: 0;
}
.news-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .3s ease;
}
.news-item:hover .news-thumb img { transform: scale(1.04); }

.news-body { flex: 1; min-width: 0; }
.news-badge {
  display: inline-block;
  font-size: .7rem; font-weight: 600; color: var(--white);
  background: var(--navy-3); border: 1px solid var(--border);
  border-radius: 20px; padding: .18rem .55rem; margin-bottom: .55rem;
}
.news-item-title {
  font-family: var(--font-head);
  font-size: 1.45rem; font-weight: 800;
  color: var(--white); line-height: 1.2; letter-spacing: -.02em;
  margin-bottom: .55rem; transition: color .2s;
}
.news-item.has-img .news-item-title { font-size: 1.25rem; }
.news-desc {
  font-size: .86rem; color: var(--gray-1);
  line-height: 1.65; margin-bottom: .7rem;
  display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden;
}
.news-foot {
  display: flex; align-items: center;
  justify-content: space-between; gap: .5rem;
}
.news-tag { font-size: .73rem; color: var(--gray-3); }
.news-time { font-size: .75rem; color: var(--gray-2); }

/* ── Estados ──────────────────────────────────────────────── */
.loader {
  display: flex; flex-direction: column;
  align-items: center; gap: .75rem;
  padding: 4rem 1rem; color: var(--gray-3);
  font-size: .85rem;
}
.spinner {
  width: 32px; height: 32px;
  border: 2px solid var(--border); border-top-color: var(--cyan);
  border-radius: 50%; animation: spin .7s linear infinite;
}
.empty { padding: 3rem 1rem; color: var(--gray-3); font-size: .9rem; text-align: center; }

/* ── Footer ───────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  background: var(--navy-2); padding: 1.25rem 2rem;
  display: flex; justify-content: space-between;
  flex-wrap: wrap; gap: .5rem;
  font-size: .72rem; color: var(--gray-3);
}

/* ── Animação ─────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════ */

/* Tablet */
@media (max-width: 900px) {
  .week-grid { grid-template-columns: 1fr; }
  .main-content { padding: 1.25rem 1.25rem 3rem; }
}

/* Mobile — sidebar vira overlay fechada por padrão */
@media (max-width: 768px) {

  /* Sidebar: sai do fluxo e fica escondida à esquerda */
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    z-index: 500;
    width: var(--sidebar-w) !important;
    min-width: var(--sidebar-w) !important;
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform .3s ease, opacity .3s ease;
  }

  /* Quando sidebar está ABERTA no mobile (sem .sidebar-closed) */
  .layout:not(.sidebar-closed) .sidebar {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }

  /* Overlay escuro atrás da sidebar quando aberta */
  .layout:not(.sidebar-closed)::before {
    content: '';
    position: fixed;
    inset: var(--topbar-h) 0 0 0;
    background: rgba(0,0,0,.55);
    z-index: 499;
    backdrop-filter: blur(2px);
  }

  /* Main content ocupa tudo (sem espaço da sidebar) */
  .main-content {
    padding: 1rem 1rem 3rem;
    width: 100%;
  }

  /* Layout não reserva espaço para sidebar */
  .layout {
    display: block;
  }

  /* Topbar */
  .topbar-nav { display: none; }
  #searchInput { width: 130px; }

  /* Notícias */
  .news-thumb { width: 120px; min-width: 120px; height: 90px; }
  .news-item-title { font-size: 1.05rem; }

  /* Semana grid 1 coluna */
  .week-grid { grid-template-columns: 1fr; }

  /* Seção título menor */
  .sec-title { font-size: 2rem; }
}

/* Celular pequeno */
@media (max-width: 480px) {
  .news-item { flex-direction: column; }
  .news-thumb { width: 100%; min-width: unset; height: 200px; }
  .topbar-logo { font-size: 1.1rem; }
  #searchInput { width: 100px; }
  .sec-title { font-size: 1.7rem; }
  .filter-bar { gap: .4rem; }
  .main-content { padding: .75rem .75rem 3rem; }
}

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--navy); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::selection { background: var(--cyan-dim); color: var(--cyan); }
