@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #3B82F6;
  --primary-dark: #2563EB;
  --secondary: #DBEAFE;
  --bg-color: #F8FAFC;
  --card-bg: #ffffff;
  --text-dark: #1E293B;
  --text-light: #64748B;
  --border: #E2E8F0;
  --success: #10B981;
  --danger: #EF4444;
  --warning: #F59E0B;
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1.25rem;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1);
}

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

body {
  font-family: 'Poppins', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-dark);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  color: var(--text-dark);
}

a {
  text-decoration: none;
  color: var(--primary);
  transition: color 0.2s;
}

a:hover {
  color: var(--primary-dark);
}

/* Layout Utilities */
/* Animations */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes float {
  0% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-15px) rotate(5deg); }
  100% { transform: translateY(0px) rotate(0deg); }
}
@keyframes pulse-soft {
  0% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.05); opacity: 0.8; }
  100% { transform: scale(1); opacity: 0.5; }
}

.animate-fade-in { animation: fadeInUp 0.6s ease forwards; }

/* Decorative Elements */
.bg-decoration {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
  background-color: var(--bg-color);
}
.shape {
  position: absolute;
  background: var(--secondary);
  border-radius: 50%;
  opacity: 0.4;
  filter: blur(60px);
}
.shape-1 { width: 400px; height: 400px; top: -150px; right: -100px; animation: pulse-soft 8s infinite ease-in-out; }
.shape-2 { width: 300px; height: 300px; bottom: -50px; left: -100px; background: #BFDBFE; animation: pulse-soft 10s infinite ease-in-out; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.mobile-container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  background: var(--bg-color);
  min-height: 100vh;
  position: relative;
  box-shadow: none;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.p-4 { padding: 1rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.w-full { width: 100%; }
.text-center { text-align: center; }

/* Cards */
.card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-md);
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  gap: 0.4rem;
  font-family: inherit;
  font-size: 0.8rem; /* Perkecil ukuran default tombol */
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: white;
}

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

.btn-outline {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-block {
  width: 100%;
}

/* Inputs */
.form-group {
  margin-bottom: 1rem;
  text-align: left;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-dark);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #f9fafb;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 79, 162, 0.1);
  background: white;
}

/* Header/Navbar */
.header {
  background: white;
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

/* Floating Cart Bar - Premium Version */
.floating-cart {
  position: fixed !important;
  bottom: 30px !important; /* Jarak lebih pas dari bawah */
  top: auto !important;
  left: 50% !important;
  transform: translateX(-50%) translateY(20px) !important;
  width: 94% !important;
  max-width: 1200px !important; /* Panjang menyesuaikan list produk */
  background: rgba(255, 255, 255, 0.95) !important; /* Putih Premium */
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  color: var(--text-dark) !important;
  padding: 1rem 2rem !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  box-shadow: 0 -15px 35px rgba(0, 0, 0, 0.1) !important;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
  z-index: 9999 !important;
  border-radius: 1.5rem !important;
  border: 1px solid var(--border) !important;
  opacity: 0;
  pointer-events: none;
}

.floating-cart.visible {
  opacity: 1 !important;
  pointer-events: all !important;
  transform: translateX(-50%) translateY(0) !important;
}

.cart-icon-wrapper {
  position: relative;
  background: var(--secondary);
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 1.25rem;
}

.cart-badge-dot {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 800;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}

/* Badges */
.badge {
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-warning { background: #fef3c7; color: #d97706; }
.badge-success { background: #d1fae5; color: #059669; }
.badge-danger { background: #fee2e2; color: #dc2626; }
.badge-primary { background: #dbeafe; color: #2563eb; }

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: white;
  width: 90%;
  max-width: 500px;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transform: translateY(20px);
  transition: transform 0.3s ease;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

/* Utilities */
.text-primary { color: var(--primary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.font-bold { font-weight: 700; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-xl { font-size: 1.25rem; }

/* Layout Grid for Products */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.product-card {
  background: white;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  position: relative;
}
.product-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}
.product-img-container {
  width: 100%;
  height: 180px;
  overflow: hidden;
  background: #f8fafc;
  position: relative;
}
.product-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.product-card:hover .product-img {
  transform: scale(1.1);
}
.product-info {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.product-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-dark);
  line-height: 1.4;
  min-height: 2.8em;
}

.product-price {
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 1.1rem;
}

.product-discount {
  font-size: 0.75rem;
  color: #94A3B8;
  text-decoration: line-through;
  margin-left: 5px;
}

.btn-view {
  background: linear-gradient(to right, var(--primary), #60A5FA);
  color: white;
  padding: 0.5rem;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  margin-top: 0.5rem;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-view:hover { opacity: 0.9; }

.btn-plus {
  position: absolute;
  top: 130px; /* Melayang di batas gambar */
  right: 8px;
  background: #ee4d2d;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.btn-plus:hover { background: var(--primary-dark); transform: scale(1.1); }
.btn-plus:active { transform: scale(0.9); }
.btn-plus:disabled { background: #e5e7eb; color: #9ca3af; cursor: not-allowed; box-shadow: none; }

/* Admin Sidebar Layout */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: linear-gradient(180deg, #1E3A8A 0%, #1e40af 100%);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  box-shadow: 10px 0 30px rgba(0,0,0,0.05);
  z-index: 100;
}

.sidebar-header {
  padding: 2rem 1.5rem;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: rgba(255,255,255,0.05);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  padding: 1rem 1.5rem;
  color: rgba(255,255,255,0.7);
  transition: all 0.3s ease;
  gap: 1.25rem;
  font-weight: 500;
  border-left: 4px solid transparent;
}

.sidebar-link i {
  width: 20px;
  text-align: center;
}

.sidebar-link:hover, .sidebar-link.active {
  background: rgba(255,255,255,0.1);
  color: white;
  border-left-color: white;
}

.admin-main {
  flex: 1;
  margin-left: 260px;
  padding: 2.5rem;
  position: relative;
  z-index: 1;
}

.welcome-banner {
  background: linear-gradient(135deg, #1E40AF 0%, #3B82F6 100%);
  border-radius: var(--radius-lg);
  padding: 3rem 2.5rem;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  overflow: hidden;
  position: relative;
  box-shadow: 0 15px 35px rgba(30, 64, 175, 0.3);
  border: 1px solid rgba(255,255,255,0.1);
}

.banner-content {
  position: relative;
  z-index: 5;
  text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.banner-img-wrapper {
  width: 280px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* POS Layout */
.pos-layout {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}
.pos-main {
  flex: 1;
}
.pos-sidebar {
  width: 400px;
  position: sticky;
  top: 2rem;
}

@media (max-width: 1024px) {
  .pos-layout {
    flex-direction: column;
    gap: 1.5rem;
  }
  .pos-sidebar {
    width: 100%;
    position: static;
  }
}

.banner-img-wrapper img {
  max-width: 100%;
  height: auto;
  transform: scale(1.2) translateX(20px);
  filter: drop-shadow(0 15px 30px rgba(0,0,0,0.3));
}

/* Dashboard Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .admin-layout {
    flex-direction: column;
    overflow-x: hidden;
    width: 100%;
  }
  .sidebar {
    width: 100%;
    height: auto;
    position: sticky;
    top: 0;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.75rem;
    box-shadow: var(--shadow-sm);
  }
  .sidebar-header {
    padding: 0.75rem 0;
    font-size: 1rem;
    border-bottom: none;
    background: transparent;
  }
  .sidebar-nav {
    display: flex;
    padding: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .sidebar-nav::-webkit-scrollbar { display: none; }
  .sidebar-link {
    padding: 0.75rem 0.5rem;
    gap: 0.4rem;
    font-size: 0.75rem;
    border-left: none;
    border-bottom: 3px solid transparent;
    flex-shrink: 0;
  }
  .sidebar-link i { width: auto; font-size: 0.9rem; }
  .sidebar-link:hover, .sidebar-link.active {
    border-bottom-color: white;
  }
  .admin-main {
    margin-left: 0;
    padding: 1rem 0.75rem;
    width: 100%;
    overflow-x: hidden;
  }
  .welcome-banner {
    padding: 1.5rem 1rem;
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }
  .banner-content h1 { font-size: 1.25rem !important; }
  .banner-content p { font-size: 0.85rem !important; margin: 0 auto; }
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .card { padding: 1rem; }
}

@media (max-width: 480px) {
  .sidebar-header span { display: none; }
  .sidebar-link span { display: none; }
  .sidebar-link { padding: 0.75rem 1rem; }
  .sidebar-link i { font-size: 1.2rem; }
}

/* Modals & Forms Responsiveness */
@media (max-width: 600px) {
  .modal {
    width: 96%;
    padding: 1rem;
    margin: 5px auto;
  }
  .modal h3 { font-size: 1.1rem; }
  .modal .flex {
    flex-direction: column !important;
    gap: 0 !important;
  }
  .modal .flex-1 {
    width: 100% !important;
  }
  .modal .btn {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
  }
}

/* POS Specific Responsiveness */
.pos-item-name {
  word-break: break-word;
  font-size: 0.85rem;
  line-height: 1.2;
}

@media (max-width: 768px) {
  .pos-layout {
    flex-direction: column !important;
    gap: 1rem !important;
  }
  .pos-sidebar {
    width: 100% !important;
    position: static !important;
    margin-top: 0;
  }
  .pos-sidebar .card {
    min-height: auto !important;
    padding: 1rem;
  }
  .pos-summary {
    padding: 0.75rem;
    margin-bottom: 1rem;
  }
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  color: var(--text-light);
  background: #f9fafb;
}

tr:hover {
  background: #f9fafb;
}

/* Scanner */
#reader {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* Toast */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: white;
  color: var(--text-dark);
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.3s ease;
  border-left: 4px solid var(--primary);
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
