/* ==============================================================================
   Sifat Enterprise — Multi-Shop Management System
   Production Stylesheet
   Target Domain: sifatenterprise.shop
   Powered By: HST IT
   ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --font-primary: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  
  /* Color Palette */
  --bg-body: #0b1120;
  --bg-sidebar: #0f172a;
  --bg-card: #1e293b;
  --bg-card-subtle: #172033;
  --bg-input: #0f172a;
  
  --border-color: #334155;
  --border-focus: #6366f1;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: rgba(79, 70, 229, 0.15);
  
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.15);
  
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.15);
  
  --danger: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.15);
  
  --info: #0ea5e9;
  --info-light: rgba(14, 165, 233, 0.15);
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --sidebar-width: 260px;
  --topbar-height: 64px;
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-body: #f1f5f9;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-subtle: #f8fafc;
  --bg-input: #ffffff;
  --border-color: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  --primary-light: rgba(79, 70, 229, 0.1);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
}

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

body {
  font-family: var(--font-primary);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 14px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Base Layout Structure */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Styling */
.app-sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  transition: transform 0.3s ease;
}

.sidebar-header {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  color: #ffffff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.4);
}

.brand-text h1 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.2px;
}

.brand-text p {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
}

.nav-heading {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0.75rem 0.75rem 0.35rem;
  letter-spacing: 0.5px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 0.2rem;
  transition: all 0.2s ease;
}

.nav-link:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.nav-link.active {
  background-color: var(--primary);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.nav-link .icon {
  font-size: 1.1rem;
  line-height: 1;
}

.sidebar-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card-subtle);
}

.user-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: #6366f1;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role-badge {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Main Content Area */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

/* Topbar Header */
.topbar {
  height: var(--topbar-height);
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-mobile-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1.1rem;
}

.shop-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(79, 70, 229, 0.12);
  border: 1px solid rgba(79, 70, 229, 0.3);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
}

.shop-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.shop-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #c7d2fe;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Admin Shop Switcher Form */
.shop-switcher-form {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.shop-switcher-select {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.82rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  outline: none;
}

.shop-switcher-select:focus {
  border-color: var(--primary);
}

/* Page Body */
.page-content {
  flex: 1;
  padding: 1.5rem;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
}

.page-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Alert Boxes / Flash */
.alert {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}

.alert-success { background: var(--success-light); border: 1px solid var(--success); color: #6ee7b7; }
.alert-danger { background: var(--danger-light); border: 1px solid var(--danger); color: #fca5a5; }
.alert-warning { background: var(--warning-light); border: 1px solid var(--warning); color: #fde047; }
.alert-info { background: var(--info-light); border: 1px solid var(--info); color: #7dd3fc; }

.alert-icon { font-weight: bold; font-size: 1.1rem; }

/* KPI Grid & Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.4);
}

.kpi-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.kpi-sub {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 0.35rem;
}

/* Card Container */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-body {
  padding: 1.25rem;
}

/* Modern Clean Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  text-align: left;
}

.table th {
  background: var(--bg-card-subtle);
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.table tfoot td {
  background: var(--bg-card-subtle);
  font-weight: 700;
  padding: 0.85rem 1rem;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success { background: var(--success-light); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-warning { background: var(--warning-light); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-danger  { background: var(--danger-light); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-primary { background: var(--primary-light); color: #a5b4fc; border: 1px solid rgba(99, 102, 241, 0.3); }
.badge-neutral { background: rgba(255, 255, 255, 0.1); color: var(--text-muted); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  line-height: 1;
}

.btn-primary { background-color: var(--primary); color: #ffffff; }
.btn-primary:hover { background-color: var(--primary-hover); }

.btn-success { background-color: var(--success); color: #ffffff; }
.btn-success:hover { background-color: #059669; }

.btn-danger { background-color: var(--danger); color: #ffffff; }
.btn-danger:hover { background-color: #dc2626; }

.btn-secondary { background-color: var(--bg-card-subtle); border-color: var(--border-color); color: var(--text-main); }
.btn-secondary:hover { background-color: rgba(255, 255, 255, 0.08); }

.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.78rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }

/* Forms */
.form-group {
  margin-bottom: 1.1rem;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  transform: translateY(-20px);
  transition: transform 0.2s ease;
}

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

.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
}

.modal-body {
  padding: 1.25rem;
}

.modal-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* POS Specific Layout */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1.25rem;
  align-items: start;
}

.pos-cart-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  position: sticky;
  top: calc(var(--topbar-height) + 1.5rem);
}

.cart-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-bottom: 1rem;
}

.cart-items-table th {
  border-bottom: 1px solid var(--border-color);
  padding: 0.4rem 0.2rem;
  color: var(--text-muted);
}

.cart-items-table td {
  padding: 0.5rem 0.2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.cart-summary-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0;
  font-size: 0.9rem;
}

.cart-total-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0;
  font-size: 1.2rem;
  font-weight: 800;
  color: #38bdf8;
  border-top: 1px dashed var(--border-color);
  margin-top: 0.5rem;
}

/* Login Page Styling */
.login-body {
  background: radial-gradient(circle at 50% 20%, #1e1b4b 0%, #0b1120 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  color: #ffffff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.5rem;
  margin: 0 auto 1rem;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
}

.login-title {
  text-align: center;
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
  color: var(--text-main);
}

.login-subtitle {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

/* Responsive Behavior */
@media (max-width: 992px) {
  .pos-layout {
    grid-template-columns: 1fr;
  }
  .pos-cart-panel {
    position: static;
  }
}

@media (max-width: 768px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-sidebar.show {
    transform: translateX(0);
  }
  .app-main {
    margin-left: 0;
  }
  .btn-mobile-toggle {
    display: inline-block;
  }
}
