/* ==========================================================
   1. ESTILOS GERAIS E LAYOUT RESPONSIVO (PC vs MOBILE)
   ========================================================== */
body {
  background-color: #706c6c;
  margin: 0;
  padding: 130px 16px 40px 16px !important; /* Margem menor e segura no telemóvel */
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
}

/* Em computadores, aumenta o respiro lateral da página */
@media (min-width: 768px) {
  body {
    padding: 140px 40px 50px 40px !important;
  }
}

/* Cabeçalho Fixo no Topo */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background-color: #1e1e1e;
  padding: 15px 0;
  text-align: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  z-index: 5000;
  box-sizing: border-box;
}

header h1 {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  color: white;
  font-size: 32px;
  font-weight: bold;
  letter-spacing: 2px;
  padding: 2px 0;
}

header h3 {
  font-size: 13px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin-top: 1px;
  margin-bottom: 1px;
  color: bisque;
  padding: 2px 0;
}


/* ==========================================================
   2. MENU SUPERIOR DEFINITIVO (ORGANIZADO E SEM ROLAGEM)
   ========================================================== */
.opcoes {
  position: relative;
  background-color: #161b22;
  padding: 12px 10px;
  border-bottom: 1px solid #30363d;
  border-radius: 14px;
  box-sizing: border-box;
  width: 100%;
  max-width: 900px;
  margin: 0 auto 20px auto;
  z-index: 4000;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
}

.opcoes-scroll {
  width: 100%;
  overflow: visible !important;
}

.opcoes ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap; /* Quebra as opções de forma organizada em qualquer tela */
  justify-content: center;
  gap: 8px;
}

.opcoes ul li {
  position: relative;
  display: inline-block;
  background: #21262d;
  border-radius: 8px;
  border: 1px solid #30363d;
  transition: all 0.2s ease;
}

.opcoes ul li:hover {
  background-color: #30363d;
  border-color: #8b949e;
}

.opcoes ul li a,
.opcoes ul li span {
  color: #c9d1d9 !important;
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  display: block;
  padding: 8px 14px;
  background: none;
  border: none;
  outline: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}


/* ==========================================================
   3. SUBMENU FLUTUANTE 100% VISÍVEL (Z-INDEX MÁXIMO)
   ========================================================== */
nav.opcoes .submenu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  padding: 8px;
  list-style: none;
  background-color: #161b22 !important;
  border: 1px solid #30363d;
  border-radius: 12px;
  z-index: 9999999 !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.95);
  min-width: 230px;
  text-align: left;
  white-space: normal;
}

/* Alinha automaticamente para a direita os itens nas pontas para não sair da tela */
nav.opcoes ul li:nth-last-child(-n+2) .submenu {
  left: auto;
  right: 0;
}

nav.opcoes li:hover .submenu,
nav.opcoes li.ativo .submenu {
  display: block;
  animation: fadeInSub 0.15s ease-out;
}

@keyframes fadeInSub {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

nav.opcoes .submenu li {
  display: block;
  margin: 4px 0;
  background: transparent;
  border: none;
  width: 100%;
}

nav.opcoes .submenu li:hover {
  background-color: #21262d;
  border-radius: 8px;
}

nav.opcoes .submenu a {
  display: block;
  padding: 10px 14px;
  color: #8b949e !important;
  text-decoration: none;
  font-size: 13px;
  font-weight: 400;
  border-radius: 8px;
  transition: all 0.2s;
  width: 100%;
  box-sizing: border-box;
}

nav.opcoes .submenu a:hover {
  color: #58a6ff !important;
  background-color: #21262d;
  padding-left: 18px;
}


/* ==========================================================
   4. TELA DE LOGIN (CONTAINER DE ACESSO)
   ========================================================== */
.container {
  display: block;
  margin: 30px auto !important;
  width: 100% !important;
  max-width: 440px !important;
  padding: 35px 30px !important;
  background-color: #1e1e1e;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  box-sizing: border-box !important;
  animation: slideIn 0.5s ease-out;
}

.container h3 {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  text-align: center;
  margin-bottom: 24px;
  color: #f3ecec;
  font-size: 26px;
}

.input-group {
  display: flex;
  align-items: center;
  background-color: #2a2a2a;
  padding: 4px 15px;
  margin-bottom: 20px;
  border-radius: 10px;
  border: 2px solid #3a3a3a;
  transition: all 0.3s;
  height: 54px;
  box-sizing: border-box;
}

.input-group:hover, .input-group:focus-within {
  background-color: #333;
  border-color: #007bff;
}

.input-group i {
  color: #bbb;
  margin-right: 12px;
  font-size: 18px;
}

.input-group input {
  background: none;
  border: none;
  outline: none;
  color: #fff;
  flex: 1;
  font-size: 18px;
  width: 100%;
}


/* ==========================================================
   5. CONTAINER DE FORMULÁRIOS E DATAS (RESPONSIVO INTELIGENTE)
   ========================================================== */
.container-data {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  transform: none !important;
  margin: 30px auto !important;
  width: 100% !important;
  max-width: 480px !important; /* Compacto e ideal para telemóveis */
  height: auto !important;
  min-height: auto !important;
  padding: 35px 30px !important;
  background-color: #1e1e1e !important;
  border-radius: 18px !important;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6) !important;
  box-sizing: border-box !important;
  z-index: 1 !important;
}

/* Quando aberto em computadores (desktop), expande confortavelmente */
@media (min-width: 768px) {
  .container-data {
    max-width: 650px !important;
    padding: 45px 50px !important;
  }
}

.container-data h3 {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  text-align: center;
  margin-bottom: 25px;
  color: #f3ecec;
  font-size: 24px;
}

.titulo-data {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  display: block;
  margin-bottom: 8px;
  color: #cbd5e1;
  font-size: 15px;
  font-weight: 600;
}

input[type="date"] {
  background-color: #2a2a2a !important;
  color: #ffffff !important;
  border: 2px solid #3a3a3a !important;
  border-radius: 10px !important;
  padding: 12px 15px !important;
  font-size: 18px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  cursor: pointer;
}


/* ==========================================================
   6. BOTÕES E COMPONENTES GERAIS
   ========================================================== */
button, .form-botao {
  background-color: #007bff;
  color: white;
  padding: 14px;
  border: none;
  border-radius: 10px;
  width: 100%;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.2s;
  box-sizing: border-box;
}

button:hover, .form-botao:hover {
  background-color: #0056b3;
  transform: scale(1.02);
}


/* ==========================================================
   7. DASHBOARD E KPI CARDS (VISÃO GERENCIAL)
   ========================================================== */
.dashboard {
  position: relative;
  z-index: 1;
  margin-top: 10px !important;
  padding: 0 !important;
  box-sizing: border-box;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.hero-card {
  background: linear-gradient(145deg, #1b1b1b, #2a2a2a);
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 8px 25px rgba(0,0,0,.45);
  transition: transform .2s ease, box-shadow .2s ease;
  cursor: pointer;
}

.hero-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 34px rgba(0,0,0,.6);
}

.hero-icon {
  font-size: 30px;
  opacity: .9;
}

.hero-title {
  font-size: 13px;
  color: #cfcfcf;
  margin-top: 6px;
  letter-spacing: .4px;
}

.hero-value {
  font-size: 30px;
  font-weight: 800;
  margin: 6px 0;
}

.hero-sub {
  font-size: 12px;
  color: #9e9e9e;
}

.hero-green .hero-value { color: #4CAF50; }
.hero-red   .hero-value { color: #FF5252; }
.hero-blue  .hero-value { color: #4FC3F7; }
.hero-gold  .hero-value { color: #FFD54F; }


/* ==========================================================
   8. RANKINGS E BARRAS DE PROGRESSO
   ========================================================== */
.rank-card {
  background: linear-gradient(145deg, #1e1e1e, #2a2a2a);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.45);
  height: 100%;
  box-sizing: border-box;
}

.rank-card h5 {
  color: #ffffff;
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 16px;
  border-bottom: 1px solid #3a3a3a;
  padding-bottom: 8px;
}

.rank-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.bar-item {
  position: relative;
  padding: 6px 0 12px 0;
  margin-bottom: 6px;
}

.rank-name {
  display: block;
  font-size: 14px;
  color: #f1f1f1;
  margin-bottom: 2px;
}

.rank-value {
  position: absolute;
  right: 0;
  top: 6px;
  font-size: 13px;
  color: #4FC3F7;
  font-weight: bold;
}

.bar-bg {
  display: block;
  width: 100%;
  height: 9px;
  background-color: #2c2c2c;
  border-radius: 6px;
  overflow: hidden;
  margin-top: 6px;
}

.bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #4CAF50, #81C784);
  border-radius: 6px;
  min-width: 2px;
  transition: width .6s ease;
}

.bar-fill.blue {
  background: linear-gradient(90deg, #4FC3F7, #81D4FA);
}


/* ==========================================================
   9. ANIMAÇÕES
   ========================================================== */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}