:root {
  --primary-color: #6366f1;
  --light-bg: #f8f9fa;
  --admin-navbar: #6366f1;
  --sidebar-bg: #ffffff;
  --text-muted: #6c757d;
  --border-color: #dee2e6;
  --sidebar-width: 260px;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
}

body {
  background-color: var(--light-bg);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  padding-top: 76px;
  overflow-x: hidden;
}

.text-primary {
  color: var(--primary-color) !important;
}

.bg-primary {
  background-color: var(--primary-color) !important;
}

.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-primary:hover {
  background-color: #5855eb;
  border-color: #5855eb;
}

/* Enhanced Balance Display Styles */
.balance-display {
  font-size: 0.85rem;
}

.balance-display .badge {
  font-size: 0.75rem;
  padding: 0.4em 0.6em;
  font-weight: 600;
}

.balance-display-mobile {
  display: block;
}

.balance-card-desktop {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(135deg, var(--success-color), #059669);
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  min-width: 100px;
}

.balance-amount {
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1;
}

.balance-pending-small {
  font-size: 0.7rem;
  opacity: 0.9;
  margin-top: 2px;
}

.balance-card-mobile,
.balance-card-sidebar {
  background: linear-gradient(135deg, var(--success-color), #059669);
  color: white;
  padding: 0.75rem;
  border-radius: 8px;
  text-align: center;
}

.balance-main {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
}

.balance-label {
  font-size: 0.75rem;
  opacity: 0.9;
  margin-top: 0.25rem;
}

.balance-pending {
  font-size: 0.7rem;
  opacity: 0.8;
  margin-top: 0.25rem;
}

/* Balance Summary in Dropdown */
.balance-summary {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 1rem;
}

.balance-stat {
  text-align: center;
  color: white;
}

.balance-stat-value {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.balance-stat-label {
  font-size: 0.7rem;
  opacity: 0.8;
  margin-top: 0.25rem;
}

.balance-pending-info {
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
}

/* Balance Widget in Dashboard Header */
.balance-widget {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: white;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.balance-widget-content {
  text-align: right;
}

.balance-widget .balance-amount {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--success-color);
  line-height: 1;
}

.balance-widget .balance-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Balance Cards */
.balance-card-main {
  background: linear-gradient(135deg, var(--success-color), #059669);
  color: white;
  border: none;
}

.balance-card-main .card-body {
  padding: 2rem 1.5rem;
}

.balance-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  opacity: 0.9;
}

/* Balance Breakdown Card */
.balance-breakdown-card {
  border: none;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.balance-flow {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.balance-flow-item {
  display: flex;
  align-items: center;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 12px;
  transition: all 0.3s ease;
}

.balance-flow-item:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.balance-flow-result {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
  border: 2px solid var(--primary-color);
}

.balance-flow-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-right: 1rem;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.balance-flow-content {
  flex: 1;
}

.balance-flow-amount {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
}

.balance-flow-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.balance-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 12px;
}

/* Transaction List */
.transaction-list {
  max-height: 300px;
  overflow-y: auto;
}

.transaction-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid #f1f3f4;
}

.transaction-item:last-child {
  border-bottom: none;
}

.transaction-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 185, 129, 0.1);
  margin-right: 0.75rem;
}

.transaction-details {
  flex: 1;
}

.transaction-amount {
  font-weight: 700;
  color: var(--success-color);
  font-size: 0.95rem;
}

.transaction-info {
  margin-top: 0.25rem;
}

/* Price Display for Purchase Page */
.price-display {
  background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
  color: white;
  padding: 2rem;
  border-radius: 16px;
  margin-bottom: 2rem;
}

.price-amount {
  font-size: 3rem;
  font-weight: 700;
  line-height: 1;
}

.price-label {
  font-size: 1rem;
  opacity: 0.9;
  margin-top: 0.5rem;
}

/* QR Code Container */
.qr-code-container {
  position: relative;
  display: inline-block;
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  padding: 2rem;
  background: #f8f9fa;
}

.qr-code {
  max-width: 200px;
  border-radius: 8px;
}

.qr-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

/* Success Animation */
.success-animation {
  animation: successPulse 2s ease-in-out;
}

@keyframes successPulse {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Payment Header */
.payment-header {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
  padding: 2rem;
  border-radius: 16px;
  margin-bottom: 2rem;
}

/* User Dropdown Styles */
.user-dropdown {
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  transition: all 0.3s ease;
}

.user-dropdown:hover {
  background-color: #e9ecef;
  border-color: var(--primary-color);
  text-decoration: none;
}

/* Fix dropdown arrow - hide the default Bootstrap arrow */
.user-dropdown::after {
  display: none !important;
}

.user-dropdown-menu {
  min-width: 320px;
  border-radius: 12px;
  padding: 0;
  margin-top: 8px;
}

.user-dropdown-menu .dropdown-header {
  background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
  color: white;
  border-radius: 12px 12px 0 0;
  margin: 0;
}

.user-dropdown-menu .dropdown-header .text-dark {
  color: white !important;
}

.user-dropdown-menu .dropdown-header .text-muted {
  color: rgba(255, 255, 255, 0.8) !important;
}

.user-dropdown-menu .dropdown-item {
  transition: all 0.2s ease;
  border-radius: 6px;
  margin: 2px 8px;
}

.user-dropdown-menu .dropdown-item:hover {
  background-color: rgba(99, 102, 241, 0.1);
  transform: translateX(4px);
}

.user-avatar {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-avatar-large {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.user-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: #495057;
  line-height: 1.2;
}

.user-name-mobile {
  font-weight: 600;
  font-size: 0.85rem;
  color: #495057;
  line-height: 1.2;
}

.user-info-mobile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* Layout Container */
.layout-container {
  display: flex;
  min-height: calc(100vh - 76px);
  width: 100%;
}

/* Sidebar Styles - Fixed and Scrollable */
.sidebar {
  position: fixed;
  top: 76px;
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - 76px);
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-admin-desktop {
  position: fixed;
  top: 76px;
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - 76px);
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

/* Sidebar Content - Scrollable */
.sidebar-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem 0;
  padding-bottom: 0;
  /* Ensure scrolling works when content overflows */
  max-height: calc(100vh - 76px - 80px); /* Account for footer height */
}

.sidebar-content::-webkit-scrollbar {
  width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Sidebar Footer - Fixed at bottom */
.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border-color);
  background-color: var(--sidebar-bg);
  margin-top: auto;
  flex-shrink: 0; /* Prevent footer from shrinking */
}

/* Main content area - Account for fixed sidebar */
.main-content {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  padding: 1rem;
  background-color: var(--light-bg);
  overflow-x: hidden;
  min-height: calc(100vh - 76px);
}

/* Content wrapper */
.content-wrapper {
  width: 100%;
  max-width: 100%;
}

.sidebar-link {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  margin: 4px 12px;
  border-radius: 10px;
  text-decoration: none;
  transition: all 0.3s ease;
  color: #495057;
  font-weight: 500;
}

.sidebar-link:hover {
  background-color: rgba(99, 102, 241, 0.1);
  color: var(--primary-color);
  text-decoration: none;
  transform: translateX(4px);
}

.sidebar-link.active {
  background-color: var(--primary-color);
  color: white !important;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.sidebar-link i {
  margin-right: 12px;
  width: 20px;
  font-size: 16px;
}

/* Logout Button */
.logout-btn {
  background: linear-gradient(135deg, #dc3545, #c82333);
  color: white !important;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  transition: all 0.3s ease;
  width: 100%;
}

.logout-btn:hover {
  background: linear-gradient(135deg, #c82333, #bd2130);
  color: white !important;
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.logout-btn i {
  margin-right: 8px;
}

/* Card Styles */
.card {
  border: none;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  margin-bottom: 1rem;
  width: 100%;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.card-header {
  background-color: white;
  border-bottom: 1px solid #e9ecef;
  border-radius: 12px 12px 0 0 !important;
  padding: 1rem 1.5rem;
}

.stats-card {
  background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
  color: white;
  border: none;
}

.stats-card .card-body {
  padding: 1.5rem;
}

.stats-number {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1;
}

.stats-label {
  font-size: 0.85rem;
  opacity: 0.9;
  margin-bottom: 0;
}

/* Filter Section */
.filter-section {
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  width: 100%;
}

/* Table Container */
.table-container {
  background-color: white;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  margin-bottom: 1rem;
  width: 100%;
}

.table-container .card-header {
  margin: 0;
  border-radius: 8px 8px 0 0 !important;
  border-bottom: 1px solid var(--border-color);
}

.table-container .card-body {
  padding: 0;
}

/* Table responsive */
.table-responsive {
  max-height: 70vh;
  overflow-y: auto;
  overflow-x: auto;
  width: 100%;
}

.table-responsive::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Table Styles */
.table {
  margin-bottom: 0;
  width: 100%;
}

.table th {
  border-top: none;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1rem 0.75rem;
  background-color: #f8f9fa;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 2px solid var(--border-color);
}

.table td {
  padding: 0.75rem;
  vertical-align: middle;
  border-bottom: 1px solid #f1f3f4;
}

.table-hover tbody tr:hover {
  background-color: rgba(99, 102, 241, 0.05);
}

/* Mobile Responsive */
@media (max-width: 991.98px) {
  body {
    padding-top: 76px;
  }

  .layout-container {
    flex-direction: column;
  }

  .sidebar,
  .sidebar-admin-desktop {
    display: none !important;
  }

  .main-content {
    margin-left: 0;
    width: 100%;
    padding: 0.5rem;
  }

  .stats-number {
    font-size: 1.5rem;
  }

  .table-responsive {
    max-height: 60vh;
  }

  .table th,
  .table td {
    padding: 0.5rem 0.4rem;
    font-size: 0.85rem;
  }

  .user-dropdown-menu {
    min-width: 280px;
  }

  .balance-display {
    display: none;
  }

  .balance-display-mobile {
    display: block;
  }

  .balance-widget {
    display: none;
  }

  .balance-flow {
    gap: 0.75rem;
  }

  .balance-flow-item {
    padding: 0.75rem;
  }

  .balance-flow-icon {
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
  }

  .balance-flow-amount {
    font-size: 1.1rem;
  }

  .price-amount {
    font-size: 2.5rem;
  }
}

/* Mobile Sidebar Improvements */
.offcanvas {
  width: 280px !important;
}

.offcanvas-header {
  background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
  color: white;
  border-bottom: none;
  padding: 1.5rem;
}

.offcanvas-title {
  font-weight: 600;
  font-size: 1.2rem;
}

.offcanvas-body {
  padding: 0;
  background-color: #f8f9fa;
  overflow-y: auto; /* Make mobile sidebar scrollable */
}

.offcanvas-body::-webkit-scrollbar {
  width: 6px;
}

.offcanvas-body::-webkit-scrollbar-track {
  background: transparent;
}

.offcanvas-body::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.list-group-item {
  border: none;
  padding: 1rem 1.5rem;
  background-color: transparent;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.list-group-item:hover {
  background-color: rgba(99, 102, 241, 0.1);
  transform: translateX(8px);
}

.list-group-item.active {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.list-group-item i {
  width: 20px;
  margin-right: 12px;
}

/* Mobile Logout Button */
.mobile-logout {
  margin: 1rem;
  background: linear-gradient(135deg, #dc3545, #c82333);
  color: white;
  border: none;
  padding: 12px;
  border-radius: 8px;
  text-align: center;
  text-decoration: none;
  display: block;
  font-weight: 500;
}

.mobile-logout:hover {
  color: white;
  text-decoration: none;
}

/* Badge Styles */
.badge {
  font-size: 0.75rem;
  padding: 0.5em 0.75em;
  border-radius: 6px;
}

/* Form Styles */
.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.25);
}

.form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.25);
}

/* Button Styles */
.btn {
  border-radius: 6px;
  font-weight: 500;
  padding: 0.5rem 1rem;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
  min-height: 300px;
}

/* Search box for mobile */
.search-box {
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

/* Hero section for landing page */
.hero-section {
  background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
  color: white;
  padding: 100px 0 80px;
  margin-top: -76px;
  padding-top: 176px;
}

.feature-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 2rem;
  margin-bottom: 1rem;
}

/* Responsive adjustments */
@media (max-width: 576px) {
  .stats-number {
    font-size: 1.3rem;
  }

  .card-body {
    padding: 1rem;
  }

  .filter-section {
    padding: 0.75rem;
  }

  .user-info-mobile {
    display: none;
  }

  .user-dropdown-menu {
    min-width: 260px;
  }

  .balance-card-desktop {
    display: none;
  }

  .balance-main {
    font-size: 1.1rem;
  }

  .balance-flow-amount {
    font-size: 1rem;
  }
}

/* Container fixes */
.container-fluid {
  padding: 0 !important;
  max-width: 100%;
}

.row {
  margin: 0;
  width: 100%;
}

/* Scroll hint */
.scroll-hint {
  text-align: center;
  padding: 0.5rem;
  background-color: #f8f9fa;
  border-top: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--text-muted);
  display: none;
}

.scroll-hint.show {
  display: block;
}

@media (max-width: 576px) {
  .scroll-hint {
    display: block;
  }
}

/* Fix for overlapping sidebars */
@media (min-width: 992px) {
  .offcanvas {
    display: none !important;
  }
}

@media (max-width: 991.98px) {
  .sidebar,
  .sidebar-admin-desktop {
    transform: translateX(-100%);
    visibility: hidden;
  }
}
