/* ====================================================================================
   Internext Pay - Modern Dashboard CSS
   Component layer (utilities provided by Tailwind CDN). Plain CSS, no @apply.
   ==================================================================================== */

:root {
  --ip-primary: #6366f1;        /* indigo 500 */
  --ip-primary-hover: #4f46e5;  /* indigo 600 */
  --ip-accent: #8b5cf6;         /* violet 500 */
  --ip-accent-hover: #7c3aed;   /* violet 600 */
  --ip-success: #16a34a;
  --ip-success-bg: #dcfce7;
  --ip-warning: #d97706;
  --ip-warning-bg: #fef3c7;
  --ip-danger: #dc2626;
  --ip-danger-bg: #fee2e2;
  --ip-info: #2563eb;
  --ip-info-bg: #dbeafe;
  --ip-bg: #f8fafc;
  --ip-surface: #ffffff;
  --ip-border: #e5e7eb;
  --ip-border-dark: #d1d5db;
  --ip-text: #111827;
  --ip-text-secondary: #6b7280;
  --ip-text-muted: #9ca3af;
  --ip-radius: 0.75rem;
  --ip-radius-sm: 0.5rem;
  --ip-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.05);
  --ip-shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.08);
}

/* ===== Base ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--ip-text);
  background: var(--ip-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ===== Layout ===== */
.container {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}
@media (min-width: 640px)  { .container { max-width: 640px; } }
@media (min-width: 768px)  { .container { max-width: 768px; } }
@media (min-width: 1024px) { .container { max-width: 1024px; } }
@media (min-width: 1280px) { .container { max-width: 1280px; } }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  border-radius: var(--ip-radius-sm);
  padding: 0.625rem 1.25rem;
  outline: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--ip-primary), var(--ip-accent));
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 245, 0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(99, 102, 245, 0.35); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  background: var(--ip-surface);
  color: var(--ip-text);
  border: 1px solid var(--ip-border);
}
.btn-secondary:hover { background: #f3f4f6; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--ip-border-dark);
  color: var(--ip-text);
}
.btn-outline:hover { background: #f9fafb; }
.btn-red { background: var(--ip-danger); color: #fff; }
.btn-red:hover { background: #c53030; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3); }
.btn-ghost {
  background: transparent;
  color: var(--ip-text-secondary);
  border: 1px solid transparent;
}
.btn-ghost:hover { background: #f3f4f6; }
.btn-sm  { padding: 0.4rem 0.75rem; font-size: 0.8rem; }
.btn-lg  { padding: 0.8rem 1.5rem; font-size: 1rem; }
.btn-block { display: block; width: 100%; }

/* ===== Forms ===== */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ip-text);
  margin-bottom: 0.35rem;
}
.form-input {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--ip-border-dark);
  border-radius: var(--ip-radius-sm);
  font-size: 0.9rem;
  transition: all 0.2s ease;
  outline: none;
  background: var(--ip-surface);
}
.form-input:focus {
  border-color: var(--ip-accent);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}
.form-textarea {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--ip-border-dark);
  border-radius: var(--ip-radius-sm);
  font-size: 0.9rem;
  transition: all 0.2s ease;
  outline: none;
  background: var(--ip-surface);
  resize: vertical;
  min-height: 100px;
}
.form-input:focus, .form-textarea:focus {
  border-color: var(--ip-accent);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}
.input-with-icon { position: relative; }
.input-with-icon i {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ip-text-muted);
  font-size: 0.95rem;
}
.input-with-icon input,
.input-with-icon select { padding-left: 2.5rem; }
.select {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--ip-border-dark);
  border-radius: var(--ip-radius-sm);
  font-size: 0.9rem;
  background: var(--ip-surface);
  outline: none;
  cursor: pointer;
}
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--ip-border);
  border-radius: 9999px;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: var(--ip-surface);
  border-radius: 50%;
  transition: transform 0.2s;
}
input:checked + .toggle-slider { background: var(--ip-primary); }
input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ===== Cards ===== */
.card {
  background: var(--ip-surface);
  border-radius: var(--ip-radius);
  box-shadow: var(--ip-shadow);
  border: 1px solid var(--ip-border);
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.card:hover { box-shadow: var(--ip-shadow-lg); }
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--ip-border);
  background: #f9fafb;
}
.card-body { padding: 1.25rem; }

/* ===== Stats ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--ip-surface);
  border-radius: var(--ip-radius);
  padding: 1.25rem;
  border: 1px solid var(--ip-border);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--ip-shadow-lg); }
.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}
.stat-card.blue::before   { background: linear-gradient(90deg, var(--ip-primary), #3b82f6); }
.stat-card.green::before  { background: linear-gradient(90deg, var(--ip-success), #22c55e); }
.stat-card.purple::before { background: linear-gradient(90deg, var(--ip-accent), #a78bfa); }
.stat-card.yellow::before { background: linear-gradient(90deg, var(--ip-warning), #eab308); }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--ip-text); }
.stat-label { font-size: 0.8rem; color: var(--ip-text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-icon { width: 42px; height: 42px; border-radius: var(--ip-radius-sm); display: flex; align-items: center; justify-content: center; margin-bottom: 0.5rem; }
.stat-extra { font-size: 0.8rem; color: var(--ip-text-secondary); margin-top: 0.25rem; }

/* ===== Tables ===== */
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ip-text-secondary);
  border-bottom: 1px solid var(--ip-border);
}
.table td { padding: 0.75rem 1rem; border-bottom: 1px solid #f3f4f6; }
.table tbody tr:hover { background-color: #f9fafb; }
.table tbody tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x-auto; border-radius: var(--ip-radius); }

/* ===== Tabs ===== */
.tabs { display: flex; border-bottom: 1px solid var(--ip-border); margin-bottom: 1.5rem; gap: 0.25rem; }
.tab {
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  border: none;
  background: none;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ip-text-secondary);
  transition: all 0.2s ease;
  border-bottom: 2px solid transparent;
  border-radius: var(--ip-radius-sm) var(--ip-radius-sm) 0 0;
}
.tab.active { color: var(--ip-primary); border-bottom-color: var(--ip-primary); background: #f5f3ff; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal {
  background: var(--ip-surface);
  border-radius: var(--ip-radius);
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--ip-shadow-lg);
}
.modal-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--ip-border); display: flex; align-items: center; justify-content: space-between; }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--ip-border); display: flex; justify-content: flex-end; gap: 0.75rem; }

/* ===== Alerts ===== */
.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--ip-radius-sm);
  margin-bottom: 1rem;
  font-size: 0.875rem;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}
.alert-success { background: var(--ip-success-bg); color: #166534; border: 1px solid #86efac; }
.alert-error   { background: var(--ip-danger-bg); color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning { background: var(--ip-warning-bg); color: #92400e; border: 1px solid #fcd34d; }
.alert-info    { background: var(--ip-info-bg); color: #1e40af; border: 1px solid #93c5fd; }

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-success     { background: var(--ip-success-bg); color: #166534; }
.badge-pending     { background: var(--ip-warning-bg); color: #92400e; }
.badge-failed      { background: var(--ip-danger-bg); color: #991b1b; }
.badge-processing  { background: var(--ip-info-bg); color: #1e40af; }
.badge-completed    { background: var(--ip-success-bg); color: #166534; }
.badge-paid         { background: var(--ip-success-bg); color: #166534; }
.badge-draft        { background: #e5e7eb; color: #374151; }

/* ===== Empty state ===== */
.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--ip-text-muted); }
.empty-state i { font-size: 3rem; margin-bottom: 1rem; opacity: 0.3; }
.empty-state p { margin-top: 0.5rem; }

/* ===== Method / action icons ===== */
.method-icon { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: var(--ip-radius-sm); background: #f3f4f6; }

/* ===== Toast / Notification ===== */
#toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 2000; display: flex; flex-direction: column; gap: 0.75rem; pointer-events: none; }
.toast {
  min-width: 280px;
  max-width: 420px;
  padding: 0.9rem 1rem;
  border-radius: var(--ip-radius-sm);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.15);
  display: flex;
  align-items:flex-start;
  gap: 0.6rem;
  font-size: 0.875rem;
  color: #fff;
  pointer-events: auto;
  transform: translateX(0);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.3s ease;
}
.toast.show { opacity: 1; transform: translateX(-4px); }
.toast.success { background: var(--ip-success); }
.toast.error   { background: var(--ip-danger); }
.toast.info    { background: var(--ip-info); }
.toast.warning { background: var(--ip-warning); }

/* ===== Pagination ===== */
.pagination { display: flex; gap: 0.25rem; }
.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  color: var(--ip-text-secondary);
  background: var(--ip-surface);
  border: 1px solid var(--ip-border);
  border-radius: var(--ip-radius-sm);
  transition: all 0.2s ease;
}
.pagination a:hover { background: #f3f4f6; color: var(--ip-primary); }
.pagination .current { background: var(--ip-primary); color: #fff; border-color: var(--ip-primary); }

/* ===== Responsiveness ===== */
@media (max-width: 1024px) { .lg\:hidden { display: none !important; } .lg\:block { display: block !important; } .lg\:flex { display: flex !important; } }
@media (max-width: 768px)  { .md\:hidden { display: none !important; } .md\:block { display: block !important; } .md\:flex { display: flex !important; } }

/* ===== Theme toggle button (global) ===== */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 0.7rem;
  border: 1px solid var(--ip-border);
  background: var(--ip-surface);
  color: var(--ip-text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1.05rem;
}
.theme-toggle-btn:hover {
  background: var(--ip-primary);
  color: #fff;
  transform: scale(1.05);
}

/* ===== Dark Mode ===== */
.dark {
  --ip-bg: #0f172a;
  --ip-surface: #1e293b;
  --ip-surface-alt: #111827;
  --ip-border: #334155;
  --ip-border-dark: #4b5563;
  --ip-text: #f1f5f9;
  --ip-text-secondary: #94a3b8;
  --ip-text-muted: #64748b;
  --ip-success-bg: #064e31;
  --ip-warning-bg: #451a03;
  --ip-danger-bg: #450a0a;
  --ip-info-bg: #1e3a8a;
}

/* Remap the most common Tailwind color utilities used across pages so that
   light-mode pages get a consistent dark appearance without per-page edits. */
.dark .bg-white { background-color: var(--ip-surface); }
.dark .bg-gray-50 { background-color: var(--ip-bg); }
.dark .bg-gray-100 { background-color: #1f2937; }
.dark .bg-gray-200 { background-color: #374151; }
.dark .bg-gray-300 { background-color: #4b5563; }
.dark .bg-blue-50,
.dark .bg-green-50,
.dark .bg-red-50,
.dark .bg-purple-50,
.dark .bg-yellow-50,
.dark .bg-indigo-50,
.dark .bg-pink-50,
.dark .bg-orange-50,
.dark .bg-teal-50 { background-color: var(--ip-bg); }
.dark .border-gray-200 { border-color: #334155; }
.dark .border-gray-300 { border-color: #4b5563; }
.dark .border-t-2,
.dark .border-t { border-top-color: var(--ip-border); }
.dark .border-b { border-bottom-color: var(--ip-border); }

/* Text remap */
.dark .text-gray-900 { color: #f1f5f9; }
.dark .text-gray-800 { color: #e5e7eb; }
.dark .text-gray-700 { color: #cbd5e1; }
.dark .text-gray-600 { color: #94a3b8; }
.dark .text-gray-500 { color: #9ca3af; }
.dark .text-gray-400 { color: #64748b; }
.dark .text-gray-300 { color: #4b5563; }
.dark .text-gray-200 { color: #374151; }

/* Hover remap (matches Tailwind's generated selector order) */
.dark .hover\:bg-gray-100:hover { background-color: #1f2937; }
.dark .hover\:bg-gray-50:hover { background-color: var(--ip-bg); }
.dark .hover\:bg-red-50:hover { background-color: rgba(220, 38, 38, 0.08); }
.dark .hover\:text-gray-700:hover { color: #cbd5e1; }
.dark .hover\:text-gray-900:hover { color: #f1f5f9; }
.dark .hover\:text-gray-600:hover { color: #94a3b8; }
.dark .hover\:text-purple-600:hover { color: #a78bfa; }

/* Component dark overrides */
.dark .card { background: var(--ip-surface); border-color: var(--ip-border); }
.dark .card-header { background: #111827; border-color: var(--ip-border); }
.dark .table td { border-bottom-color: #334155; }
.dark .table tbody tr:hover { background-color: #1f2937; }
.dark .pagination a,
.dark .pagination span { background: var(--ip-surface); border-color: var(--ip-border); color: var(--ip-text-secondary); }
.dark .pagination a:hover { background: #374151; color: var(--ip-primary); }
.dark .alert-success { background: var(--ip-success-bg); color: #86efac; border-color: #16a34a; }
.dark .alert-error   { background: var(--ip-danger-bg); color: #fca5a5; border-color: #dc2626; }
.dark .alert-warning { background: var(--ip-warning-bg); color: #fcd34d; border-color: #d97706; }
.dark .alert-info    { background: var(--ip-info-bg); color: #93c5fd; border-color: #2563eb; }
.dark .badge-success   { background: var(--ip-success-bg); color: #86efac; }
.dark .badge-pending   { background: var(--ip-warning-bg); color: #fcd34d; }
.dark .badge-failed    { background: var(--ip-danger-bg); color: #fca5a5; }
.dark .badge-completed  { background: var(--ip-success-bg); color: #86efac; }
.dark .badge-paid       { background: var(--ip-success-bg); color: #86efac; }
.dark .badge-draft      { background: #374151; color: #cbd5e1; }
.dark .badge-processing { background: var(--ip-info-bg); color: #93c5fd; }
.dark .method-icon { background: #374151; }
.dark .btn-secondary:hover { background: #374151; }
.dark .btn-ghost:hover { background: #374151; }
.dark .toast { box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4); }
