/* ==========================================================================
   Payment Management System - Master Theme Stylesheet
   Modern Glassmorphism, Dark/Light UI, High Contrast, Responsive SaaS Layout
   ========================================================================== */

:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.85);
  --bg-card-hover: rgba(31, 41, 55, 0.9);
  --bg-input: #1f2937;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #3b82f6;
  
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-glow: rgba(59, 130, 246, 0.35);
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.25);
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.25);
  --info: #06b6d4;
  
  --sidebar-width: 260px;
  --header-height: 70px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 35px rgba(0, 0, 0, 0.45);
  --glass-backdrop: blur(16px);
}

[data-theme="light"] {
  --bg-primary: #f3f4f6;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: #ffffff;
  --bg-input: #f9fafb;
  --border-color: rgba(0, 0, 0, 0.08);
  
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  font-size: 15px;
  line-height: 1.5;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: #374151;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: #4b5563;
}

/* Links & Buttons */
a {
  color: var(--primary);
  text-decoration: none;
  transition: all 0.2s ease;
}
a:hover {
  color: var(--primary-hover);
}

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  text-decoration: none;
  user-select: none;
}
.btn:active {
  transform: scale(0.98);
}
.btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--primary-glow);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  box-shadow: 0 6px 20px var(--primary-glow);
}
.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--success-glow);
}
.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--danger-glow);
}
.btn-outline {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-primary);
}
.btn-outline:hover {
  background: var(--bg-input);
  border-color: var(--text-secondary);
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}
.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}
.btn-block {
  width: 100%;
}

/* Glass Panels & Cards */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-backdrop);
  -webkit-backdrop-filter: var(--glass-backdrop);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
}
.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

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

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar-header {
  height: var(--header-height);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}
.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.3px;
}
.brand-logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}
.sidebar-nav {
  flex: 1;
  padding: 20px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  padding: 12px 14px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 16px;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}
.nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-input);
}
.nav-item.active {
  color: #ffffff;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.2) 0%, rgba(59, 130, 246, 0.05) 100%);
  border-left: 3px solid var(--primary);
  font-weight: 600;
}
.nav-item svg, .nav-item i {
  font-size: 18px;
  width: 20px;
  text-align: center;
}
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  color: #ffffff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.user-info {
  line-height: 1.2;
}
.user-info .name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-info .role {
  font-size: 11px;
  color: var(--text-muted);
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.top-header {
  height: var(--header-height);
  background: var(--bg-card);
  backdrop-filter: var(--glass-backdrop);
  border-bottom: 1px solid var(--border-color);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}
.header-title-box h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.header-title-box p {
  font-size: 13px;
  color: var(--text-secondary);
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.content-body {
  padding: 28px;
  flex: 1;
}

/* Stats Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 4px;
  background: var(--primary);
}
.stat-card.stat-green::after { background: var(--success); }
.stat-card.stat-yellow::after { background: var(--warning); }
.stat-card.stat-purple::after { background: #8b5cf6; }
.stat-info h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 6px;
}
.stat-info .stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}
.stat-info .stat-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: var(--bg-input);
  color: var(--primary);
}
.stat-green .stat-icon { color: var(--success); background: rgba(16, 185, 129, 0.1); }
.stat-yellow .stat-icon { color: var(--warning); background: rgba(245, 158, 11, 0.1); }
.stat-purple .stat-icon { color: #8b5cf6; background: rgba(139, 92, 246, 0.1); }

/* Forms and Inputs */
.form-group {
  margin-bottom: 18px;
}
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.form-control, .form-select {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.2s ease;
  outline: none;
}
.form-control:focus, .form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
.form-control::placeholder {
  color: var(--text-muted);
}
.form-helper {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 5px;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-lg);
}
.custom-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
}
.custom-table th {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
}
.custom-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
  color: var(--text-primary);
  vertical-align: middle;
}
.custom-table tr:last-child td {
  border-bottom: none;
}
.custom-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}
.badge-success .badge-dot { background: #10b981; }
.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}
.badge-warning .badge-dot { background: #f59e0b; }
.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}
.badge-danger .badge-dot { background: #ef4444; }
.badge-info {
  background: rgba(6, 182, 212, 0.15);
  color: #06b6d4;
}
.badge-info .badge-dot { background: #06b6d4; }

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-overlay.active {
  display: flex;
  animation: fadeIn 0.2s ease forwards;
}
.modal-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
}
.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}
.modal-close:hover {
  color: var(--text-primary);
}
.modal-body {
  padding: 24px;
  max-height: 75vh;
  overflow-y: auto;
}
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: rgba(0, 0, 0, 0.1);
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 420px;
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast.toast-success { border-left: 4px solid var(--success); }
.toast.toast-error { border-left: 4px solid var(--danger); }
.toast.toast-warning { border-left: 4px solid var(--warning); }
.toast.toast-info { border-left: 4px solid var(--info); }

/* Payment Methods & Brand Colors */
.badge-method {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
}
.method-bkash { background: #e2136e; color: #ffffff; }
.method-nagad { background: #f7941d; color: #ffffff; }
.method-rocket { background: #8c3494; color: #ffffff; }
.method-upay { background: #005696; color: #ffffff; }
.method-bank { background: #2b579a; color: #ffffff; }
.method-custom { background: #4b5563; color: #ffffff; }

/* Mobile Menu Toggle */
.mobile-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 24px;
  cursor: pointer;
  padding: 6px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-secondary);
}
.empty-state-icon {
  font-size: 48px;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.empty-state h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.empty-state p {
  font-size: 13px;
  max-width: 360px;
  margin: 0 auto 20px;
}

/* Copy Box */
.copy-box {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  gap: 10px;
}
.copy-box code {
  flex: 1;
  font-family: monospace;
  font-size: 13px;
  color: #60a5fa;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Code Snippet Box */
.code-block {
  background: #0d1117;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  color: #58a6ff;
  overflow-x: auto;
  margin: 12px 0;
  position: relative;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Responsive Media Queries */
@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0;
  }
  .mobile-toggle {
    display: block;
  }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 95;
    display: none;
  }
  .sidebar-backdrop.active {
    display: block;
  }
}

@media (max-width: 640px) {
  .content-body {
    padding: 16px;
  }
  .top-header {
    padding: 0 16px;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
}
