/* style.css */

/* --- RESET DASAR & BOX SIZING --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  background-color: #cff1f5;
  color: #333;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  position: relative; /* Penting untuk notifikasi dan modal */
}

/* --- OVERLAY LOADING --- */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.loading-spinner {
  border: 8px solid #f3f3f3;
  border-top: 8px solid #007bff;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* --- NOTIFIKASI --- */
#notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1050; /* Di atas modal */
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notification {
  background-color: #f0f0f0;
  color: #333;
  padding: 15px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  opacity: 0; /* Mulai tersembunyi */
  transform: translateY(-20px); /* Geser ke atas */
  animation: fadeInSlideDown 0.5s forwards, fadeOut 0.5s forwards 4.5s; /* Animasi masuk dan keluar */
  min-width: 250px;
  max-width: 350px;
  word-wrap: break-word; /* Memastikan teks tidak overflow */
}

.notification.info { background-color: #e0f7fa; color: #007bff; border-left: 5px solid #007bff; }
.notification.success { background-color: #e6ffed; color: #28a745; border-left: 5px solid #28a745; }
.notification.warning { background-color: #fffde7; color: #ffc107; border-left: 5px solid #ffc107; }
.notification.error { background-color: #ffebee; color: #dc3545; border-left: 5px solid #dc3545; }

/* Animasi untuk notifikasi */
@keyframes fadeInSlideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-20px); }
}

/* --- MODAL POP-UP LOGIN --- */
.modal {
  display: none; /* Hidden by default, JS will show/hide */
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.7); /* Lebih gelap untuk fokus */
  display: flex; /* Menggunakan flexbox untuk penengahan */
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(5px); /* Efek blur pada background di belakang modal */
  animation: fadeInBackground 0.3s ease-out forwards; /* Animasi fade in background */
}

.modal-content {
  background-color: #ffffff; /* Latar putih bersih */
  padding: 30px 40px; /* Padding lebih proporsional */
  border-radius: 15px; /* Sudut lebih membulat */
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); /* Shadow lebih dalam dan modern */
  position: relative;
  max-width: 480px; /* Lebar maksimal sedikit lebih besar */
  width: 90%;
  text-align: center;
  animation: slideInTop 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; /* Animasi slide in yang lebih smooth */
  display: flex; /* Mengatur konten di dalam modal sebagai flex */
  flex-direction: column; /* Konten tersusun vertikal */
  gap: 25px; /* Jarak antar bagian dalam modal */
}

.close-button {
  color: #888; /* Warna abu-abu yang lebih lembut */
  position: absolute;
  top: 15px;
  right: 25px;
  font-size: 32px; /* Ukuran sedikit lebih besar */
  font-weight: normal; /* Tidak terlalu tebal */
  cursor: pointer;
  transition: color 0.3s ease, transform 0.2s ease;
}

.close-button:hover,
.close-button:focus {
  color: #333;
  transform: rotate(90deg); /* Interaktif: berputar saat hover */
}

/* Modal Header */
.modal-header {
  margin-bottom: 15px;
}

.modal-header h2 {
  color: #2c3e50;
  margin-bottom: 8px; /* Jarak lebih dekat ke sub-text */
  font-size: 2.2em; /* Ukuran font lebih besar */
  font-weight: 700; /* Lebih tebal */
}

.modal-header p {
  font-size: 1.1em;
  color: #666;
  margin-bottom: 0;
}

/* Modal Body */
.modal-body {
  display: flex;
  flex-direction: column;
  gap: 15px; /* Jarak antar tombol */
}

.login-option {
  width: 100%;
  padding: 15px 25px;
  border: none;
  border-radius: 10px; /* Sudut tombol lebih membulat */
  cursor: pointer;
  font-size: 1.15em; /* Ukuran font lebih besar */
  font-weight: 600; /* Sedikit lebih tebal */
  color: rgb(231, 237, 234);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px; /* Jarak antara ikon dan teks */
  transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
}

.login-option i {
  font-size: 1.3em;
}

.google-login-button {
  background-color: #4285F4; /* Warna Google Blue */
  box-shadow: 0 4px 10px rgba(66, 133, 244, 0.2);
}

.google-login-button:hover {
  background-color: #357ae8;
  transform: translateY(-3px); /* Interaktif: sedikit terangkat */
  box-shadow: 0 6px 15px rgba(66, 133, 244, 0.3);
}

.anonymous-button {
  background-color: #6c757d; /* Warna abu-abu netral */
  box-shadow: 0 4px 10px rgba(108, 117, 125, 0.2);
}

.anonymous-button:hover {
  background-color: #5a6268;
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(108, 117, 125, 0.3);
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 20px 0; /* Jarak lebih besar */
  color: #aaa;
  font-size: 0.9em;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #ddd;
}

.divider:not(:empty)::before {
  margin-right: .25em;
}

.divider:not(:empty)::after {
  margin-left: .25em;
}

.modal-info-text {
  font-size: 0.9em;
  color: #888; /* Lebih lembut */
  margin-top: 15px; /* Jarak dari tombol */
  line-height: 1.4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.modal-info-text i {
  color: #f0ad4e; /* Warna ikon peringatan */
  font-size: 1.1em;
}

.error-message {
  color: #e74c3c;
  margin-top: 15px;
  font-size: 0.95em;
  font-weight: bold;
}

/* --- GAYA TAB POS --- */
#pos-tab.active {
  flex-direction: row;
}

.product-selection,
.cart-summary {
  background-color: #f8f9fa;
  border-radius: 8px;
  padding: 20px;
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05);
  flex: 1;
  min-width: 300px;
  max-width: 600px; /* Pertahankan ini agar tidak terlalu lebar */
}

.product-selection {
  margin-right: 20px;
}

.product-grid {
  display: grid;
  /* Ubah ini untuk 3 kolom */
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); /* Min 180px, auto-fill for 3 columns on larger screens */
  gap: 15px;
  margin-top: 15px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 10px;
}

.product-card {
  background-color: #fff;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 15px;
  text-align: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 120px; /* Beri tinggi minimum agar tidak terlalu pendek */
}

/* --- Animasi untuk Modal --- */
@keyframes fadeInBackground {
  from { background-color: rgba(0,0,0,0); }
  to { background-color: rgba(0,0,0,0.7); }
}

@keyframes slideInTop {
  from { opacity: 0; transform: translateY(-50px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- KONTROL TAMPILAN SECTION UTAMA --- */
#main-app-content {
  display: none; /* Default disembunyikan */
  width: 100%;
  max-width: 1200px;
}

/* --- GAYA APLIKASI UTAMA (MAIN APP) - TETAP SAMA DARI SEBELUMNYA --- */
.main-app-container {
  display: flex;
  flex-direction: column;
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  min-height: 80vh;
}

.app-header {
  background-color: #007bff;
  color: white;
  padding: 20px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #0056b3;
}

.app-header h1 {
  font-size: 1.8em;
  margin: 0;
  display: flex;
  align-items: center;
}

.app-header h1 i {
  margin-right: 10px;
}

.main-nav button {
  background: none;
  border: none;
  color: white;
  padding: 10px 15px;
  margin-left: 10px;
  cursor: pointer;
  font-size: 1em;
  border-radius: 5px;
  transition: background-color 0.3s ease;
}

.main-nav button:hover,
.main-nav button.active {
  background-color: rgba(255, 255, 255, 0.2);
}

.main-nav button i {
  margin-right: 5px;
}

.logout-button {
  background-color: #dc3545;
}

.logout-button:hover {
  background-color: #c82333;
}

.app-main {
  display: flex;
  flex-grow: 1;
}

.tab-content {
  display: none;
  padding: 20px;
  flex-grow: 1;
}

.tab-content.active {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

#pos-tab.active {
  flex-direction: row;
}

.product-selection,
.cart-summary {
  background-color: #f8f9fa;
  border-radius: 8px;
  padding: 20px;
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05);
  flex: 1;
  min-width: 300px;
  max-width: 600px;
}

.product-selection {
  margin-right: 20px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 15px;
  margin-top: 15px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 10px;
}

.product-card {
  background-color: #fff;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 15px;
  text-align: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.product-card h3 {
  font-size: 1.1em;
  margin-bottom: 5px;
  color: #2c3e50;
}

.product-card p {
  font-size: 0.9em;
  color: #7f8c8d;
  margin-bottom: 10px;
}

.add-to-cart-button {
  background-color: #28a745;
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.2em;
  cursor: pointer;
  position: absolute;
  bottom: 10px;
  right: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: background-color 0.3s ease, transform 0.2s ease;
}

.add-to-cart-button:hover {
  background-color: #218838;
  transform: scale(1.05);
}

.pagination-controls {
  display: flex;
  justify-content: center;
  margin-top: 20px;
  gap: 10px;
}

.pagination-controls button {
  background-color: #007bff;
  color: white;
  border: none;
  padding: 8px 15px;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.pagination-controls button:hover:not(:disabled) {
  background-color: #0056b3;
}

.pagination-controls button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

.pagination-controls button.active {
  background-color: #0056b3;
  font-weight: bold;
}

.cart-list {
  list-style: none;
  padding: 0;
  margin-top: 15px;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 10px;
}

.cart-list li {
  background-color: #fff;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 10px 15px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.cart-list li > div:first-child {
  flex-grow: 1;
  font-weight: 500;
}

.item-controls button {
  background: none;
  border: 1px solid #ccc;
  color: #555;
  padding: 5px 8px;
  margin-left: 5px;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.item-controls button:hover {
  background-color: #eee;
}

.remove-from-cart-button {
  color: #dc3545;
  border-color: #dc3545;
}

.remove-from-cart-button:hover {
  background-color: #dc3545;
  color: white;
}

.cart-total {
  font-size: 1.5em;
  font-weight: bold;
  text-align: right;
  margin-top: 20px;
  padding-top: 10px;
  border-top: 1px dashed #ccc;
}

.payment-section {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid #eee;
}

.payment-section label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.payment-section input[type="number"],
.payment-section select {
  width: 100%;
  padding: 10px;
  margin-bottom: 15px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 1em;
}

.checkout-buttons {
  display: flex;
  gap: 10px;
}

.checkout-button, .print-button {
  flex: 1;
  padding: 12px 15px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1em;
  font-weight: 600;
  color: white;
  transition: background-color 0.3s ease;
}

.checkout-button {
  background-color: #007bff;
}

.checkout-button:hover {
  background-color: #0056b3;
}

.print-button {
  background-color: #17a2b8;
}

.print-button:hover {
  background-color: #138496;
}

#history-tab.active,
#settings-tab.active {
  flex-direction: column;
}

.history-controls,
.settings-section {
  background-color: #f8f9fa;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05);
}

.history-controls {
  display: flex;
  gap: 15px;
}

.history-list {
  list-style: none;
  padding: 0;
  max-height: 500px;
  overflow-y: auto;
  padding-right: 10px;
}

.history-list li {
  background-color: #fff;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 12px 18px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.history-list li p {
  margin-bottom: 5px;
}

.history-list li p:last-child {
  font-weight: 600;
  color: #007bff;
}

.settings-section h3 {
  color: #2c3e50;
  margin-bottom: 15px;
  font-size: 1.3em;
}

.settings-section input[type="text"],
.settings-section input[type="number"],
.settings-section select {
  width: calc(100% - 20px);
  padding: 10px;
  margin-bottom: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 1em;
}

.action-button {
  padding: 10px 15px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1em;
  font-weight: 600;
  color: white;
  transition: background-color 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.add-button { background-color: #28a745; }
.add-button:hover { background-color: #218838; }

.export-button { background-color: #17a2b8; }
.export-button:hover { background-color: #138496; }

.delete-button, .reset-button { background-color: #dc3545; }
.delete-button:hover, .reset-button:hover { background-color: #c82333; }

/* Gaya untuk elemen struk tersembunyi */
#hidden-receipt-content {
  /* Hapus atau komentari baris-baris ini jika ada */
  /* position: absolute; */
  /* left: -9999px; */
  /* top: -9999px; */
  /* visibility: hidden; */

  /* Tambahkan atau pastikan properti ini ada */
  display: none; /* Ini yang paling penting */
  
  /* Anda bisa tambahkan properti ini untuk memastikan tidak mengganggu layout utama */
  width: 60mm; /* Atau ukuran lebar struk yang Anda inginkan, misalnya 227px */
  overflow: hidden; /* Pastikan konten tidak meluber */
  /* Properti lain untuk print, jika ada */
}

/* --- MEDIA QUERIES --- */
@media (max-width: 768px) {
  body { padding: 10px; }
  .modal-content { padding: 30px; }
  .main-app-container { flex-direction: column; }
  .app-header { flex-direction: column; align-items: flex-start; padding: 15px; }
  .main-nav { margin-top: 15px; width: 100%; display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }
  .main-nav button { margin: 0 5px 5px 0; padding: 8px 12px; font-size: 0.9em; }
  .app-main { flex-direction: column; }
  #pos-tab.active { flex-direction: column; }
  .product-selection, .cart-summary { width: 100%; margin-right: 0; margin-bottom: 20px; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .checkout-buttons { flex-direction: column; }
  .checkout-button, .print-button { width: 100%; margin-bottom: 10px; }
}

@media (max-width: 480px) {
  .modal-content h2 { font-size: 1.5em; }
  .product-grid { grid-template-columns: 1fr; }
  .app-header h1 { font-size: 1.5em; }
}

.app-footer {
  padding: 10px;
  text-align: center;
  font-size: 0.8em; /* Ukuran font lebih kecil */
  color: #666; /* Warna abu-abu agar tidak terlalu mencolok */
  margin-top: 20px; /* Jarak dari konten di atasnya */
  border-top: 1px solid #eee; /* Garis pemisah opsional */
}

.copyright-text {
  margin: 0; /* Hapus margin default paragraf */
  line-height: 1.5;
}