/* =====================================================
   ProSMM Panel – Professional Responsive Stylesheet
   ===================================================== */
:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #818cf8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --dark: #0f172a;
  --dark-2: #1e293b;
  --gray: #64748b;
  --gray-light: #94a3b8;
  --light: #f1f5f9;
  --white: #ffffff;
  --border: #e2e8f0;
  --sidebar-width: 260px;
  --header-height: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
  --transition: 0.2s ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--light);
  color: var(--dark);
  line-height: 1.6;
  min-height: 100vh;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; transition: color var(--transition); }
img { max-width: 100%; height: auto; }
button, input, select, textarea { font-family: inherit; }

/* ========== AUTH PAGES ========== */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #0f172a 0%, #1e1b4b 45%, #312e81 100%);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.auth-wrapper::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(79,70,229,.25) 0%, transparent 70%);
  top: -100px; right: -100px;
  pointer-events: none;
}
.auth-card {
  background: var(--white);
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.35);
  width: 100%;
  max-width: 420px;
  padding: 40px 36px;
  position: relative;
  z-index: 1;
}
.auth-card .logo { text-align: center; margin-bottom: 28px; }
.auth-card .logo .logo-icon {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.5rem; margin-bottom: 14px;
}
.auth-card .logo h1 {
  font-size: 1.5rem; font-weight: 700; color: var(--dark);
}
.auth-card .logo p { color: var(--gray); font-size: 0.9rem; margin-top: 4px; }

.form-group { margin-bottom: 18px; }
.form-group label {
  display: block; font-size: 0.875rem; font-weight: 500;
  margin-bottom: 6px; color: var(--dark-2);
}
.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  background: #fff;
  color: var(--dark);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.15);
}
.form-control::placeholder { color: var(--gray-light); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border: none; border-radius: 10px;
  font-size: 0.95rem; font-weight: 600; cursor: pointer;
  transition: all var(--transition); line-height: 1.4;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(79,70,229,.35); }
.btn-sm { padding: 7px 14px; font-size: 0.85rem; border-radius: 8px; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-outline {
  background: transparent; border: 1.5px solid var(--border); color: var(--dark);
}
.btn-outline:hover { background: var(--light); border-color: #cbd5e1; }
.btn-info { background: var(--info); color: #fff; }

.auth-footer {
  text-align: center; margin-top: 22px; font-size: 0.9rem; color: var(--gray);
}
.auth-footer a { color: var(--primary); font-weight: 600; }
.auth-footer a:hover { text-decoration: underline; }

/* ========== ALERTS ========== */
.alert {
  padding: 13px 16px; border-radius: 10px; margin-bottom: 18px;
  font-size: 0.9rem; display: flex; align-items: center; gap: 10px;
}
.alert i { flex-shrink: 0; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-danger { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef3c7; color: #92400e; }
.alert-info { background: #dbeafe; color: #1e40af; }

/* ========== APP LAYOUT ========== */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--dark);
  color: #fff;
  position: fixed; top: 0; left: 0; height: 100vh;
  overflow-y: auto; z-index: 1000;
  transition: transform 0.3s ease;
  display: flex; flex-direction: column;
}
.sidebar-header {
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0;
}
.brand-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.sidebar-header .brand {
  font-size: 1.1rem; font-weight: 700; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-nav { padding: 16px 12px; flex: 1; }
.nav-section { margin-bottom: 22px; }
.nav-section-title {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.09em;
  color: rgba(255,255,255,.35); padding: 0 12px; margin-bottom: 8px; font-weight: 600;
}
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 10px;
  color: rgba(255,255,255,.65); font-size: 0.9rem; font-weight: 500;
  margin-bottom: 2px; transition: all var(--transition);
}
.nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-link.active { background: var(--primary); color: #fff; }
.nav-link i { width: 20px; text-align: center; font-size: 1.05rem; flex-shrink: 0; }

.main-content {
  flex: 1; margin-left: var(--sidebar-width);
  min-height: 100vh; display: flex; flex-direction: column;
}
.topbar {
  height: var(--header-height);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; position: sticky; top: 0; z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.menu-toggle {
  display: none; background: none; border: none;
  font-size: 1.35rem; cursor: pointer; color: var(--dark); padding: 4px;
}
.page-title { font-size: 1.15rem; font-weight: 600; color: var(--dark); }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.balance-badge {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff; padding: 8px 16px; border-radius: 50px;
  font-weight: 600; font-size: 0.88rem;
  display: flex; align-items: center; gap: 8px;
}
.user-dropdown { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 0.9rem; flex-shrink: 0;
}
.user-name { font-weight: 500; font-size: 0.9rem; color: var(--dark-2); }

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

.app-footer {
  padding: 16px 28px; text-align: center;
  font-size: 0.8rem; color: var(--gray);
  border-top: 1px solid var(--border); background: var(--white);
}

/* ========== STATS ========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 20px; margin-bottom: 28px;
}
.stat-card {
  background: var(--white); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
  display: flex; align-items: flex-start; gap: 16px;
  transition: box-shadow var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; color: #fff; flex-shrink: 0;
}
.stat-icon.purple { background: linear-gradient(135deg, #4f46e5, #818cf8); }
.stat-icon.green { background: linear-gradient(135deg, #10b981, #34d399); }
.stat-icon.orange { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.stat-icon.blue { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
.stat-icon.red { background: linear-gradient(135deg, #ef4444, #f87171); }
.stat-info h3 { font-size: 1.45rem; font-weight: 700; line-height: 1.2; color: var(--dark); }
.stat-info p { color: var(--gray); font-size: 0.85rem; margin-top: 3px; }

/* ========== CARDS ========== */
.card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 24px; overflow: hidden;
}
.card-header {
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.card-header h2 {
  font-size: 1.05rem; font-weight: 600; color: var(--dark);
  display: flex; align-items: center; gap: 8px;
}
.card-body { padding: 22px; }

/* ========== TABLES ========== */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
table th, table td {
  padding: 12px 16px; text-align: left;
  border-bottom: 1px solid var(--border); font-size: 0.9rem;
}
table th {
  background: #f8fafc; font-weight: 600; color: var(--gray);
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em;
  white-space: nowrap;
}
table tbody tr { transition: background var(--transition); }
table tbody tr:hover { background: #f8fafc; }
table td { color: var(--dark-2); }

/* ========== BADGES ========== */
.badge {
  display: inline-block; padding: 4px 10px; border-radius: 50px;
  font-size: 0.75rem; font-weight: 600; white-space: nowrap;
}
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-processing { background: #dbeafe; color: #1e40af; }
.badge-completed { background: #d1fae5; color: #065f46; }
.badge-partial { background: #e0e7ff; color: #3730a3; }
.badge-canceled, .badge-cancelled, .badge-failed, .badge-refunded {
  background: #fee2e2; color: #991b1b;
}
.badge-active { background: #d1fae5; color: #065f46; }
.badge-inactive { background: #f1f5f9; color: #64748b; }

/* ========== FORMS ========== */
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.form-actions {
  display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap;
}
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  padding-right: 36px;
}
textarea.form-control { min-height: 100px; resize: vertical; }

/* ========== MODALS ========== */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,.55); z-index: 2000;
  align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(2px);
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--white); border-radius: 16px;
  width: 100%; max-width: 560px; max-height: 90vh;
  overflow-y: auto; box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 1.1rem; font-weight: 600; }
.modal-close {
  background: none; border: none; font-size: 1.5rem;
  cursor: pointer; color: var(--gray); line-height: 1; padding: 0 4px;
}
.modal-close:hover { color: var(--dark); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ========== EMPTY STATE ========== */
.empty-state {
  text-align: center; padding: 48px 20px; color: var(--gray);
}
.empty-state i { font-size: 2.8rem; margin-bottom: 12px; opacity: 0.35; display: block; }
.empty-state p { font-size: 0.95rem; }

/* ========== CODE / PRE ========== */
pre, code {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.85rem;
}
pre {
  background: #f1f5f9; padding: 14px 16px; border-radius: 8px;
  overflow-x: auto; line-height: 1.5;
}

/* ========== UTILITIES ========== */
.text-muted { color: var(--gray); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-end { text-align: right; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.d-flex { display: flex; }
.gap-2 { gap: 8px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-100 { width: 100%; }
.flex-wrap { flex-wrap: wrap; }

/* ========== RESPONSIVE ========== */
@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.2); }
  .main-content { margin-left: 0; }
  .menu-toggle { display: block; }
  .sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.5); z-index: 999;
  }
  .sidebar-overlay.show { display: block; }
  .user-name { display: none; }
}

@media (max-width: 576px) {
  .content-area { padding: 16px; }
  .topbar { padding: 0 16px; }
  .stats-grid { grid-template-columns: 1fr; }
  .card-header { flex-direction: column; align-items: flex-start; }
  .auth-card { padding: 28px 22px; }
  .balance-badge { font-size: 0.8rem; padding: 6px 12px; }
  .app-footer { padding: 14px 16px; }
  table th, table td { padding: 10px 12px; font-size: 0.85rem; }
}
