/*
   ESTILOS DO PROJETO - JAVASCRIPT BÁSICO
   Desenvolvido por: Guilherme Queiroz (@guielihan)
   Professor: Luan - GoDev
*/

:root{
  --bg: #0b1020;
  --panel: rgba(255,255,255,.06);
  --panel2: rgba(255,255,255,.08);
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.70);
  --soft: rgba(255,255,255,.14);
  --accent: #7c3aed;
  --accent2: #22c55e;
  --warn: #f59e0b;
  --radius: 16px;
  --shadow: 0 18px 60px rgba(0,0,0,.45);
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

/* ============================================================
   ANIMAÇÕES
   ============================================================ */

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

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .6; }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 0 6px rgba(34,197,94,.12); }
  50% { box-shadow: 0 0 0 10px rgba(34,197,94,.25); }
}

*{ box-sizing: border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 15% 10%, rgba(124,58,237,.35), transparent 60%),
    radial-gradient(900px 700px at 85% 20%, rgba(34,197,94,.25), transparent 55%),
    radial-gradient(900px 600px at 70% 90%, rgba(245,158,11,.18), transparent 55%),
    linear-gradient(180deg, #070a12, var(--bg));
  line-height: 1.6;
  animation: fadeIn 0.6s ease-out;
}

a{ color: inherit; text-decoration: none; }

.wrap{ max-width: 1100px; margin: 0 auto; padding: 28px 18px 72px; }

header{
  display: grid;
  gap: 14px;
  padding: 26px 22px;
  border: 1px solid var(--soft);
  border-radius: calc(var(--radius) + 8px);
  background: linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.05));
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  animation: fadeIn 0.8s ease-out;
}

header::before{
  content:"";
  position:absolute;
  inset:-2px;
  background: radial-gradient(600px 220px at 25% 0%, rgba(124,58,237,.45), transparent 65%);
  opacity: .9;
  pointer-events:none;
}

.topline{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 14px;
  position: relative;
  z-index: 1;
}

.badge{
  display:inline-flex;
  align-items:center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--soft);
  background: rgba(0,0,0,.18);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
}

.badge .dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent2);
  box-shadow: 0 0 0 6px rgba(34,197,94,.12);
  animation: glow 2s ease-in-out infinite;
}

h1{
  margin: 0;
  font-size: clamp(28px, 3.2vw, 42px);
  letter-spacing: -0.02em;
  line-height: 1.15;
  position: relative;
  z-index: 1;
}

.subtitle{
  margin: 0;
  color: var(--muted);
  max-width: 78ch;
  position: relative;
  z-index: 1;
}


.grid{
  margin-top: 22px;
  display:grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  align-items:start;
}

@media (max-width: 960px){
  .grid{ grid-template-columns: 1fr; }
}

nav{
  border: 1px solid var(--soft);
  border-radius: var(--radius);
  background: rgba(255,255,255,.04);
  box-shadow: 0 12px 40px rgba(0,0,0,.28);
  position: sticky;
  top: 16px;
  overflow: hidden;
  animation: slideIn 0.6s ease-out;
}

.nav-head{
  padding: 14px 14px 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
}

.nav-title{ font-weight: 700; letter-spacing: -0.01em; }
.nav-tools{ display:flex; gap: 8px; }

.chip{
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.18);
  color: var(--muted);
  cursor: pointer;
  user-select:none;
  transition: all 0.2s ease;
}

.chip:hover{ 
  color: var(--text); 
  border-color: rgba(255,255,255,.32);
  transform: scale(1.05);
}

.nav-body{ padding: 12px; display:grid; gap: 6px; }

.nav-link{
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  color: var(--muted);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  transition: all 0.2s ease;
}
.nav-link:hover{ 
  background: rgba(255,255,255,.08); 
  color: var(--text);
  transform: translateX(4px);
}
.nav-link.active{ 
  background: rgba(124,58,237,.14); 
  border-color: rgba(124,58,237,.35); 
  color: var(--text);
  box-shadow: 0 4px 12px rgba(124,58,237,.25);
}

.nav-kbd{
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 6px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.22);
  color: rgba(255,255,255,.68);
  white-space: nowrap;
}

/*
   CONTEÚDO PRINCIPAL
*/

main{ display:grid; gap: 14px; }

.card{
  border: 1px solid var(--soft);
  border-radius: var(--radius);
  background: rgba(255,255,255,.04);
  box-shadow: 0 12px 40px rgba(0,0,0,.28);
  overflow:hidden;
  animation: fadeIn 0.7s ease-out;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover{
  transform: translateY(-4px);
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}

.card .head{
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 12px;
}

.card .head h2{
  margin:0;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.card .head p{
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  max-width: 92ch;
}

.card .body{ padding: 16px 18px 18px; display:grid; gap: 12px; }

/* 
   COMPONENTES DE CONTEÚDO
*/

.note{
  border: 1px dashed rgba(255,255,255,.18);
  background: rgba(0,0,0,.18);
  border-radius: 14px;
  padding: 12px 12px;
  color: rgba(255,255,255,.78);
}

.note strong{ color: var(--text); }
.note ul{ margin: 8px 0; padding-left: 24px; }
.note li{ margin: 4px 0; }

/*
   CODE BLOCKS COM SYNTAX HIGHLIGHTING
*/

.code-wrapper{
  position: relative;
  margin: 0;
}

pre{
  margin: 0;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.28);
  overflow-x: auto !important;
  overflow-y: auto;
  max-height: 500px;
  max-width: 100%;
  padding: 12px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
  position: relative;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

pre::-webkit-scrollbar {
  height: 10px;
  width: 10px;
  -webkit-appearance: none;
}

pre::-webkit-scrollbar-track {
  background: rgba(0,0,0,.3);
  border-radius: 5px;
  margin: 4px;
}

pre::-webkit-scrollbar-thumb {
  background: rgba(124,58,237,.7);
  border-radius: 5px;
  border: 2px solid rgba(0,0,0,.28);
  min-width: 40px;
  min-height: 40px;
}

pre::-webkit-scrollbar-thumb:hover {
  background: rgba(124,58,237,.9);
}

pre::-webkit-scrollbar-corner {
  background: rgba(0,0,0,.2);
}

/* Firefox */
pre {
  scrollbar-width: thin;
  scrollbar-color: rgba(124,58,237,.7) rgba(0,0,0,.3);
}

code{ 
  font-family: var(--mono); 
  font-size: 13px;
  line-height: 1.6;
  white-space: inherit;
  display: block;
  max-width: 100%;
}

/* Botão de copiar código */
.copy-btn{
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 6px 10px;
  background: rgba(124,58,237,.5);
  border: 1px solid rgba(124,58,237,.6);
  border-radius: 8px;
  color: var(--text);
  font-size: 11px;
  cursor: pointer;
  opacity: 0.7;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--sans);
  font-weight: 500;
  z-index: 10;
}

.code-wrapper:hover .copy-btn{
  opacity: 1;
}

.copy-btn:hover{
  background: rgba(124,58,237,.35);
  transform: scale(1.05);
}

.copy-btn.copied{
  background: rgba(34,197,94,.3);
  border-color: rgba(34,197,94,.5);
}

.copy-btn svg{
  width: 14px;
  height: 14px;
}

/* syntax highlighting */
.keyword{ color: #c792ea; font-weight: 600; }
.string{ color: #c3e88d; }
.number{ color: #f78c6c; }
.function{ color: #82aaff; }
.comment{ color: rgba(255,255,255,.4); font-style: italic; }
.operator{ color: #89ddff; }
.property{ color: #ffcb6b; }
.variable{ color: #eeffff; }
.boolean{ color: #ff5370; }
.console{ color: #89ddff; font-weight: 600; }

.pillrow{ display:flex; flex-wrap:wrap; gap: 8px; }

.pill{
  font-family: var(--mono);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.76);
}

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

@media (max-width: 720px){
  .split{ grid-template-columns: 1fr; }
}

.callout{
  border-left: 4px solid rgba(124,58,237,.8);
  background: rgba(124,58,237,.10);
  border-radius: 14px;
  padding: 12px 12px;
  color: rgba(255,255,255,.80);
}

.clock{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.20);
  font-family: var(--mono);
}

.clock strong{ font-size: 13px; color: rgba(255,255,255,.76); font-weight: 600; }
#relogio{ font-size: 18px; letter-spacing: 0.02em; }

/* 
   FOOTER E BOTÕES
*/

.footer{
  margin-top: 18px;
  padding: 14px 18px;
  color: rgba(255,255,255,.68);
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: 13px;
  display:flex;
  flex-wrap:wrap;
  gap: 10px;
  align-items:center;
  justify-content:space-between;
}

.btn{
  display:inline-flex;
  align-items:center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.20);
  color: rgba(255,255,255,.84);
  cursor:pointer;
  transition: all 0.3s ease;
}

.btn:hover{ 
  border-color: rgba(124,58,237,.6); 
  background: rgba(124,58,237,.2);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(124,58,237,.3);
}

/* 
   TOAST (NOTIFICAÇÕES)
*/

.toast{
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: rgba(0,0,0,.75);
  border: 1px solid rgba(255,255,255,.18);
  color: rgba(255,255,255,.88);
  padding: 10px 12px;
  border-radius: 14px;
  box-shadow: 0 18px 60px rgba(0,0,0,.5);
  opacity: 0;
  pointer-events:none;
  transition: opacity .2s ease, transform .2s ease;
  font-size: 13px;
  max-width: min(560px, calc(100vw - 24px));
}

.toast.show{ opacity: 1; transform: translateX(-50%) translateY(-6px); }

.kbdhint{
  color: rgba(255,255,255,.56);
  font-size: 12px;
}

/*
   SEÇÃO DE CRÉDITOS
*/

.credits{
  margin-top: 32px;
  padding: 24px;
  border: 1px solid var(--soft);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(124,58,237,.12), rgba(34,197,94,.08));
  box-shadow: 0 12px 40px rgba(0,0,0,.28);
  animation: fadeIn 1s ease-out;
}

.credits-title{
  margin: 0 0 16px;
  font-size: 20px;
  letter-spacing: -0.01em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.credits-info{
  color: var(--muted);
  margin-bottom: 16px;
  line-height: 1.7;
}

.credits-info strong{
  color: var(--text);
}

.social-links{
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.social-link{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(0,0,0,.25);
  color: var(--text);
  text-decoration: none;
  transition: all 0.3s ease;
  font-size: 14px;
}

.social-link:hover{
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(124,58,237,.4);
  border-color: rgba(124,58,237,.5);
  background: rgba(124,58,237,.15);
}

.social-icon{
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.badge-dev{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(34,197,94,.15);
  border: 1px solid rgba(34,197,94,.3);
  color: var(--accent2);
  font-size: 13px;
  font-weight: 600;
}

/*
   MODO CLARO/ESCURO TOGGLE
*/

.theme-toggle{
  position: fixed;
  bottom: 80px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(124,58,237,.25);
  border: 1px solid rgba(124,58,237,.4);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
  transition: all 0.3s ease;
  z-index: 1000;
}

.theme-toggle:hover{
  transform: scale(1.1) rotate(15deg);
  background: rgba(124,58,237,.4);
  box-shadow: 0 12px 48px rgba(124,58,237,.4);
}

.theme-toggle svg{
  width: 24px;
  height: 24px;
  fill: var(--text);
  transition: transform 0.3s ease;
}

.theme-toggle:hover svg{
  transform: rotate(-15deg);
}

/* ícones para seções */
.section-icon{
  width: 24px;
  height: 24px;
  margin-right: 10px;
  flex-shrink: 0;
  opacity: 0.9;
}

.card .head h2{
  display: flex;
  align-items: center;
}

/* MODO CLARO */
body.light-mode{
  background: 
    radial-gradient(1200px 800px at 15% 10%, rgba(124,58,237,.08), transparent 60%),
    radial-gradient(900px 700px at 85% 20%, rgba(34,197,94,.06), transparent 55%),
    radial-gradient(900px 600px at 70% 90%, rgba(245,158,11,.05), transparent 55%),
    linear-gradient(180deg, #f8f9fa, #ffffff);
  color: #1a1a1a;
}

body.light-mode{
  --bg: #ffffff;
  --text: #1a1a1a;
  --muted: rgba(0,0,0,.65);
  --soft: rgba(0,0,0,.12);
  --panel: rgba(0,0,0,.04);
}

body.light-mode header{
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,.85));
  border-color: rgba(0,0,0,.1);
}

body.light-mode header::before{
  background: radial-gradient(600px 220px at 25% 0%, rgba(124,58,237,.12), transparent 65%);
}

body.light-mode .card,
body.light-mode nav{
  background: rgba(255,255,255,.6);
  border-color: rgba(0,0,0,.1);
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
}

body.light-mode .card:hover{
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
}

body.light-mode pre{
  background: rgba(0,0,0,.05);
  border-color: rgba(0,0,0,.1);
}

body.light-mode .note,
body.light-mode .clock{
  background: rgba(124,58,237,.05);
  border-color: rgba(124,58,237,.15);
  color: #1a1a1a;
}

body.light-mode .callout{
  background: rgba(124,58,237,.08);
  border-left-color: rgba(124,58,237,.6);
  color: #1a1a1a;
}

body.light-mode .badge{
  background: rgba(0,0,0,.08);
  border-color: rgba(0,0,0,.15);
}

body.light-mode .nav-link:hover{
  background: rgba(124,58,237,.08);
}

body.light-mode .btn{
  background: rgba(0,0,0,.05);
  border-color: rgba(0,0,0,.15);
}

body.light-mode .btn:hover{
  background: rgba(124,58,237,.12);
  border-color: rgba(124,58,237,.3);
}

body.light-mode .pill{
  background: rgba(124,58,237,.1);
  border-color: rgba(124,58,237,.2);
  color: #1a1a1a;
}

body.light-mode .chip{
  background: rgba(0,0,0,.05);
  border-color: rgba(0,0,0,.15);
}

body.light-mode .chip:hover{
  background: rgba(0,0,0,.1);
  border-color: rgba(0,0,0,.25);
}

body.light-mode code{
  color: #1a1a1a;
}

/* barra de rolagem no modo claro */
body.light-mode pre::-webkit-scrollbar-track {
  background: rgba(0,0,0,.08);
  border-radius: 5px;
  margin: 4px;
}

body.light-mode pre::-webkit-scrollbar-thumb {
  background: rgba(124,58,237,.4);
  border-radius: 5px;
  border: 2px solid rgba(255,255,255,.6);
}

body.light-mode pre::-webkit-scrollbar-thumb:hover {
  background: rgba(124,58,237,.6);
}

body.light-mode .copy-btn{
  background: rgba(124,58,237,.3);
  border-color: rgba(124,58,237,.4);
}

body.light-mode .copy-btn:hover{
  background: rgba(124,58,237,.5);
}

/* syntax highlighting para modo claro */
body.light-mode .keyword{ color: #7c3aed; }
body.light-mode .string{ color: #059669; }
body.light-mode .number{ color: #dc2626; }
body.light-mode .function{ color: #2563eb; }
body.light-mode .comment{ color: rgba(0,0,0,.4); }
body.light-mode .operator{ color: #0891b2; }
body.light-mode .property{ color: #d97706; }
body.light-mode .variable{ color: #1a1a1a; }
body.light-mode .boolean{ color: #dc2626; }
body.light-mode .console{ color: #0891b2; }

