/* --- Estilo Base & Variáveis --- */
:root {
  --primary: #00ff88;
  --primary-dim: rgba(0, 255, 136, 0.2);
  --bg-dark: #0d0d0d;
  --glass: rgba(255, 255, 255, 0.03);
  --glass-hover: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shine: rgba(255, 255, 255, 0.15);
  --text-main: #ffffff;
  --text-muted: #a0a0a0;

  /* Cores de categoria para identificação visual */
  --cat-ia: #00d4aa; /* Inteligência Artificial - Verde água */
  --cat-gaming: #ff6b6b; /* Gaming - Vermelho coral */
  --cat-entertainment: #9b59b6; /* Entretenimento - Roxo */
  --cat-tools: #3498db; /* Ferramentas - Azul */
}

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

body {
  background-color: var(--bg-dark);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  margin: 0;
  padding: 20px;
  padding-bottom: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  color: var(--text-main);
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) var(--bg-dark);
}

/* Custom Scrollbar (Webkit) */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background-color: #333;
  border-radius: 20px;
}
::-webkit-scrollbar-thumb:hover {
  background-color: var(--primary);
}

/* Canvas do Fundo Animado */
#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: radial-gradient(circle at top, #1a2a3a 0%, #050505 100%);
}

h1 {
  font-weight: 300;
  margin-bottom: 30px;
  letter-spacing: 6px;
  text-transform: uppercase;
  font-size: 2rem;
  text-shadow: 0 0 10px var(--primary-dim), 0 0 20px var(--primary-dim),
    0 0 40px var(--primary-dim);
  margin-top: 20px;
  background: linear-gradient(to bottom, #fff, #bbb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
}

/* --- Widget de Relógio --- */
.clock-widget {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 20px;
  margin-bottom: 40px;
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 15px 40px;
  border-radius: 100px;
  border-top: 1px solid var(--glass-shine);
  border-bottom: 1px solid rgba(0, 0, 0, 0.5);
  border-left: 1px solid var(--glass-border);
  border-right: 1px solid var(--glass-border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease;
}

.clock-widget:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 40px rgba(0, 255, 136, 0.05);
}

.clock-time {
  font-size: 2.2rem;
  font-weight: 700;
  color: white;
  padding-right: 25px;
  border-right: 1px solid rgba(255, 255, 255, 0.15);
  line-height: 1;
  letter-spacing: 1px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.clock-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 500;
  line-height: 1.4;
  max-width: 100px;
}

/* --- Navegação de Abas (Tabs) - VERSÃO MULTI-CATEGORIA --- */
.tabs-container {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  border-radius: 50px;
  padding: 6px;
  margin-bottom: 40px;
  border: 1px solid var(--glass-border);
  position: relative;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3);
  /* Flex wrap para múltiplas categorias em telas pequenas */
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  max-width: 95vw;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 12px 28px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 40px;
  transition: all 0.3s ease;
  position: relative;
  z-index: 2;
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
  /* Indicador de categoria com cor sutil */
  border-bottom: 2px solid transparent;
}

/* Cores de identificação por categoria (borda inferior sutil) */
.tab-btn[data-category="ia"] {
  border-bottom-color: rgba(0, 212, 170, 0.3);
}
.tab-btn[data-category="gaming"] {
  border-bottom-color: rgba(255, 107, 107, 0.3);
}
.tab-btn[data-category="entertainment"] {
  border-bottom-color: rgba(155, 89, 182, 0.3);
}
.tab-btn[data-category="tools"] {
  border-bottom-color: rgba(52, 152, 219, 0.3);
}

.tab-btn.active {
  color: #05291a;
  text-shadow: none;
  border-bottom-color: transparent;
}

.tab-btn:hover:not(.active) {
  color: white;
  background: rgba(255, 255, 255, 0.05);
}

/* Background animado do tab ativo */
.tab-bg {
  position: absolute;
  top: 6px;
  left: 6px;
  height: calc(100% - 12px);
  background: var(--primary);
  border-radius: 40px;
  transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  z-index: 1;
  box-shadow: 0 0 20px var(--primary-dim);
  /* Altura fixa para múltiplas linhas de tabs */
  max-height: 44px;
}

/* --- Container de Views --- */
#viewsContainer {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.view-section {
  display: none;
  width: 100%;
  flex-direction: column;
  align-items: center;
  /* Animação de entrada suave */
  animation: fadeIn 0.4s ease;
}

.view-section.active {
  display: flex;
}

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

/* --- Grid de Apps - Responsivo para múltiplas categorias --- */
.app-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 25px;
  max-width: 600px;
  width: 100%;
  padding: 0 10px;
}

/* --- Card Design com identificação de categoria --- */
.app-card {
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(255, 255, 255, 0.01) 100%
  );
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border-top: 1px solid var(--glass-shine);
  border-left: 1px solid var(--glass-border);
  border-right: 1px solid rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(30px);
  animation: slideUp 0.6s forwards;
}

/* Glow de categoria no hover (cada categoria tem sua cor) */
.app-card[data-category="ia"]:hover {
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(0, 212, 170, 0.3);
}
.app-card[data-category="gaming"]:hover {
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 107, 107, 0.3);
}
.app-card[data-category="entertainment"]:hover {
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(155, 89, 182, 0.3);
}
.app-card[data-category="tools"]:hover {
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(52, 152, 219, 0.3);
}

/* Efeito de brilho interno */
.app-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.05),
    transparent
  );
  transition: 0.5s;
  pointer-events: none;
}

.app-card:hover::before {
  left: 100%;
}

.app-card:hover {
  transform: translateY(-8px) scale(1.02);
  background: var(--glass-hover);
}

/* Ícone flutuando no hover */
.app-card:hover .icon-svg {
  transform: translateY(-5px);
}

/* Cores de ícone específicas por categoria no hover */
.app-card[data-category="ia"]:hover .icon-svg svg {
  filter: drop-shadow(0 0 12px var(--cat-ia));
  fill: var(--cat-ia);
}
.app-card[data-category="gaming"]:hover .icon-svg svg {
  filter: drop-shadow(0 0 12px var(--cat-gaming));
  fill: var(--cat-gaming);
}
.app-card[data-category="entertainment"]:hover .icon-svg svg {
  filter: drop-shadow(0 0 12px var(--cat-entertainment));
  fill: var(--cat-entertainment);
}
.app-card[data-category="tools"]:hover .icon-svg svg {
  filter: drop-shadow(0 0 12px var(--cat-tools));
  fill: var(--cat-tools);
}

/* --- Estado SELECIONADO com cores de categoria --- */
.app-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.2),
    inset 0 0 20px rgba(0, 255, 136, 0.05);
  background: rgba(0, 255, 136, 0.03);
}

/* Badge de seleção com animação bounce */
.check-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 12px;
  height: 12px;
  background-color: var(--primary);
  border-radius: 50%;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
  transform: scale(0);
  box-shadow: 0 0 15px var(--primary);
}

.app-card.selected .check-badge {
  opacity: 1;
  transform: scale(1);
}

/* Indicador sutil de categoria no card */
.category-indicator {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  border-radius: 2px;
  opacity: 0.6;
  transition: opacity 0.3s;
}

.app-card[data-category="ia"] .category-indicator {
  background: var(--cat-ia);
}
.app-card[data-category="gaming"] .category-indicator {
  background: var(--cat-gaming);
}
.app-card[data-category="entertainment"] .category-indicator {
  background: var(--cat-entertainment);
}
.app-card[data-category="tools"] .category-indicator {
  background: var(--cat-tools);
}

.app-card:hover .category-indicator {
  opacity: 1;
  width: 30px;
}

/* SVG Styles */
.icon-svg {
  width: 48px;
  height: 48px;
  margin-bottom: 15px;
  transition: transform 0.3s ease;
}

.icon-svg svg {
  width: 100%;
  height: 100%;
  fill: #d1d1d1;
  transition: all 0.3s ease;
}

.name {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-align: center;
  color: rgba(255, 255, 255, 0.8);
  transition: color 0.3s;
  margin-bottom: 8px;
}

.app-card:hover .name {
  color: white;
}

/* --- Barra de Controle Inferior --- */
.control-bar {
  position: fixed;
  bottom: 30px;
  display: flex;
  gap: 15px;
  z-index: 100;
  background: rgba(15, 15, 15, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 10px 15px;
  border-radius: 60px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  transition: 0.3s;
}

.btn {
  border: none;
  padding: 14px 28px;
  border-radius: 40px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  overflow: hidden;
}

/* Botão Selecionar */
.btn-mode {
  background-color: transparent;
  color: #ccc;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.btn-mode:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  border-color: rgba(255, 255, 255, 0.4);
}
.btn-mode.active {
  background-color: white;
  color: black;
  border-color: white;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

/* Botão ABRIR */
.btn-go {
  background: linear-gradient(135deg, #00ff88, #00b360);
  color: #05291a;
  display: none;
  box-shadow: 0 4px 20px rgba(0, 255, 136, 0.4);
  animation: pulse 2s infinite;
}

.btn-go:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0, 255, 136, 0.6);
}

.btn-go:active {
  transform: scale(0.95);
}

/* Animações */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 255, 136, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(0, 255, 136, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 255, 136, 0);
  }
}

/* --- Responsividade Avançada --- */
@media (min-width: 768px) {
  .app-grid {
    grid-template-columns: repeat(3, 1fr);
    max-width: 800px;
    gap: 30px;
  }

  .tab-btn {
    padding: 12px 35px;
    font-size: 14px;
  }
}

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

  .tabs-container {
    flex-wrap: nowrap;
  }
}

/* Mobile otimizado */
@media (max-width: 480px) {
  .tabs-container {
    border-radius: 30px;
    padding: 4px;
  }

  .tab-btn {
    padding: 10px 18px;
    font-size: 11px;
    letter-spacing: 0.5px;
  }

  .tab-bg {
    border-radius: 30px;
    max-height: 38px;
  }

  .app-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }

  .app-card {
    padding: 20px 15px;
  }

  .icon-svg {
    width: 40px;
    height: 40px;
  }

  .name {
    font-size: 13px;
  }

  h1 {
    font-size: 1.5rem;
    letter-spacing: 4px;
  }

  .clock-widget {
    padding: 12px 25px;
    flex-direction: column;
    gap: 8px;
    border-radius: 20px;
  }

  .clock-time {
    font-size: 1.8rem;
    padding-right: 0;
    padding-bottom: 8px;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  }

  .clock-date {
    font-size: 0.75rem;
    max-width: none;
    text-align: center;
  }

  .control-bar {
    bottom: 20px;
    padding: 8px 12px;
  }

  .btn {
    padding: 12px 20px;
    font-size: 12px;
  }
}

/* Animação de transição entre tabs */
.view-transitioning {
  animation: fadeOut 0.2s ease forwards;
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}
