/* Custom premium style.css for DSW Equipamentos */
:root {
  color-scheme: dark;
  --bg: #0b0f19;
  --card: rgba(17, 24, 39, 0.65);
  --border: rgba(255, 255, 255, 0.08);
  --text: #f8fafc;
  --muted: #94a3b8;
  --primary: #10b981;
  --primary-hover: #059669;
  --primary-glow: rgba(16, 185, 129, 0.15);
  --secondary: #334155;
  --secondary-hover: #475569;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --warning: #f59e0b;
  --info: #3b82f6;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font);
  background-color: var(--bg);
  background-image: 
    radial-gradient(circle at 5% 10%, rgba(16, 185, 129, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 95% 90%, rgba(59, 130, 246, 0.06) 0%, transparent 40%),
    linear-gradient(185deg, #070a13 0%, #0d1220 100%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

.app-shell {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

/* Oculta o Hero quando autenticado para otimizar espaço */
body:has(.auth-grid.authenticated) .hero {
  display: none;
}

.hero {
  text-align: center;
  margin-bottom: 3.5rem;
  animation: fadeIn 0.6s ease-out;
}

.eyebrow {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--primary);
  background: rgba(16, 185, 129, 0.08);
  padding: 0.4rem 1rem;
  border-radius: 999px;
  margin-bottom: 1.25rem;
  border: 1px solid rgba(16, 185, 129, 0.15);
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 850;
  line-height: 1.1;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #ffffff 40%, #a7f3d0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
}

.hero-copy {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 55ch;
  margin: 0 auto;
  font-weight: 400;
}

/* CARD COM GLASSMORPHISM */
.card {
  background: var(--card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.25rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

/* CONTROLES DE AUTENTICAÇÃO (#auth-card) */
#auth-card {
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Layout Desconectado (Card de Login Centrado) */
#auth-card:not(:has(.auth-grid.authenticated)) {
  max-width: 450px;
  margin: 2rem auto 4rem;
  padding: 3rem 2.25rem;
  text-align: center;
  box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.7), 0 0 50px -10px rgba(16, 185, 129, 0.05);
}

#auth-card:not(:has(.auth-grid.authenticated)) .section-header {
  flex-direction: column;
  text-align: center;
  gap: 0.75rem;
  margin-bottom: 2.25rem;
}

#auth-card:not(:has(.auth-grid.authenticated)) .section-header h2 {
  font-size: 1.85rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff 50%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.01em;
}

#auth-card:not(:has(.auth-grid.authenticated)) .panel-copy {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.4;
}

#auth-card:not(:has(.auth-grid.authenticated)) .auth-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

#auth-card:not(:has(.auth-grid.authenticated)) .auth-actions {
  width: 100%;
}

#auth-card:not(:has(.auth-grid.authenticated)) .auth-status {
  width: 100%;
  margin-top: 1.75rem;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px dashed rgba(255, 255, 255, 0.08);
}

/* Ocultar elementos irrelevantes na tela de login deslogada */
#auth-card:not(:has(.auth-grid.authenticated)) .auth-status strong,
#auth-card:not(:has(.auth-grid.authenticated)) .auth-status p:not(#auth-status),
#auth-card:not(:has(.auth-grid.authenticated)) .auth-status .auth-token-wrap {
  display: none !important;
}

/* Layout Autenticado (Barra de Navegação Topo) */
#auth-card:has(.auth-grid.authenticated) {
  padding: 1.15rem 2rem 3.8rem; /* Espaço inferior para o token absolute */
  margin-bottom: 3rem;
  border-radius: 16px;
  position: relative;
}

#auth-card:has(.auth-grid.authenticated) .section-header > div {
  display: none; /* Oculta títulos de login */
}

#auth-card:has(.auth-grid.authenticated) .section-header {
  order: 2; /* Sair vai para a direita */
  margin-bottom: 0;
  width: auto;
}

#auth-card:has(.auth-grid.authenticated) .auth-grid {
  order: 1; /* Infos do usuário vão para a esquerda */
  display: flex;
  flex-direction: row;
  align-items: center;
  width: 100%;
}

/* BOTAO ENTRAR COM GOOGLE */
.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  color: #0f172a;
  border: none;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
  padding: 0.95rem 1.5rem;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 14px rgba(255, 255, 255, 0.12);
  width: 100%;
}

.btn-google:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(255, 255, 255, 0.2);
  background: #f8fafc;
}

.btn-google:active {
  transform: translateY(0);
}

/* ELEMENTOS DE PERFIL (LOGADO) */
.auth-grid.authenticated .auth-status {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1rem;
  background: transparent;
  border: none;
  padding: 0;
  width: 100%;
}

.auth-grid.authenticated .auth-status strong:first-of-type {
  display: none; /* Oculta legenda do Status */
}

.auth-grid.authenticated #auth-status {
  order: 3;
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--primary);
  background: rgba(16, 185, 129, 0.12);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.auth-grid.authenticated #auth-user {
  order: 2;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

.auth-grid.authenticated .auth-media {
  order: 1;
  display: flex;
  align-items: center;
}

.auth-grid.authenticated #auth-photo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
  object-fit: cover;
}

/* TOKEN JWT EMBUTIDO NO RODAPÉ DO NAVBAR */
.auth-grid.authenticated .auth-token-wrap {
  position: absolute;
  bottom: 0.85rem;
  left: 2rem;
  right: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 0.75rem;
}

.auth-grid.authenticated .auth-token-wrap strong {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
}

.auth-token {
  font-family: monospace;
  font-size: 0.75rem;
  background: #040811;
  color: #a7f3d0;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  max-width: 320px;
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* BOTAO SAIR (LOGOUT) */
.btn-secondary {
  background: var(--secondary);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.6rem 1.25rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--secondary-hover);
  transform: translateY(-1.5px);
}

/* LAYOUT DO DASHBOARD (FORM + TABELA EM GRID) */
.dashboard-grid {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 2.25rem;
  align-items: start;
  animation: slideUp 0.5s ease-out;
}

/* FORMULÁRIO DE CADASTRO */
#form-equipamento {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

#form-equipamento::before {
  content: '📝 Cadastro';
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--primary);
  letter-spacing: 0.1em;
}

.grid-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.grid-form label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.grid-form input,
.grid-form select {
  font-family: var(--font);
  background: #0d121f;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 0.8rem 1rem;
  border-radius: 10px;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s ease;
  width: 100%;
}

.grid-form input:focus,
.grid-form select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
  background: #111827;
}

.grid-form select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1.1em;
  padding-right: 2.5rem;
}

.grid-form select option {
  background: #0f172a;
  color: var(--text);
}

.botoes {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.botoes button {
  flex: 1;
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.85rem 1.25rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

#btn-salvar {
  background: var(--primary);
  color: #042f1a;
  box-shadow: 0 4px 14px var(--primary-glow);
}

#btn-salvar:hover {
  background: var(--primary-hover);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
  transform: translateY(-1.5px);
}

#btn-cancelar {
  background: var(--secondary);
  color: var(--text);
}

#btn-cancelar:hover {
  background: var(--secondary-hover);
}

/* LISTAGEM DE EQUIPAMENTOS */
.dashboard-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.dashboard-content > section.card {
  padding: 2.25rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.75rem;
}

.section-header h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.section-header h2::before {
  content: '🖥️ ';
}

.badge {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #064e3b;
  background: #a7f3d0;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  border: 1px solid rgba(6, 78, 59, 0.1);
  letter-spacing: 0.02em;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  background: rgba(10, 15, 26, 0.25);
}

th, td {
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

th {
  background: rgba(15, 23, 42, 0.45);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

td {
  font-size: 0.95rem;
  color: #e2e8f0;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.015);
}

/* BOTÕES DE AÇÃO NA TABELA */
td button {
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  margin-right: 0.5rem;
  border: none;
}

.btn-editar {
  background: rgba(245, 158, 11, 0.08);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.15) !important;
}

.btn-editar:hover {
  background: #f59e0b;
  color: #000000;
  transform: translateY(-1.5px);
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.15);
}

.btn-excluir {
  background: rgba(239, 68, 68, 0.08);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.15) !important;
}

.btn-excluir:hover {
  background: var(--danger);
  color: #ffffff;
  transform: translateY(-1.5px);
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.2);
}

/* ANIMAÇÕES */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* LAYOUT RESPONSIVO */
@media (max-width: 992px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 2rem 1rem;
  }
  
  #auth-card:has(.auth-grid.authenticated) .auth-grid {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  #auth-card:has(.auth-grid.authenticated) .btn-secondary {
    align-self: flex-end;
  }
  
  .auth-grid.authenticated .auth-token-wrap {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    position: static;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 0.75rem;
    margin-top: 0.75rem;
  }

  #auth-card:has(.auth-grid.authenticated) {
    padding-bottom: 1.5rem;
  }
}
