/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}
/* Prevent zooming on double-tap */
* {
  touch-action: manipulation;
}

body {
  background-color: #0a0a0a;
  color: #e6e6e6;
  padding-bottom: calc(
    84px + env(safe-area-inset-bottom, 0px)
  ); /* Space for upgraded bottom nav */
  min-height: 100vh;
}

header {
  background-color: #0d0d0d;
  color: #e6ffe6;
  padding: 15px;
  text-align: center;
  box-shadow: 0 1px 0 rgba(0, 255, 140, 0.12), 0 8px 20px rgba(0, 0, 0, 0.5);
  border-bottom: 1px solid rgba(0, 255, 140, 0.18);
}

h1,
h2,
h3 {
  margin-bottom: 10px;
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, #0b0b0b, #080808);
  display: flex;
  justify-content: space-around;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -1px 0 rgba(0, 255, 140, 0.12),
    0 -10px 30px rgba(0, 0, 0, 0.6) inset;
  z-index: 100;
  border-top: 1px solid rgba(0, 255, 140, 0.18);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: #a3a3a3;
  font-size: 13px;
  padding: 5px;
}

.nav-item.active {
  color: #00ff8c;
}

.nav-item .icon {
  font-size: 22px;
  margin-bottom: 3px;
}

/* Active underline indicator for footer */
.bottom-nav .nav-item.active::after {
  content: "";
  display: block;
  width: 18px;
  height: 2px;
  margin-top: 6px;
  border-radius: 2px;
  background: #00ff8c;
  box-shadow: 0 0 8px rgba(0, 255, 140, 0.5);
}

/* Tables View */
.tables-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  padding: 15px;
}

.table-card {
  background: linear-gradient(180deg, #101010, #0b0b0b 60%, #0a0a0a);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 1px 0 rgba(0, 255, 140, 0.08), 0 10px 24px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid rgba(0, 255, 140, 0.12);
}

.table-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 1px 0 rgba(0, 255, 140, 0.15), 0 18px 36px rgba(0, 0, 0, 0.75);
}

.table-card h2 {
  font-size: 24px;
  color: #ccffea;
}

.table-status {
  padding: 5px;
  border-radius: 5px;
  font-size: 12px;
  margin-top: 5px;
}

.table-status.available {
  background: rgba(0, 255, 140, 0.12);
  color: #00ff8c;
  border: 1px solid rgba(0, 255, 140, 0.25);
}

.table-status.occupied {
  background: rgba(255, 80, 80, 0.12);
  color: #ff7a7a;
  border: 1px solid rgba(255, 80, 80, 0.25);
}

/* Table Details */
.table-details {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 70px;
  background: linear-gradient(180deg, #0d0d0d, #0a0a0a);
  z-index: 200;
  padding: 15px;
  overflow-y: auto;
  display: none;
}

.details-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.close-btn {
  background: none;
  border: 1px solid rgba(0, 255, 140, 0.25);
  color: #ccffea;
  background-color: rgba(0, 255, 140, 0.08);
  font-size: 18px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
}

.menu-categories {
  display: flex;
  overflow-x: auto;
  gap: 10px;
  margin-bottom: 15px;
  padding-bottom: 5px;
}

.category-btn {
  background: #101010;
  color: #e6e6e6;
  border: 1px solid rgba(0, 255, 140, 0.18);
  padding: 8px 15px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
}

.category-btn.active {
  background: linear-gradient(
    180deg,
    rgba(0, 255, 140, 0.18),
    rgba(0, 255, 140, 0.12)
  );
  color: #0a0a0a;
  border-color: rgba(0, 255, 140, 0.35);
}

.menu-items {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 15px;
}

.menu-item {
  background: #101010;
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 1px 0 rgba(0, 255, 140, 0.08), 0 10px 20px rgba(0, 0, 0, 0.6);
  text-align: center;
  border: 1px solid rgba(0, 255, 140, 0.12);
}

.menu-item img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-radius: 5px;
  margin-bottom: 5px;
}

.menu-item h3 {
  font-size: 14px;
  margin-bottom: 5px;
  color: #eafff5;
}

.menu-item p {
  font-size: 12px;
  color: #a3a3a3;
}

.item-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 5px;
}

.item-controls button {
  background: linear-gradient(
    180deg,
    rgba(0, 255, 140, 0.35),
    rgba(0, 255, 140, 0.15)
  );
  color: #0a0a0a;
  border: 1px solid rgba(0, 255, 140, 0.35);
  width: 25px;
  height: 25px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
}

.item-controls span {
  margin: 0 10px;
  min-width: 20px;
  text-align: center;
}

.current-order {
  background: #0f0f0f;
  padding: 15px;
  border-radius: 12px;
  margin-top: 15px;
  border: 1px solid rgba(0, 255, 140, 0.12);
}

.order-items {
  max-height: 150px;
  overflow-y: auto;
  margin-bottom: 10px;
}

.order-item {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.order-total {
  text-align: right;
  font-weight: bold;
  font-size: 18px;
  margin: 10px 0;
  color: #ccffea;
}

/* Buttons */
.btn {
  background: linear-gradient(
    180deg,
    rgba(0, 255, 140, 0.35),
    rgba(0, 255, 140, 0.18)
  );
  color: #0a0a0a;
  border: 1px solid rgba(0, 255, 140, 0.35);
  padding: 10px 15px;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  font-size: 16px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 255, 140, 0.15);
}

/* Bills View */
.bills-list {
  padding: 15px;
}

.bill-card {
  background: #0f0f0f;
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 15px;
  box-shadow: 0 1px 0 rgba(0, 255, 140, 0.08), 0 10px 24px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(0, 255, 140, 0.12);
}

.bill-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.bill-items {
  margin: 10px 0;
}

.bill-item {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 14px;
}

.bill-total {
  font-weight: bold;
  text-align: right;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #eee;
}

.clear-bill {
  background-color: #e74c3c;
  margin-top: 10px;
}

/* PhonePe View */
.payment-container {
  padding: 20px;
  text-align: center;
}

.qr-code {
  margin: 20px auto;
  max-width: 250px;
}

.qr-code img {
  width: 100%;
  border: 1px solid #eee;
  padding: 10px;
  background-color: white;
}

.payment-details {
  margin-top: 20px;
}

.amount-input {
  margin: 15px 0;
}

.amount-input input {
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  width: 100%;
  max-width: 200px;
}

/* Reports View */
.date-selector {
  padding: 15px;
  text-align: center;
}

.date-selector input {
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 5px;
}

.report-summary {
  display: flex;
  justify-content: space-around;
  padding: 15px;
}

.summary-card {
  background: #0f0f0f;
  padding: 15px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 1px 0 rgba(0, 255, 140, 0.08), 0 10px 24px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(0, 255, 140, 0.12);
  width: 45%;
}

.summary-card h3 {
  font-size: 14px;
  color: #a3a3a3;
}

.summary-card .amount {
  font-size: 20px;
  font-weight: bold;
  color: #ccffea;
}

/* Ensure reports list isn't hidden under footer on small screens */
.reports-view {
  position: fixed;
  top: 64px; /* approx header height */
  left: 0;
  right: 0;
  bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.reports-content {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 16px;
}

.download-report {
  margin: 20px;
}

/* Settings View */
.settings-section {
  background: #0f0f0f;
  padding: 15px;
  margin-bottom: 15px;
  border-radius: 12px;
  box-shadow: 0 1px 0 rgba(0, 255, 140, 0.08), 0 10px 24px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(0, 255, 140, 0.12);
}

.language-options {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.language-btn {
  padding: 8px 15px;
  border: 1px solid rgba(0, 255, 140, 0.18);
  background-color: #101010;
  color: #e6e6e6;
  border-radius: 8px;
  cursor: pointer;
}

.language-btn.active {
  background: linear-gradient(
    180deg,
    rgba(0, 255, 140, 0.18),
    rgba(0, 255, 140, 0.12)
  );
  color: #0a0a0a;
  border-color: rgba(0, 255, 140, 0.35);
}

.menu-management {
  margin-top: 15px;
}

.add-item-form {
  margin-bottom: 20px;
}

.add-item-form input,
.add-item-form select {
  display: block;
  width: 100%;
  padding: 8px;
  margin-bottom: 10px;
  background: #0f0f0f;
  color: #e6e6e6;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.items-list {
  max-height: 300px;
  overflow-y: auto;
}

.menu-item-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.menu-item-row:last-child {
  border-bottom: none;
}

.delete-item {
  color: #ff7a7a;
  cursor: pointer;
}

/* Responsive Adjustments */
@media (min-width: 768px) {
  .tables-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .menu-items {
    grid-template-columns: repeat(3, 1fr);
  }

  .bottom-nav {
    max-width: 500px;
    margin: 0 auto;
    left: 50%;
    transform: translateX(-50%);
  }
}
