/* ==========================
   RESET E BASE
========================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Arial, sans-serif;
  background: #fff8f0;
  color: #333;
  line-height: 1.4;
}

/* Links */
a { color: inherit; text-decoration: none; cursor: pointer; }
a:hover { opacity: .85; }

/* ==========================
   HEADER E NAV
========================== */
header {
  background: #fff3e0;
  color: #d32f2f;
  padding: 1rem;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #ccc;
  position: relative;
  z-index: 2;
}
.menu-btn {
  font-size: 28px;
  background: none;
  border: none;
  color: #d32f2f;
  cursor: pointer;
  margin-right: 1rem;
}
.logo { height: 64px; margin-right: 1rem; }
h1 { margin: 0; font-size: 1.6rem; }
.right {
  margin-left: auto;
  display: flex;
  gap: .75rem;
  align-items: center;
}
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  background: #fff;
  border: 1px solid #ffd6c9;
  color: #c62828;
  padding: .35rem .75rem;
  border-radius: 999px;
  font-weight: bold;
  font-size: 0.9rem;
  white-space: nowrap;
  transition: color .2s, border-color .2s, background .2s, transform .2s;
}
.pill.active,
.pill.active:focus-visible {
  background: #d32f2f;
  color: #fff;
  border-color: #d32f2f;
}

.admin-header {
  width: 100%;
  background: #fff3e0;
  border-bottom: 1px solid #ccc;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .05);
  position: relative;
  z-index: 2;
}
.admin-wrap {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: .75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: nowrap;
}
.admin-left {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  min-width: 0;
}
.admin-brand {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: #c62828;
  flex-wrap: wrap;
}
.admin-brand strong {
  font-size: 1.25rem;
  color: #d32f2f;
}
.admin-page-title {
  color: #4a4a4a;
  font-size: 1rem;
  font-weight: 500;
}
.admin-badges {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: wrap;
}
.storeBadge {
  padding: .2rem .55rem;
  border-radius: 999px;
  border: 1px solid #ffd6c9;
  background: #fff;
  font-size: .8rem;
  font-weight: 700;
  color: #c62828;
  white-space: nowrap;
}

.header-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid #ffd6c9;
  background: #fff;
}
.header-store-name {
  font-size: 1rem;
  font-weight: 700;
  color: #d32f2f;
}
.admin-nav {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-wrap: wrap;
  padding: .15rem 0;
}
.admin-nav a {
  white-space: nowrap;
}
.admin-actions {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex: 1;
  min-width: 0;
}
.btn-back {
  border: 1px solid #c62828;
  background: #fff;
  color: #c62828;
  padding: .45rem .9rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: .9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s, transform .2s;
}
.btn-back:hover,
.btn-back:focus-visible {
  background: #c62828;
  color: #fff;
  border-color: #c62828;
}

/* ==========================
   SIDEBAR
========================== */
#sidebar {
  position: fixed;
  top: 0;
  left: -250px;
  width: 220px;
  height: 100%;
  background: #fff3e0;
  box-shadow: 2px 0 5px rgba(0,0,0,.2);
  padding: 1rem;
  transition: left .3s;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
#sidebar.open { left: 0; }
#overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  display: none;
  z-index: 2;
}
#sidebar.open ~ #overlay { display: block; }
#sidebar ul { list-style: none; padding: 0; margin: 0; }
#sidebar li { margin: 1rem 0; }
#sidebar a { color: #d32f2f; font-weight: bold; }

/* ==========================
   RODAPÉ LATERAL
========================== */
.rodape {
  font-size: .75rem;
  color: #000;
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid #ccc;
}
.rodape img { width: 30px; margin-bottom: .5rem; }
.rodape span { font-weight: bold; color: #d32f2f; }

/* ==========================
   MAIN / CARDÁPIO
========================== */
main { padding: 1rem; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(220px,1fr));
  gap: 12px;
}
.card {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 10px;
  overflow: hidden;
  transition: transform .2s;
}
.card:hover { transform: translateY(-3px); }
.card img { width: 100%; height: 140px; object-fit: cover; }
.card .info { padding: .75rem; }
.card .name { font-weight: bold; }
.card .price {
  color: #d32f2f;
  font-weight: bold;
  margin-top: .25rem;
}
.btn {
  background: #d32f2f;
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: .5rem .8rem;
  cursor: pointer;
  font-weight: 500;
  transition: background .2s, opacity .2s;
}
.btn:hover { opacity: .9; }

/* Botões semânticos */
.btn-success {
  background: #16a34a !important;
  color: #fff !important;
  border: 1px solid #16a34a !important;
}
.btn-success:hover {
  background: #15803d !important;
  opacity: 1;
}
.btn-cancel {
  background: #dc2626 !important;
  color: #fff !important;
  border: 1px solid #dc2626 !important;
}
.btn-cancel:hover {
  background: #b91c1c !important;
  opacity: 1;
}
.btn-outline {
  background: #fff;
  color: #333;
  border: 1px solid #ddd;
}
.btn-outline:hover {
  background: #f5f5f5;
  opacity: 1;
}

/* ==========================
   BOAS-VINDAS
========================== */
.welcome-box {
  text-align:center;
  padding:2rem;
  color:#444;
  background:#fff;
  border-radius:12px;
  margin:1rem auto;
  max-width:700px;
}
.welcome-box h2 { margin-bottom:1rem; }

/* ==========================
   BADGES / ESTADOS
========================== */
.mode-badge {
  display:inline-block;
  margin:.2rem auto 0;
  padding:.15rem .5rem;
  border-radius:999px;
  border:1px solid #ffd6c9;
  color:#c62828;
  background:#fff;
  font-weight:bold;
  font-size:.85rem;
}
.user-badge {
  background:#c62828;
  color:#fff;
  font-weight:bold;
  border-radius:50%;
  width:32px;
  height:32px;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
}

/* ==========================
   ADMIN: CARDS / FORMULÁRIOS
========================== */
.row { display:flex; gap:16px; flex-wrap:wrap; }
.card-admin {
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:12px;
  box-shadow:0 1px 2px rgba(0,0,0,.05);
  padding:16px;
  flex:1;
  min-width:280px;
}
.card-admin h2 { font-size:16px; margin:0 0 12px; }
label { display:block; font-size:12px; color:#4b5563; margin:8px 0 4px; }
input,select,textarea {
  width:100%;
  border:1px solid #d1d5db;
  border-radius:10px;
  padding:10px;
  font:inherit;
  outline:none;
}
input:focus,select:focus,textarea:focus {
  border-color:#6366f1;
  box-shadow:0 0 0 3px rgba(99,102,241,.15);
}
.actions { display:flex; gap:8px; margin-top:12px; flex-wrap:wrap; }
.btn-primary { background:#111827; color:#fff; }
.btn-secondary { background:#e5e7eb; }
.btn-danger { background:#ef4444; color:#fff; }

/* ==========================
   ADMIN: TABELAS
========================== */
table { width:100%; border-collapse:collapse; }
th,td {
  padding:10px;
  border-bottom:1px solid #eee;
  text-align:left;
  font-size:14px;
}
th { background:#f9fafb; font-weight:600; }
.right { display:flex; justify-content:flex-end; }

.pill.ok {
  background:#dcfce7;
  color:#166534;
  border:1px solid #86efac;
}
.pill.off {
  background:#fee2e2;
  color:#991b1b;
  border:1px solid #fecaca;
}

/* ==========================
   ADMIN: MODAL
========================== */
.modal-backdrop {
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.5);
  display:none;
  align-items:center;
  justify-content:center;
  padding:16px;
  z-index:50;
}
.modal {
  background:#fff;
  border-radius:12px;
  max-width:400px;
  width:100%;
  padding:16px;
  border:1px solid #e5e7eb;
}
.modal h3 { margin:0 0 8px; }
.err { color:#b91c1c; font-size:13px; margin-top:6px; }
.okmsg { color:#065f46; font-size:13px; margin-top:6px; }

/* ==========================
   RESPONSIVIDADE
========================== */
@media (max-width: 1024px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); }
  .logo { height: 56px; }
}
@media (max-width: 768px) {
  header { flex-wrap: wrap; justify-content: center; text-align: center; }
  .logo { height: 48px; margin: 0 auto; }
  .right { margin-left: 0; flex-wrap: wrap; justify-content: center; }
  h1 { font-size: 1.2rem; }
  .row { flex-direction: column; }
  .admin-wrap {
    flex-wrap: wrap;
    padding: .75rem 1rem;
    justify-content: space-between;
  }
  .admin-nav {
    position: relative;
    flex-wrap: nowrap;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    margin-top: .35rem;
    padding-bottom: .2rem;
  }
  /* Hint de scroll: fade sutil nas laterais */
  .admin-nav::before,
  .admin-nav::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 18px;
    pointer-events: none;
    z-index: 1;
  }
  .admin-nav::before {
    left: 0;
    background: linear-gradient(to right, #fff3e0 30%, transparent);
  }
  .admin-nav::after {
    right: 0;
    background: linear-gradient(to left, #fff3e0 30%, transparent);
  }
  .admin-actions {
    justify-content: flex-start;
  }
}
@media (max-width: 480px) {
  .pill, .btn { font-size: 0.8rem; padding: 0.4rem 0.6rem; }
  h1 { font-size: 1rem; }
  .admin-nav {
    gap: .45rem;
  }
}
