:root {
  --primary: #0056B3;
  --primary-hover: #004494;
  --secondary: #28A745;
  --secondary-hover: #218838;
  --warning: #DC3545;
  --bg-color: #F8F9FA;
  --text-dark: #212529;
  --text-light: #6C757D;
  --border-color: #DEE2E6;
  --white: #FFFFFF;
  --font-family: 'Inter', sans-serif;
  --sidebar-width: 250px;
  --topbar-height: 60px;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-dark);
  font-size: 14px;
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 { font-weight: 600; }
.h1 { font-size: 24px; }
.h2 { font-size: 20px; }
.h3 { font-size: 18px; }
.text-muted { color: var(--text-light); }
.text-primary { color: var(--primary); }
.text-success { color: var(--secondary); }
.text-danger { color: var(--warning); }
.font-bold { font-weight: bold; }

/* Layout SPA */
#app {
  display: flex;
  height: 100vh;
  width: 100vw;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--white);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-header {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-color);
  font-size: 18px;
  font-weight: bold;
  color: var(--primary);
}

.sidebar-menu {
  flex: 1;
  overflow-y: auto;
  padding: 15px 0;
  list-style: none;
}

.sidebar-menu li {
  padding: 0 15px;
  margin-bottom: 5px;
}

.sidebar-menu a {
  display: flex;
  align-items: center;
  padding: 10px 15px;
  color: var(--text-dark);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s;
  font-weight: 500;
}

.sidebar-menu a:hover, .sidebar-menu a.active {
  background: #EAF2FB;
  color: var(--primary);
}

.sidebar-menu a i {
  margin-right: 10px;
  font-size: 18px;
}

.sidebar-footer {
  padding: 15px;
  border-top: 1px solid var(--border-color);
}

.sidebar-footer a {
  display: flex;
  align-items: center;
  padding: 10px;
  color: var(--text-light);
  text-decoration: none;
  transition: color 0.2s;
}

.sidebar-footer a:hover {
  color: var(--warning);
}

.sidebar-footer a i {
  margin-right: 10px;
}

.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: var(--topbar-height);
  background: var(--white);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.topbar-search input {
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 8px 15px 8px 35px;
  width: 300px;
  background: var(--bg-color) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%236C757D" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>') no-repeat 10px center;
}

.topbar-search input:focus {
  outline: none;
  border-color: var(--primary);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.topbar-icon {
  color: var(--text-light);
  font-size: 20px;
  cursor: pointer;
}

.topbar-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.topbar-profile img {
  width: 35px;
  height: 35px;
  border-radius: 50%;
}

.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* Views */
.view {
  display: none;
  height: 100%;
}

.view.active {
  display: block;
}

/* POS Specific Layout */
.pos-layout {
  display: flex;
  height: 100%;
  gap: 20px;
}

.pos-items-section {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.pos-categories {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.btn-category {
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  background: var(--white);
  border-radius: 20px;
  cursor: pointer;
  font-weight: 500;
}

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

.pos-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 15px;
  overflow-y: auto;
}

.pos-item-card {
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 15px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.pos-item-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

.pos-item-icon {
  font-size: 24px;
  margin-bottom: 10px;
  color: var(--primary);
}

.pos-item-title {
  font-weight: 500;
  margin-bottom: 5px;
}

.pos-item-price {
  color: var(--text-light);
  font-size: 12px;
}

.pos-cart-section {
  width: 350px;
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
}

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

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px dashed var(--border-color);
}

.cart-item-info {
  flex: 1;
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.qty-btn {
  background: #EAF2FB;
  border: none;
  width: 25px;
  height: 25px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--primary);
  font-weight: bold;
}

.cart-summary {
  padding: 15px;
  background: var(--bg-color);
  border-top: 1px solid var(--border-color);
}

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

.summary-total {
  font-size: 24px;
  font-weight: bold;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

.cart-actions {
  display: flex;
  gap: 10px;
  padding: 15px;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

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

.btn-success { background: var(--secondary); color: var(--white); flex: 1; font-size: 16px;}
.btn-success:hover { background: var(--secondary-hover); }

.btn-outline { border: 1px solid var(--border-color); background: var(--white); color: var(--text-dark); }
.btn-outline:hover { background: var(--bg-color); }

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

/* Dashboard Cards */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
}

.col-4 { grid-column: span 4; }
.col-8 { grid-column: span 8; }
.col-6 { grid-column: span 6; }
.col-12 { grid-column: span 12; }

.card {
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
}

.card-title {
  color: var(--text-light);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
}

.card-value {
  font-size: 28px;
  font-weight: bold;
  margin-bottom: 5px;
}

.trend-up { color: var(--secondary); font-size: 12px; }
.trend-down { color: var(--warning); font-size: 12px; }

/* Table Styles */
.table-responsive {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  background: var(--bg-color);
  color: var(--text-light);
  font-weight: 600;
  font-size: 12px;
}

.badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.badge-success { background: #D4EDDA; color: #155724; }
.badge-warning { background: #FFF3CD; color: #856404; }
.badge-danger { background: #F8D7DA; color: #721C24; }

/* Login Page */
#login-view {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-color);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.login-card {
  background: var(--white);
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.05);
  width: 400px;
  max-width: 90%;
}

.login-logo {
  text-align: center;
  margin-bottom: 30px;
}

.login-logo i {
  font-size: 40px;
  color: var(--primary);
  margin-bottom: 10px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 10px 15px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 14px;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
}

.btn-google {
  background: var(--white);
  color: var(--text-dark);
  border: 1px solid var(--border-color);
  width: 100%;
  margin-top: 15px;
}

.btn-google img {
  width: 20px;
  margin-right: 10px;
}

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

.page-header {
  margin-bottom: 20px;
}

.page-title {
  font-size: 24px;
  font-weight: bold;
}

.page-subtitle {
  color: var(--text-light);
  font-size: 14px;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal-content {
  background: var(--white);
  padding: 30px;
  border-radius: 12px;
  width: 600px;
  max-width: 95%;
  box-shadow: 0 15px 50px rgba(0,0,0,0.2);
}

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

.close-modal {
  font-size: 24px;
  cursor: pointer;
  color: var(--text-light);
}

.close-modal:hover {
  color: var(--warning);
}

/* Animations */
@keyframes shake {
  0% { transform: rotate(0deg); }
  25% { transform: rotate(-15deg); }
  50% { transform: rotate(0deg); }
  75% { transform: rotate(15deg); }
  100% { transform: rotate(0deg); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.anim-shake-hover:hover {
  animation: shake 0.5s;
}

.anim-spin-hover:hover {
  animation: spin 2s linear infinite;
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
}

.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.slider.round {
  border-radius: 20px;
}

.slider.round:before {
  border-radius: 50%;
}

/* Dropdown menu items */
.dropdown-menu a, .dropdown-menu .notif-item, .dropdown-menu .search-item {
  display: block;
  padding: 10px;
  color: var(--text-dark);
  text-decoration: none;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
}

.dropdown-menu a:hover, .dropdown-menu .notif-item:hover, .dropdown-menu .search-item:hover {
  background-color: var(--bg-color);
}

.dropdown-menu .search-item {
  display: flex;
  justify-content: space-between;
}

/* Dark Mode Theme */
[data-theme="dark"] {
  --bg-color: #121212;
  --white: #1E1E1E;
  --text-dark: #E0E0E0;
  --text-light: #A0A0A0;
  --border-color: #333333;
}

/* Specific Dark Mode Adjustments */
[data-theme="dark"] input, [data-theme="dark"] select {
  background-color: #2D2D2D;
  color: #E0E0E0;
  border-color: #444;
}

[data-theme="dark"] .sidebar-menu a:hover, [data-theme="dark"] .sidebar-menu a.active {
  background: #2D2D2D;
}
