:root {
  --btn-spacing-vertical: 0.35rem;
  --btn-spacing-horizontal: 0.8rem;
  --action-btn-min: 90px;
  --action-btn-preferred: 10vw;
  --action-btn-max: 120px;
}

html {
  scroll-behavior: smooth;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background-color: #f8f9fa;
}

main {
  flex: 1;
  padding: 100px 20px 20px 20px;
  margin: 0 auto;
  width: 100%;
  max-width: 100%;
}

footer {
  padding-top: 40px;
  padding-bottom: 40px;
  border-top: 1px solid #e0e0e0;
  text-align: center;
  font-size: 14px;
  color: #666;
  width: 100%;
  background-color: #f8f9fa;
  flex-shrink: 0;
}

.btn {
  padding: 0.55rem 0.95rem !important;
  border-radius: 0.38rem !important;
}

.btn-sm {
  padding: 0.45rem 0.8rem !important;
}

.btn-group > .btn {
  margin: 0.15rem !important;
}

table .btn {
  margin: 0 0.15rem 0.15rem 0 !important;
  height: 40px !important;
  width: clamp(var(--action-btn-min), var(--action-btn-preferred), var(--action-btn-max)) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0.35rem 0.55rem !important;
  line-height: 1 !important;
  font-size: 0.85rem !important;
  border-radius: 0.45rem !important;
}

.btn + .btn {
  margin-left: 0.35rem !important;
}

.btn-group .btn {
  margin: 0 !important;
}

.btn-toolbar .btn,
.actions .btn,
header .btn {
  margin: 0.2rem 0.3rem !important;
}

.table .btn {
  margin: 0 0.2rem 0.2rem 0 !important;
}

.btn {
  border-radius: 0.35rem !important;
}

.card, .container, .modal-content {
  .btn {
    border-radius: 0.35rem !important;
    padding: 0.45rem 0.85rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.02em !important;
  }

  .btn-sm {
    padding: 0.38rem 0.7rem !important;
    font-size: 0.84rem !important;
  }

  .btn + .btn,
  .btn-group .btn,
  .actions .btn,
  header .btn {
    margin-left: 0.35rem !important;
  }

  table .btn {
    margin: 0 0.2rem 0.25rem 0 !important;
  }

  .btn {
    margin: 0 !important;
  }
}

/* ========== TABELAS RESPONSIVAS ========== */
.table-responsive-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  margin-bottom: 0;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
}

.table thead th {
  border-bottom: 2px solid #dee2e6;
  border-right: 1px solid #dee2e6;
  font-weight: 600;
  background-color: #f8f9fa;
  text-align: left;
  padding: 0.75rem;
}

.table thead th:last-child {
  border-right: none;
}

.table tbody tr {
  border: 1px solid #e0e0e0;
  background-color: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.table tbody tr:hover {
  border-color: #b0b0b0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.table tbody td {
  vertical-align: middle;
  padding: 0.75rem;
  border: none;
  border-right: 1px solid #e0e0e0;
}

.table tbody td:last-child {
  border-right: none;
  text-align: center;
}

/* Padronização de ícones nos botões */
.table .btn i,
.table .btn [class^="fa"],
.table .btn [class^="fa-"] {
  font-size: 0.85rem !important;
  margin-right: 0.35rem !important;
  min-width: 12px !important;
}

.table .btn span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Padronizar botões na coluna de ações */
.table .actions .btn {
  font-size: 0.9rem !important;
  padding: 0.4rem 0.6rem !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  margin: 0.12rem !important;
  white-space: nowrap;
  width: clamp(var(--action-btn-min), var(--action-btn-preferred), var(--action-btn-max)) !important;
  height: 40px !important;
  border-radius: 0.45rem !important;
}

/* ========== RESPONSIVIDADE TABELAS EM MOBILE ========== */
@media (max-width: 768px) {
  .table {
    font-size: 0.875rem;
  }

  .table thead {
    display: none;
  }

  .table tbody tr {
    display: block;
    border: 1px solid #e0e0e0;
    margin-bottom: 1rem;
    border-radius: 0.25rem;
    padding: 0.75rem;
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  }

  .table tbody td {
    display: block;
    text-align: left !important;
    padding: 0.5rem 0;
    border: none !important;
    border-right: none !important;
    padding-left: 0 !important;
  }

  .table tbody td::before {
    content: attr(data-label);
    font-weight: 700;
    display: block;
    margin-bottom: 0.25rem;
    color: #495057;
  }

  .table tbody td:first-child {
    margin-top: 0;
  }

  /* Botões em mobile */
  .actions {
    margin-top: 0.75rem !important;
    padding-top: 0.75rem !important;
    border-top: 1px solid #dee2e6;
  }

  .actions .d-flex {
    flex-wrap: wrap;
    gap: 0.4rem !important;
    justify-content: center;
  }

  .actions .btn {
    padding: 0.45rem 0.6rem !important;
    margin: 0.15rem 0 !important;
    font-size: 0.9rem !important;
    height: 44px !important;
    width: 100% !important;
    min-width: 0 !important;
    display: block !important;
    border-radius: 0.45rem !important;
    text-align: center !important;
  }

  /* Busca em mobile */
  .input-group {
    width: 100%;
  }

  .input-group input,
  .input-group button {
    font-size: 0.875rem;
  }

  /* Imagens da tabela */
  .table img {
    max-width: 50px;
    height: auto;
  }
}

/* ========== BOTÕES EM DESKTOP ========== */
@media (min-width: 769px) {
  .table .actions .btn {
    padding: 0.4rem 0.6rem !important;
    font-size: 0.9rem !important;
    margin: 0.12rem !important;
    width: clamp(var(--action-btn-min), var(--action-btn-preferred), var(--action-btn-max)) !important;
    height: 40px !important;
  }

  .table .btn i,
  .table .btn [class^="fa"],
  .table .btn [class^="fa-"] {
    font-size: 0.7rem !important;
  }

  .actions .d-flex {
    gap: 0.4rem !important;
  }
}

/* ========== LAYOUT DE CARDS RESPONSIVO ========== */
.card-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

/* Layout de 2 colunas centralizado */
.card-container-centered {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  max-width: 600px;
  margin: 0 auto 2rem auto;
  padding: 0 15px;
}

@media (max-width: 767.98px) {
  .card-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .card-container-centered {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

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

  .card-container-centered {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

/* ========== NAVBAR RESPONSIVO ========== */
.navbar {
  padding: 0.5rem 0;
}

@media (max-width: 991.98px) {
  .navbar-collapse {
    margin-top: 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 0.5rem;
  }
}

/* ========== CONTAINER DE FORMULÁRIO ========== */
.form-container {
  max-width: 100%;
  width: 100%;
}

@media (min-width: 768px) {
  .form-container {
    max-width: 600px;
  }
}

/* ========== ALERTA RESPONSIVO ========== */
.alert {
  margin: 1rem 0;
  word-break: break-word;
}

@media (max-width: 575.98px) {
  .alert {
    font-size: 0.875rem;
    margin: 0.75rem 0;
  }

  .alert .btn-close {
    padding: 0.4rem;
  }
}

/* ========== FOOTER RESPONSIVO ========== */
footer {
  font-size: clamp(0.75rem, 2vw, 0.95rem);
  padding: 20px 15px;
}

@media (max-width: 575.98px) {
  footer {
    padding: 15px 10px;
  }
}

/* ========== UTILITY CLASSES ========== */
.text-end {
  text-align: right !important;
}

.text-start {
  text-align: left !important;
}

.text-center {
  text-align: center !important;
}

/* Dashboard buttons (cards) */
.card-container-centered .dash-primary {
  background-color: #495057 !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: 0 6px 18px rgba(73,80,87,0.12) !important;
}
.card-container-centered .dash-primary i {
  color: #f8f9fa !important;
}
.card-container-centered .dash-accent {
  background-color: #e9ecef !important;
  color: #212529 !important;
  border: none !important;
  box-shadow: 0 6px 18px rgba(33,37,41,0.06) !important;
}
.card-container-centered .dash-accent i {
  color: #495057 !important;
}
.card-container-centered .btn {
  transition: transform 0.12s ease, box-shadow 0.12s ease !important;
}
.card-container-centered .btn:hover {
  transform: translateY(-3px) !important;
}

/* ========== BOTÕES DAS TABELAS - CORES DO DASHBOARD ========== */
/* Aplicar cores dos botões do dashboard nos botões das tabelas e em toda a aplicação */
.btn-light {
  background-color: #e9ecef !important;
  color: #212529 !important;
  border: none !important;
  transition: all 0.2s ease !important;
}

.btn-light:hover {
  background-color: #dee2e6 !important;
  color: #212529 !important;
}

.btn-secondary {
  background-color: #495057 !important;
  color: #ffffff !important;
  border: none !important;
  transition: all 0.2s ease !important;
}

.btn-secondary:hover {
  background-color: #3d444d !important;
  color: #ffffff !important;
}

.btn-dark {
  background-color: #dc3545 !important;
  color: #ffffff !important;
  border: none !important;
  transition: all 0.2s ease !important;
}

.btn-dark:hover {
  background-color: #c82333 !important;
  color: #ffffff !important;
}

/* Compatibilidade com Bootstrap 5 */
.text-right {
  text-align: right !important;
}

/* ========== IMAGEM RESPONSIVA ========== */
img {
  max-width: 100%;
  height: auto;
}

.img-thumbnail {
  max-width: 100%;
  height: auto;
}

/* ========== ESPAÇAMENTO RESPONSIVO ========== */
@media (max-width: 767.98px) {
  .mt-1 { margin-top: 0.25rem !important; }
  .mb-3 { margin-bottom: 0.75rem !important; }
  .mb-2 { margin-bottom: 0.5rem !important; }
  .p-3 { padding: 0.75rem !important; }
  .py-3 { padding-top: 0.75rem !important; padding-bottom: 0.75rem !important; }
}

/* ========== FORM CONTAINER ========== */
.form-container {
  max-width: 100%;
  padding: 0 15px;
}

@media (min-width: 768px) {
  .form-container {
    max-width: 700px;
  }
}

@media (min-width: 992px) {
  .form-container {
    max-width: 850px;
  }
}

/* ========== PREVIEW DE IMAGENS RESPONSIVO ========== */
.img-preview-wrapper {
  border: 2px solid #ddd;
  padding: 15px;
  border-radius: 6px;
  background: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 250px;
}

.img-preview-wrapper img {
  width: 100%;
  max-width: 400px;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}

@media (max-width: 768px) {
  .img-preview-wrapper {
    min-height: 280px;
  }

  .img-preview-wrapper img {
    max-width: 350px;
  }
}

@media (max-width: 576px) {
  .img-preview-wrapper {
    min-height: 250px;
    padding: 12px;
  }

  .img-preview-wrapper img {
    max-width: 100%;
  }
}

/* ========== CUSTOM FORM STYLING ========== */
.form-label {
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: #333;
}

.form-control,
.form-select {
  border-radius: 0.375rem;
  border: 1px solid #ced4da;
  font-size: 1rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus,
.form-select:focus {
  border-color: #80bdff;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

@media (max-width: 575.98px) {
  .form-control,
  .form-select {
    font-size: 0.95rem;
    padding: 0.5rem 0.75rem;
  }

  .form-label {
    font-size: 0.95rem;
  }

  .game-image-responsive {
    max-height: 350px !important;
  }
}

/* Imagem do jogo em tablet */
@media (min-width: 576px) and (max-width: 991.98px) {
  .game-image-responsive {
    max-height: 350px !important;
  }
}

/* Imagem do jogo em desktop */
@media (min-width: 992px) {
  .game-image-responsive {
    max-height: 350px !important;
  }
}