:root {
  --primary: #c0392b;
  --primary-dark: #96281b;
  --secondary: #e67e22;
  --gold: #f39c12;
  --bg: #dbd8d3;
  --card-bg: #ffffff;
  --text: #2c1810;
  --text-muted: #7a5c45;
  --border: #7c5819;
  --shadow: 0 2px 12px rgba(44, 24, 16, .10);
  --shadow-hover: 0 6px 24px rgba(44, 24, 16, .18);
  --green: #27ae60;
  --green-light: #d4edda;
  --radius: 12px;
}

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

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ---- HEADER ---- */
.site-header {
  background: var(--primary);
  color: #fff;
}

.header-hero {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 32px;
  max-width: 1200px;
  margin: 0 auto;
}

.header-hero img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid var(--gold);
  flex-shrink: 0;
}

.header-title h1 {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header-title p {
  font-size: .98rem;
  opacity: .85;
  margin-top: 5px;
}

/* Bandeirinhas decoration */
.bandeirinhas {
  height: 14px;
  background: repeating-linear-gradient(
    90deg,
    #c0392b 0 28px,
    #f39c12 28px 56px,
    #27ae60 56px 84px,
    #2980b9 84px 112px,
    #8e44ad 112px 140px
  );
}

/* ---- CONTROLS BAR ---- */
.controls-bar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 12px 32px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.search-wrapper {
  flex: 1;
  min-width: 160px;
  max-width: 320px;
}

.search-wrapper input {
  width: 100%;
  padding: 9px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: .93rem;
  outline: none;
  transition: border-color .2s;
  background: var(--bg);
  color: var(--text);
}

.search-wrapper input:focus {
  border-color: var(--primary);
}

.search-wrapper input::placeholder {
  color: var(--text-muted);
}

.filter-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-btn input[type="radio"] {
  display: none;
}

.filter-btn span {
  display: inline-block;
  padding: 7px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  font-size: .87rem;
  cursor: pointer;
  transition: all .2s;
  color: var(--text-muted);
  background: var(--bg);
  user-select: none;
}

.filter-btn input:checked + span {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

.filter-btn span:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.filter-btn input:checked + span:hover {
  color: #fff;
}

/* ---- MAIN / GRID ---- */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 48px;
}

#dishes-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 20px;
}

/* ---- DISH CARD ---- */
.dish {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .2s, box-shadow .2s;
}

.dish:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.dish img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}

.dish h4 {
  font-size: .92rem;
  font-weight: 600;
  color: var(--text);
  padding: 10px 12px 4px;
  line-height: 1.35;
}

.dish-footer {
  padding: 8px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: auto;
}

.dish input[type="text"] {
  padding: 7px 10px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: .87rem;
  outline: none;
  transition: border-color .2s;
  width: 100%;
}

.dish input[type="text"]:focus {
  border-color: var(--primary);
}

.dish input[type="text"]::placeholder {
  color: var(--text-muted);
}

.dish button {
  padding: 8px 12px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
  width: 100%;
  margin-top: 0;
}

.dish button:hover {
  background: var(--primary-dark);
}

/* Reserved badge */
.reserved-name {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: var(--green-light);
  color: #155724;
  padding: 8px 10px;
  border-radius: 8px;
  font-weight: 600;
  font-size: .9rem;
  text-align: center;
}

.reserved-name::before {
  content: '✓';
  background: var(--green);
  color: #fff;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  flex-shrink: 0;
}

/* ---- MODAL ---- */
#confirm-modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0; top: 0;
  width: 100vw; height: 100vh;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(2px);
}

#confirm-modal .modal-content {
  background: #fff;
  border-radius: 14px;
  padding: 32px 28px 22px;
  max-width: 340px;
  margin: 15vh auto 0;
  box-shadow: 0 8px 40px rgba(0,0,0,.2);
  text-align: center;
}

#modal-message {
  font-size: 1rem;
  color: var(--text);
  line-height: 1.6;
}

#confirm-modal .modal-buttons {
  margin-top: 22px;
  display: flex;
  gap: 12px;
  justify-content: center;
}

#confirm-modal button {
  width: auto;
  margin: 0;
  padding: 9px 28px;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: .95rem;
  cursor: pointer;
  transition: opacity .2s;
}

#confirm-modal button:hover { opacity: .85; }
#confirm-modal .sim { background: var(--green); color: #fff; }
#confirm-modal .nao { background: #dc3545; color: #fff; }

#result-modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0; top: 0;
  width: 100vw; height: 100vh;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(2px);
}

#result-modal .modal-content {
  background: #fff;
  border-radius: 14px;
  padding: 32px 28px 22px;
  max-width: 340px;
  margin: 15vh auto 0;
  box-shadow: 0 8px 40px rgba(0,0,0,.2);
  text-align: center;
}

#result-icon {
  font-size: 2.4rem;
  margin-bottom: 10px;
}

#result-message {
  font-size: 1rem;
  color: var(--text);
  line-height: 1.6;
}

#result-modal .fechar {
  margin-top: 22px;
  padding: 9px 32px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: .95rem;
  cursor: pointer;
  transition: opacity .2s;
}

#result-modal .fechar:hover { opacity: .85; }

/* ---- ADMIN ---- */
.admin-header {
  background: var(--primary);
  color: #fff;
  padding: 20px 32px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}

.admin-container {
  max-width: 900px;
  margin: 32px auto;
  padding: 0 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

th {
  background: #fdf0e0;
  color: var(--text);
  font-weight: 600;
  font-size: .9rem;
  padding: 12px 14px;
  text-align: left;
  border-bottom: 2px solid var(--border);
}

td {
  padding: 11px 14px;
  border-bottom: 1px solid #f0e8d8;
  font-size: .92rem;
  color: var(--text);
}

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

tbody tr:hover td {
  background: #fdf8f0;
}

.btn-excluir {
  background: #dc3545;
  color: #fff;
  border: none;
  padding: 5px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  transition: background .2s;
}

.btn-excluir:hover {
  background: #b02a37;
}

table a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  word-break: break-all;
}

table a:hover {
  text-decoration: underline;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 640px) {
  .header-hero {
    padding: 14px 16px;
    gap: 12px;
  }

  .header-hero img {
    width: 72px;
    height: 72px;
  }

  .header-title h1 {
    font-size: 1.3rem;
  }

  .controls-bar {
    padding: 10px 12px;
  }

  .search-wrapper {
    max-width: 100%;
  }

  #dishes-list {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  main {
    padding: 16px 15px 36px;
  }

  .admin-container {
    padding: 0 8px;
    margin-top: 20px;
  }

  table, thead, tbody, th, td, tr {
    display: block;
    width: 100%;
  }

  thead tr { display: none; }

  tbody tr {
    margin-bottom: 14px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 10px 0;
  }

  td {
    border: none;
    position: relative;
    padding-left: 50%;
    text-align: left;
    min-height: 36px;
  }

  td:before {
    position: absolute;
    left: 12px;
    top: 11px;
    width: 42%;
    white-space: nowrap;
    font-weight: 600;
    color: var(--text-muted);
    font-size: .82rem;
  }

  td:nth-child(1):before { content: "ID"; }
  td:nth-child(2):before { content: "Prato"; }
  td:nth-child(3):before { content: "Nome"; }
  td:nth-child(4):before { content: "Data/Hora"; }
  td:nth-child(5):before { content: "IP"; }
  td:nth-child(6):before { content: "Ação"; }
}
