/* RESTOM_POS_V4 | Masa durumlari, ust sekmeler ve siparis ekrani gorunumu.
   Yalnizca gorunum: siparis, odeme, yazici ve TPS islevi degismez. Masa cizimi korunur. */

/* --- Ust sekmeler --- */
#tableFilters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid #e5ece8;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(16, 60, 38, .05);
}
#tableFilters .area-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #f2f6f3;
  color: #46584e !important;
  font-size: .86rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  box-shadow: none;
  transition: background .15s ease, color .15s ease;
}
#tableFilters .area-btn:hover { background: #e6f2eb; color: #0b6b42 !important; transform: none; }
#tableFilters .area-btn .area-count {
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 7px;
  background: #fff;
  color: #5f7367;
  font-size: .74rem;
  font-weight: 800;
  text-align: center;
}
#tableFilters .area-btn.active {
  background: #0e9a60;
  border-color: #0e9a60;
  color: #fff !important;
  box-shadow: 0 5px 12px rgba(14, 154, 96, .24);
}
#tableFilters .area-btn.active .area-count { background: rgba(255, 255, 255, .22); color: #fff; }
#tableFilters .area-btn._open { order: -2; margin-left: 0; border-color: transparent !important; background: #e8f7ef !important; color: #0b7a4b !important; }
#tableFilters .area-btn._open.active { border-color: #0e9a60 !important; background: #0e9a60 !important; color: #fff !important; }
#tableFilters .area-btn[data-area="all"] { order: -1; }
#tableFilters .area-btn[data-area="__package__"] { order: 9; margin-left: auto; background: #fff4e0; color: #9a5b00 !important; }
#tableFilters .area-btn[data-area="__package__"]::before {
  content: "";
  width: 15px;
  height: 15px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 8 12 3 3 8v8l9 5 9-5z'/%3E%3Cpath d='m3 8 9 5 9-5M12 13v8'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 8 12 3 3 8v8l9 5 9-5z'/%3E%3Cpath d='m3 8 9 5 9-5M12 13v8'/%3E%3C/svg%3E") center / contain no-repeat;
}
#tableFilters .area-btn[data-area="__package__"].active { background: #e08600; border-color: #e08600; color: #fff !important; }

/* --- Masa kartlari: cizim ayni, durum daha net --- */
#tablesGrid.modern-grid-layout .table-card {
  position: relative;
  overflow: hidden;
  border: 1.5px solid #e3ebe6;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 3px 10px rgba(16, 60, 38, .05);
}
#tablesGrid.modern-grid-layout .table-card:hover { box-shadow: 0 10px 22px rgba(16, 60, 38, .11); transform: translateY(-2px); }
#tablesGrid.modern-grid-layout .table-card .m-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 0;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 800;
}
#tablesGrid.modern-grid-layout .table-card .m-status-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
#tablesGrid.modern-grid-layout .table-card .m-status-badge.available { background: #e7f7ee; color: #0b8a55; }
#tablesGrid.modern-grid-layout .table-card .m-status-badge.occupied { animation: none !important; background: #0e9a60 !important; color: #fff !important; }
#tablesGrid.modern-grid-layout .table-card .m-status-badge.reserved { background: #ede9fe; color: #6d28d9; }

/* Dolu */
#tablesGrid.modern-grid-layout .table-card.occupied { border-color: #0e9a60 !important; box-shadow: 0 6px 18px rgba(14, 154, 96, .16); }
#tablesGrid.modern-grid-layout .table-card.occupied .table-graphic-container { background-color: #e3f5ec; }
#tablesGrid.modern-grid-layout .table-card.occupied .m-chair { background: #0e9a60; border-color: #0b7f4f; }

/* Hesap istendi */
#tablesGrid.modern-grid-layout .table-card.warning { border-color: #eb9b0c !important; box-shadow: 0 6px 18px rgba(235, 155, 12, .2); }
#tablesGrid.modern-grid-layout .table-card.warning .table-graphic-container { background-color: #fff3da; }
#tablesGrid.modern-grid-layout .table-card.warning .m-chair { background: #eb9b0c; border-color: #c97f00; }
#tablesGrid.modern-grid-layout .table-card.warning .m-status-badge.occupied { background: #eb9b0c !important; color: #fff !important; }
#tablesGrid.modern-grid-layout .table-card.warning .m-total > div:first-child { color: #a56500; }
#tablesGrid.modern-grid-layout .table-card.warning .m-btn.primary { background: #eb9b0c; }

/* Rezerve */
#tablesGrid.modern-grid-layout .table-card.reserved { border-color: #a78bfa !important; }
#tablesGrid.modern-grid-layout .table-card.reserved .table-graphic-container { background-color: #f3efff; }
#tablesGrid.modern-grid-layout .table-card.reserved .m-chair { background: #a78bfa; border-color: #8b6ce8; }

/* Kart alti */
#tablesGrid.modern-grid-layout .table-card .m-table-details { gap: 8px; padding: 12px; }
#tablesGrid.modern-grid-layout .table-card .m-total > div:first-child { color: #0b7a4b; font-size: 1.35rem; font-weight: 800; }
#tablesGrid.modern-grid-layout .table-card .session-timer { padding: 2px 8px; border-radius: 7px; background: #eef4f0; color: #4c6155 !important; font-size: .74rem !important; font-variant-numeric: tabular-nums; }
#tablesGrid.modern-grid-layout .table-card .m-btn { min-height: 42px; border-radius: 10px; font-size: .84rem; font-weight: 700; }
#tablesGrid.modern-grid-layout .table-card .m-receipt-badge { border-radius: 8px; font-size: .68rem; font-weight: 700; }

/* --- Siparis ekrani: fotografli urun kutulari. Fotografsiz urunler mevcut gorunumde kalir. --- */
#orderModal #productList { gap: 12px; }
#orderModal #productList .product-item:not(.rs-no-photo) {
  position: relative;
  overflow: hidden;
  height: 150px !important;
  min-height: 150px !important;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 13px;
  background: #1c2c24;
  box-shadow: 0 4px 12px rgba(16, 40, 28, .13);
  transition: box-shadow .15s ease, border-color .15s ease, transform .12s ease;
}
#orderModal #productList .product-item:not(.rs-no-photo):hover { border-color: #16b774; box-shadow: 0 9px 20px rgba(16, 40, 28, .2); }
#orderModal #productList .product-item:not(.rs-no-photo):active { transform: scale(.98); }
#orderModal #productList .product-item:not(.rs-no-photo) .product-item-img {
  position: absolute !important;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  border-radius: 0 !important;
  background-position: center !important;
  background-size: cover !important;
}
#orderModal #productList .product-item:not(.rs-no-photo)::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 20, 15, .06) 30%, rgba(10, 20, 15, .82) 100%);
  pointer-events: none;
}
#orderModal #productList .product-item:not(.rs-no-photo) strong,
#orderModal #productList .product-item:not(.rs-no-photo) .product-item-price {
  position: absolute;
  z-index: 1;
  left: 10px;
  right: 10px;
  margin: 0;
  padding: 0;
  background: none;
  color: #fff !important;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .6);
}
#orderModal #productList .product-item:not(.rs-no-photo) strong { bottom: 31px; font-size: 13.5px !important; font-weight: 700; line-height: 1.2; text-align: left; }
#orderModal #productList .product-item:not(.rs-no-photo) .product-item-price { bottom: 9px; font-size: 14.5px; font-weight: 800; text-align: right; }

@media (max-width: 768px) {
  #tableFilters { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #tableFilters .area-btn { flex: none; }
  /* Fis etiketi ust solda kalir; eski mobil kuralla birlesip karti kaplamasin */
  #tablesGrid.modern-grid-layout .table-card .m-receipt-badge { bottom: auto !important; right: auto !important; width: auto !important; height: auto !important; max-width: calc(100% - 96px); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; line-height: 1.2; }
  #tableFilters .area-btn[data-area="__package__"] { margin-left: 0; }
  #orderModal #productList .product-item:not(.rs-no-photo) { height: 128px !important; min-height: 128px !important; }
}
@media (prefers-reduced-motion: reduce) {
  #tablesGrid.modern-grid-layout .table-card:hover { transform: none; }
}

/* Koyu tema */
.dark-mode #tableFilters { background: #17211c; border-color: #2a3a32; }
.dark-mode #tableFilters .area-btn { background: #223029; color: #c8d8cf !important; }
.dark-mode #tableFilters .area-btn .area-count { background: #2d3f35; color: #c8d8cf; }
.dark-mode #tableFilters .area-btn.active { background: #0e9a60; color: #fff !important; }
.dark-mode #tablesGrid.modern-grid-layout .table-card { background: #17211c; border-color: #2a3a32; }
.dark-mode #tablesGrid.modern-grid-layout .table-card.occupied { border-color: #0e9a60; }
.dark-mode #tablesGrid.modern-grid-layout .table-card.warning { border-color: #eb9b0c; }
.dark-mode #tablesGrid.modern-grid-layout .table-card.reserved { border-color: #a78bfa; }
.dark-mode #tablesGrid.modern-grid-layout .table-card.occupied .table-graphic-container { background-color: #123227; }
.dark-mode #tablesGrid.modern-grid-layout .table-card.warning .table-graphic-container { background-color: #3a2c12; }
.dark-mode #tablesGrid.modern-grid-layout .table-card.reserved .table-graphic-container { background-color: #2a2342; }
.dark-mode #tablesGrid.modern-grid-layout .table-card .session-timer { background: #223029; color: #c8d8cf !important; }
/* Uzun "Hesap Istendi" etiketi olan kartta fis etiketi ikinci satira iner */
#tablesGrid.modern-grid-layout .table-card.warning .m-receipt-badge { top: 42px !important; }
/* Dar telefonlar: fis etiketi durum etiketinin altina iner, ikisi ust uste binmez */
@media (max-width: 400px) {
  #tablesGrid.modern-grid-layout .table-card .m-receipt-badge { top: 34px !important; max-width: calc(100% - 14px); }
}

/* RESTOM_POS_V4_KART_DUZEN: kart alti duzeni. Tutar ustte, tum dugmeler birlikte altta. */
#tablesGrid.modern-grid-layout .table-card .m-table-details { display: flex; flex-direction: column; }
#tablesGrid.modern-grid-layout .table-card .rs-card-actions { margin-top: auto; }
#tablesGrid.modern-grid-layout .table-card .rs-card-actions + .m-btn-group { margin-top: 0 !important; padding-top: 0 !important; }
/* Bos masa: yazi dugmelerin hemen ustunde, ortada yuzmez */
#tablesGrid.modern-grid-layout .table-card .m-table-details > .m-info-row:first-child:nth-last-child(2) { flex: 1 1 auto !important; justify-content: flex-end !important; padding-bottom: 4px; color: #7c8e83; font-style: normal !important; }

/* RESTOM_POS_V4_BEKLEME: "yeni siparis yok" uyarisi tek satir, cizimin alt kenarinda; kart boyu degismez. */
#tablesGrid.modern-grid-layout .table-card .m-table-details { position: relative; }
#tablesGrid.modern-grid-layout .table-card .restom-order-idle-note {
  position: absolute;
  z-index: 5;
  bottom: calc(100% + 6px);
  left: 8px;
  right: 8px;
  margin: 0 !important;
  padding: 5px 9px !important;
  overflow: hidden;
  border: 1px solid #f2c15c;
  border-radius: 999px !important;
  background: #fff4da !important;
  color: #8a5100 !important;
  font-size: .72rem !important;
  line-height: 1.2 !important;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 3px 8px rgba(138, 81, 0, .15);
}
/* Uyarili kartta durum etiketi de turuncu */
#tablesGrid.modern-grid-layout .table-card.restom-order-idle .m-status-badge.occupied { background: #eb9b0c !important; color: #fff !important; }
#tablesGrid.modern-grid-layout .table-card.restom-order-idle { border-color: #eb9b0c !important; }
@media (max-width: 600px) {
  #tablesGrid.modern-grid-layout .table-card .restom-order-idle-note { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; white-space: normal; border-radius: 10px !important; }
}
