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

:root {
  --cor-principal: #c2185b;
  --cor-principal-hover: #ad1457;
  --cor-livre-bg: #fce4ec;
  --cor-livre-texto: #c2185b;
  --cor-perigo: #c62828;
  --cor-perigo-hover: #b71c1c;
  --cor-secundaria-bg: #eeeeee;
  --cor-secundaria-hover: #dddddd;
  --raio: 8px;
  --sombra-modal: 0 4px 24px rgba(0, 0, 0, 0.18);
}

body {
  font-family: sans-serif;
  background: #f4f4f4;
  color: #333;
  min-height: 100vh;
}

/* Header */

header {
  background: var(--cor-principal);
  color: white;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

header h1 {
  font-size: clamp(1rem, 2.5vw, 1.3rem);
}

#contador {
  font-size: clamp(0.75rem, 2vw, 0.9rem);
  opacity: 0.9;
  background: rgba(255, 255, 255, 0.15);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  white-space: nowrap;
}

/* Grid */

main {
  padding: clamp(1rem, 3vw, 1.5rem);
}

#grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(44px, 8vw, 56px), 1fr));
  gap: clamp(4px, 1.5vw, 8px);
}

/* Números */

.numero {
  aspect-ratio: 1;
  border: none;
  border-radius: var(--raio);
  font-size: clamp(0.6rem, 1.5vw, 0.8rem);
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.1s;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

.numero:hover {
  transform: scale(1.08);
  opacity: 0.85;
}

.numero:active {
  transform: scale(0.96);
}

.numero.livre {
  background: var(--cor-livre-bg);
  color: var(--cor-livre-texto);
}

.numero.ocupado {
  background: var(--cor-principal);
  color: white;
}

/* Modal */

#modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal-box {
  background: white;
  border-radius: 12px;
  padding: clamp(1rem, 4vw, 1.5rem);
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-shadow: var(--sombra-modal);
}

.modal-box h2 {
  font-size: clamp(1rem, 3vw, 1.2rem);
  color: var(--cor-principal);
}

#form-cadastro,
#info-ocupado p {
  font-size: 0.95rem;
  color: #444;
  padding: 0.6rem 0;
  border-bottom: 1px solid #f0f0f0;
  line-height: 1.6;
}

#info-ocupado p:last-of-type {
  border-bottom: none;
  margin-bottom: 0.5rem;
}

input[type="text"],
input[type="tel"] {
  padding: 0.7rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: var(--raio);
  font-size: 1rem;
  width: 100%;
  -webkit-appearance: none;
}

input:focus {
  outline: none;
  border-color: var(--cor-principal);
  box-shadow: 0 0 0 3px rgba(194, 24, 91, 0.15);
}

#info-ocupado p {
  font-size: 0.95rem;
  color: #444;
}

/* Botões */

button {
  padding: 0.7rem 1rem;
  border: none;
  border-radius: var(--raio);
  font-size: 1rem;
  cursor: pointer;
  font-weight: bold;
  width: 100%;
  touch-action: manipulation;
  transition: background 0.15s;
}

.btn-primary {
  background: var(--cor-principal);
  color: white;
}

.btn-primary:hover {
  background: var(--cor-principal-hover);
}

.btn-danger {
  background: var(--cor-perigo);
  color: white;
}

.btn-danger:hover {
  background: var(--cor-perigo-hover);
}

.btn-secondary {
  background: var(--cor-secundaria-bg);
  color: #333;
}

.btn-secondary:hover {
  background: var(--cor-secundaria-hover);
}

/* Mobile */

@media (max-width: 480px) {
  header {
    padding: 0.75rem 1rem;
  }

  #grid {
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    gap: 4px;
  }

  .modal-box {
    border-radius: 16px 16px 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 100%;
    padding: 1.25rem 1rem;
  }

  #modal {
    align-items: flex-end;
    padding: 0;
  }
}

/* Footer */

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: white;
  border-top: 1px solid #e0e0e0;
  margin-top: 2rem;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.footer-logo img {
  height: 36px;
  width: auto;
  object-fit: contain;
}

.footer-logo span {
  font-size: 0.85rem;
  color: #555;
  font-weight: bold;
}

.footer-dev {
  font-size: 0.8rem;
  color: #999;
}

.footer-dev a {
  color: var(--cor-principal);
  text-decoration: none;
  font-weight: bold;
}

.footer-dev a:hover {
  text-decoration: underline;
}

@media (max-width: 480px) {
  footer {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem;
  }
}