* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #aa538c;
  --primary-light: #c76da8;
  --secondary: #aed254;
  --secondary-light: #c4e47a;
  --success: #28A745;
  --warning: #FFC107;
  --danger: #DC3545;
  --bg: #F5F7FA;
  --card-bg: #FFFFFF;
  --text-primary: #020202;
  --text-secondary: #718096;
  --border: #E2E8F0;
}

/* Dark Mode */
[data-theme="dark"] {
  --bg: #1a1a2e;
  --card-bg: #16213e;
  --text-primary: #E8E8E8;
  --text-secondary: #A0A0A0;
  --border: #2D3748;
}

[data-theme="dark"] .sidebar {
  background: #0f0f23;
}

[data-theme="dark"] .card {
  background: var(--card-bg);
  color: var(--text-primary);
}

[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select,
[data-theme="dark"] .form-textarea {
  background: #1a1a2e;
  color: var(--text-primary);
  border-color: var(--border);
}

[data-theme="dark"] .stat-card,
[data-theme="dark"] .login-card {
  background: var(--card-bg);
}

[data-theme="dark"] .page-content {
  background: var(--bg);
}

[data-theme="dark"] tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] th {
  background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .modal {
  background: var(--card-bg);
}

[data-theme="dark"] .notification-dropdown {
  background: var(--card-bg);
  border-color: var(--border);
}

[data-theme="dark"] .search-box {
  background: var(--card-bg);
  border-color: var(--border);
}

[data-theme="dark"] .search-box input {
  color: var(--text-primary);
}

[data-theme="dark"] .user-profile {
  background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .header {
  background: var(--card-bg);
  border-color: var(--border);
}

/* Theme Toggle Button */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  color: var(--text-primary);
  transition: background 0.2s;
}

.theme-toggle:hover {
  background: var(--bg);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
}

.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: var(--primary);
  color: white;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
}

.sidebar {
    width:280px;
    background:var(--primary);
    color:#fff;
    display:flex;
    flex-direction:column;
    position:fixed;
    height:100vh;
    overflow-y:auto;
}

/* ---------- Logo ---------- */

aside.sidebar {
  color: white !important;
}

aside.sidebar .sidebar-logo-text h1 {
    color: #aed254 !important;
}

aside.sidebar .sidebar-logo-text span {
    color: white !important;
}

.sidebar-logo {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start;
    gap: 10px;
    padding: 16px 20px;
}

.logo-img {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    max-width: 40px;
    max-height: 40px;
    object-fit: contain;
    object-position: center left;
    flex-shrink: 0;
    filter: brightness(0) invert(1);
}

.sidebar-logo-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: white !important;
}

.sidebar-logo-text h1 {
    margin: 0;
    font-size: 18px;
    line-height: 1.2;
    font-weight: 600;
    color: #aed254 !important;
}

.sidebar-logo-text span {
    margin: 0;
    font-size: 11px;
    letter-spacing: 0.3px;
    color: white !important;
}

.logo-img {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    max-width: 40px;
    max-height: 40px;
    object-fit: contain;
    object-position: center left;
    flex-shrink: 0;
    filter: brightness(0) invert(1);
}

.sidebar-logo-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: white !important;
}

.sidebar-logo-text h1 {
    margin: 0;
    font-size: 18px;
    line-height: 1.2;
    font-weight: 600;
    color: #aed254 !important;
}

.sidebar-logo-text span {
    margin: 0;
    font-size: 11px;
    letter-spacing: 0.3px;
    color: white !important;
}

.sidebar-nav {
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: white;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
}

.nav-item:hover, .nav-item.active {
  background: rgba(255,255,255,0.1);
  color: white;
  border-left: 3px solid var(--secondary);
}

.nav-item svg {
  width: 20px;
  height: 20px;
}

/* Sidebar Icons */
.nav-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-icon svg {
    width: 20px;
    height: 20px;
    stroke: #ffffff;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 280px;
}

.header {
  background: var(--card-bg);
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left h2 {
  font-size: 24px;
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.notification-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: background 0.2s;
}

.notification-btn:hover {
  background: var(--bg);
}

.notification-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--bg);
  border-radius: 8px;
  cursor: pointer;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
}

.user-info span {
  display: block;
}

.user-info .name {
  font-weight: 600;
  font-size: 14px;
}

.user-info .role {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Page Content */
.page-content {
  padding: 32px;
  background: #F5F7FA;
  min-height: calc(100vh - 70px);
}

/* Cards */
.card {
  background: #FFFFFF;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  padding: 24px;
  color: #2D3748;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon i {
    font-size: 24px;
    color: inherit;
}

.stat-icon.blue { background: #EBF5FF; color: var(--primary); }
.stat-icon.green { background: #E6F4EA; color: var(--success); }
.stat-icon.orange { background: #EEF6E3; color: var(--secondary); }
.stat-icon.red { background: #FCEAEA; color: var(--danger); }

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-label {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Tables */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--bg);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-secondary);
}

tr:hover {
  background: var(--bg);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-light);
}

.btn-secondary {
  background: white;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-secondary:hover {
  background: var(--bg);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #c82333;
}

.btn-warning {
  background: #ffc107;
  color: #212529;
  border: 1px solid #ffc107;
}

.btn-warning:hover {
  background: #e0a800;
  border-color: #e0a800;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-success {
  background: var(--secondary);
  color: white;
}

.btn-success:hover {
  background: var(--secondary-light);
}

.btn-info {
  background: #3498db;
  color: white;
}

.btn-icon {
  padding: 8px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 6px;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.btn-icon:hover {
  background: var(--bg);
  color: var(--primary);
}

.text-danger {
  color: var(--danger);
}

.text-danger:hover {
  color: #c82333;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 14px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s;
  color: #2D3748;
  background: #FFFFFF;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.badge-success { background: #E6F4EA; color: var(--success); }
.badge-warning { background: #FFF8E6; color: #B7791F; }
.badge-danger { background: #FCEAEA; color: var(--danger); }
.badge-info { background: #EBF5FF; color: var(--primary); }
.badge-default { background: var(--bg); color: var(--text-secondary); }

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--card-bg);
  border-radius: 12px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-secondary);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Login Page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, #7d3d66 100%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--card-bg);
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo h1 {
  color: var(--primary);
  font-size: 24px;
  margin-bottom: 8px;
}

.login-logo p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Grid Layouts */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

/* Charts */
.chart-container {
  height: 300px;
  margin-top: 16px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px;
  color: var(--text-secondary);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* QR Code Display */
.qr-display {
  text-align: center;
  padding: 24px;
  background: white;
  border-radius: 8px;
}

.qr-display img {
  max-width: 200px;
}

/* Actions */
.actions {
  display: flex;
  gap: 8px;
}

/* Search & Filters */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 16px;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 16px;
  flex: 1;
  max-width: 400px;
}

.search-box input {
  border: none;
  outline: none;
  flex: 1;
  font-size: 14px;
  background: transparent;
}

/* Notifications */
.notification-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  position: relative;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.notification-btn:hover {
  color: var(--primary);
}

.notification-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--danger);
  color: white;
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.notification-dropdown {
  position: absolute;
  top: 40px;
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 320px;
  max-height: 400px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 100;
}

.notification-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.notification-header h4 {
  margin: 0;
  font-size: 14px;
}

.notification-list {
  max-height: 350px;
  overflow-y: auto;
}

.notification-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-secondary);
}

.notification-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.notification-item:hover {
  background: var(--bg);
}

.notification-item.unread {
  background: #EBF5FF;
}

.notification-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
}

.notification-message {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.notification-time {
  font-size: 11px;
  color: var(--text-secondary);
}

/* Mobile hamburger toggle button (hidden on desktop) */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 20px;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  transition: background 0.2s;
}

.mobile-menu-btn:hover {
  background: var(--bg);
}

/* Sidebar backdrop for mobile */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
}

.sidebar-backdrop.active {
  display: block;
}

/* Responsive */
@media (max-width: 1024px) {
  .sidebar {
    width: 80px;
  }

  .sidebar-logo-text{
    display:none;
  }

  .logo-img{
    width:40px;
    height:40px;
    object-fit: contain;
    filter: brightness(0) invert(1);
  }

  .main-content{
    margin-left:80px;
  }
}

@media (max-width: 768px) {
  /* Show hamburger, hide fixed sidebar off-screen by default */
  .mobile-menu-btn {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.2);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-logo-text {
    display: flex !important;
  }

  .logo-img {
    width: 40px;
    height: 40px;
  }

  .main-content {
    margin-left: 0;
  }

  .header {
    padding: 12px 16px;
  }

  .header-left h2 {
    font-size: 18px;
  }

  .page-content {
    padding: 16px;
  }

  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    max-width: 100%;
  }

  .stat-value {
    font-size: 22px;
  }

  .card {
    padding: 16px;
  }

  .login-card {
    margin: 16px;
    padding: 24px;
  }

  #notificationDropdown {
    width: calc(100vw - 32px);
    right: -8px;
  }

  th, td {
    padding: 8px 10px;
    font-size: 13px;
  }
}
