@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg-body: #0f1419;
  --bg-sidebar: #151b26;
  --bg-card: #1a2332;
  --bg-card-hover: #1f2b3d;
  --bg-input: #1a2332;
  --bg-table-odd: #151b26;
  --bg-table-even: #1a2332;
  --bg-table-hover: #1f2b3d;
  --bg-table-header: #0f1419;
  --bg-nav: #151b26;
  --bg-dropdown: #1a2332;
  --border-color: #2d3748;
  --border-light: #3a4a5e;
  --text-primary: #e8eaed;
  --text-secondary: #9aa0a6;
  --text-muted: #6b7280;
  --accent-blue: #4f8cff;
  --accent-purple: #6c5ce7;
  --accent-green: #00b894;
  --accent-yellow: #fdcb6e;
  --accent-red: #e17055;
  --accent-cyan: #00cec9;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --sidebar-width: 260px;
  --transition: 0.2s ease;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  background: var(--bg-body);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---------- GRID LAYOUT ---------- */
.grid-container {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: 64px 1fr;
  grid-template-areas:
    'sidebar header'
    'sidebar main';
  height: 100vh;
  min-height: 100vh;
}

/* ---------- TYPOGRAPHY ---------- */
h1, h2, h3, h4, h5, h6 { color: var(--text-primary); margin-top: 0; }
a { color: var(--accent-blue); text-decoration: none; }
a:hover { color: #6fa3ff; text-decoration: underline; }

/* ---------- CONTAINER ---------- */
.container, .container-fluid { width: 100%; padding-right: 15px; padding-left: 15px; margin-right: auto; margin-left: auto; }
.container { max-width: 1140px; }
.container-fluid { max-width: 100%; }

/* ---------- SCROLLBAR ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ---------- HEADER ---------- */
.header {
  grid-area: header;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.menu-icon {
  display: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 24px;
  transition: color var(--transition);
}
.menu-icon:hover { color: var(--text-primary); }

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}
.header-right span {
  background: var(--accent-blue);
  color: #fff;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

/* ---------- SIDEBAR ---------- */
#sidebar {
  grid-area: sidebar;
  height: 100vh;
  background: var(--bg-sidebar);
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 0.3s ease, margin 0.3s ease;
  z-index: 200;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.sidebar-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.sidebar-brand {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-brand .material-icons-outlined {
  font-size: 28px;
  color: var(--accent-blue);
}

.sidebar-title > span {
  display: none;
  cursor: pointer;
  color: var(--text-secondary);
}
.sidebar-title > span:hover { color: var(--text-primary); }

#sidebar .nav {
  padding: 12px 0;
  flex: 1;
  flex-direction: column;
}

#sidebar .nav-item {
  list-style: none;
  margin: 2px 8px;
}

#sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
}

#sidebar .nav-link .material-icons-outlined {
  font-size: 22px;
  flex-shrink: 0;
}

#sidebar .nav-link:hover {
  background: rgba(79, 140, 255, 0.1);
  color: var(--accent-blue);
}

#sidebar .nav-link.active {
  background: linear-gradient(135deg, rgba(79, 140, 255, 0.15), rgba(108, 92, 231, 0.15));
  color: var(--accent-blue);
  font-weight: 600;
}

#sidebar .nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: var(--accent-blue);
  border-radius: 0 3px 3px 0;
}

/* Section label in sidebar */
.sidebar-section {
  padding: 16px 20px 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* ---------- MAIN ---------- */
.main-container {
  grid-area: main;
  overflow-y: auto;
  padding: 24px 28px;
  background: var(--bg-body);
}

.main-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.main-title h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.02em;
}

/* ---------- CARDS ---------- */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  word-wrap: break-word;
  background-clip: border-box;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}
.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border-color);
  padding: 16px 20px;
  font-weight: 600;
  color: var(--text-primary);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  margin-bottom: 0;
}

.card-body {
  padding: 20px;
  flex: 1 1 auto;
}

/* Payment method config cards */
.pm-card { border-top: 3px solid var(--border-color); }
.pm-card:first-of-type { border-top-color: var(--accent-blue); }
.pm-card:nth-of-type(2) { border-top-color: var(--accent-green); }
.pm-card:nth-of-type(3) { border-top-color: var(--accent-purple); }

/* Dashboard cards */
.main-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.main-cards .card {
  padding: 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
}

.main-cards .card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.main-cards .card:first-child::before { background: var(--accent-blue); }
.main-cards .card:nth-child(2)::before { background: var(--accent-green); }
.main-cards .card:nth-child(3)::before { background: var(--accent-purple); }
.main-cards .card:nth-child(4)::before { background: var(--accent-cyan); }

.card-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.card-inner h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.card-inner .material-icons-outlined {
  font-size: 36px;
  color: var(--text-muted);
  opacity: 0.6;
}

.main-cards .card h1 {
  font-size: 32px;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}

/* ---------- TABLES ---------- */
.table {
  width: 100%;
  margin-bottom: 0;
  color: var(--text-primary);
  border-collapse: separate;
  border-spacing: 0;
}

.table-bordered {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.table-bordered th,
.table-bordered td {
  border: none;
  border-bottom: 1px solid var(--border-color);
  padding: 10px 14px;
  vertical-align: middle;
}

.table-bordered th:not(:last-child),
.table-bordered td:not(:last-child) {
  border-right: 1px solid var(--border-color);
}

.table thead th {
  border-bottom: 1px solid var(--border-color);
  text-align: inherit;
}

th {
  text-align: inherit;
}

.table-striped tbody tr:nth-of-type(odd) { background: var(--bg-table-odd); }
.table-striped tbody tr:nth-of-type(even) { background: var(--bg-table-even); }
.table-hover tbody tr:hover { background: var(--bg-table-hover); }

.thead-dark th {
  background: var(--bg-table-header);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 14px;
  border-bottom: 2px solid var(--border-color);
}

.table td {
  font-size: 13px;
  color: var(--text-primary);
}

/* ---------- NAV TABS ---------- */
.nav-tabs {
  border-bottom: 1px solid var(--border-color);
  gap: 2px;
}

.nav-tabs .nav-link {
  color: var(--text-secondary);
  background: transparent;
  border: none;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  position: relative;
}

.nav-tabs .nav-link:hover {
  color: var(--text-primary);
  background: rgba(79, 140, 255, 0.05);
}

.nav-tabs .nav-link.active {
  color: var(--accent-blue);
  background: transparent;
  font-weight: 600;
}

.nav-tabs .nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-blue);
  border-radius: 2px 2px 0 0;
}

/* Custom pill tabs (used in website_settings) */
.tab-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.tab-nav .tab-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
}

.tab-nav .tab-item:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

.tab-nav .tab-item.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent-blue), #3a7bf5);
  border-color: var(--accent-blue);
  box-shadow: 0 4px 15px rgba(79, 140, 255, 0.3);
}

.tab-nav .tab-item .material-icons-outlined {
  font-size: 20px;
}

.tab-nav .tab-item .tab-label {
  display: flex;
  flex-direction: column;
}

.tab-nav .tab-item .tab-desc {
  font-size: 11px;
  font-weight: 400;
  opacity: 0.7;
  margin-top: 1px;
}

.tab-nav .tab-item.active .tab-desc {
  opacity: 0.85;
}

/* ---------- FORMS ---------- */
.form-control {
  display: block;
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 14px;
  line-height: 1.5;
  background-clip: padding-box;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
  background: var(--bg-input);
  color: var(--text-primary);
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.15);
  outline: none;
}

.form-control::placeholder { color: var(--text-muted); }

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='%239aa0a6' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

select.form-control option { background: var(--bg-dropdown); color: var(--text-primary); }

.form-control-sm { padding: 4px 8px; font-size: 13px; }

.form-group { margin-bottom: 1rem; }

/* ---------- BUTTONS ---------- */
.btn {
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  padding: 8px 18px;
  transition: all var(--transition);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-align: center;
  vertical-align: middle;
  user-select: none;
  line-height: 1.5;
  white-space: nowrap;
}

.btn-primary { background: var(--accent-blue); color: #fff; }
.btn-primary:hover { background: #3a7bf5; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79, 140, 255, 0.3); }

.btn-success { background: var(--accent-green); color: #fff; }
.btn-success:hover { background: #00a381; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0, 184, 148, 0.3); }

.btn-warning { background: #e67e22; color: #fff; }
.btn-warning:hover { background: #d35400; transform: translateY(-1px); }

.btn-danger { background: var(--accent-red); color: #fff; }
.btn-danger:hover { background: #d63031; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(225, 112, 85, 0.3); }

.btn-secondary { background: var(--border-color); color: var(--text-primary); }
.btn-secondary:hover { background: var(--border-light); transform: translateY(-1px); }

.btn-sm { padding: 4px 12px; font-size: 12px; }

.btn-block { display: flex; width: 100%; justify-content: center; }

/* ---------- BADGES ---------- */
.badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.02em;
}

.badge-success { background: rgba(0, 184, 148, 0.2); color: var(--accent-green); }
.badge-warning { background: rgba(253, 203, 110, 0.2); color: var(--accent-yellow); }
.badge-secondary { background: rgba(107, 114, 128, 0.2); color: var(--text-secondary); }
.badge-danger { background: rgba(225, 112, 85, 0.2); color: var(--accent-red); }
.badge-info { background: rgba(0, 206, 201, 0.2); color: var(--accent-cyan); }

/* ---------- PAGINATION ---------- */
.pagination { margin: 0; gap: 4px; }

.pagination .page-link {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--radius-sm) !important;
  padding: 6px 14px;
  font-size: 13px;
  transition: all var(--transition);
}

.pagination .page-link:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.pagination .page-item.active .page-link {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(79, 140, 255, 0.3);
}

.pagination .page-item.disabled .page-link {
  background: var(--bg-body);
  color: var(--text-muted);
  opacity: 0.5;
}

/* ---------- ALERTS ---------- */
.alert {
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 12px 18px;
  font-size: 14px;
}

.alert-success {
  background: rgba(0, 184, 148, 0.1);
  color: var(--accent-green);
  border-color: rgba(0, 184, 148, 0.2);
}

.alert .close {
  float: right;
  font-size: 20px;
  line-height: 1;
  color: inherit;
  opacity: 0.7;
  text-shadow: none;
  background: none;
  border: none;
  cursor: pointer;
}
.alert .close:hover { opacity: 1; }

/* ---------- LABELS ---------- */
label {
  display: inline-block;
  margin-bottom: 0.5rem;
}

/* ---------- ROW / COL (minimal Bootstrap grid) ---------- */
.row {
  display: flex;
  flex-wrap: wrap;
  margin-right: -15px;
  margin-left: -15px;
}
.col, .col-md-6, .col-md-12, .col-sm-6, .col-12 {
  position: relative;
  width: 100%;
  padding-right: 15px;
  padding-left: 15px;
}

/* ---------- TEXT ---------- */
.text-muted { color: var(--text-muted) !important; }
.text-success { color: var(--accent-green) !important; }
.text-warning { color: var(--accent-yellow) !important; }
.text-danger { color: var(--accent-red) !important; }
.text-info { color: var(--accent-cyan) !important; }
.text-primary { color: var(--accent-blue) !important; }

/* ---------- CHECKBOX ---------- */
input[type="checkbox"] {
  accent-color: var(--accent-blue);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ---------- CHARTS ---------- */
.charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 24px;
}

.charts-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.chart-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

/* ---------- LOGIN ---------- */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-body);
  padding: 20px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.login-card h2 {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--text-primary);
  text-align: center;
}

.login-card .subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 28px;
}

.login-card .form-group {
  margin-bottom: 18px;
}

.login-card label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.login-card .login-error {
  color: var(--accent-red);
  font-size: 13px;
  text-align: center;
  margin-bottom: 12px;
}

/* ---------- RESPONSIVE ---------- */
@media screen and (max-width: 992px) {
  .grid-container {
    grid-template-columns: 1fr;
    grid-template-rows: 64px 1fr;
    grid-template-areas:
      'header'
      'main';
  }

  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    transform: translateX(-100%);
    width: 280px;
  }

  .sidebar-responsive {
    transform: translateX(0) !important;
    box-shadow: 4px 0 30px rgba(0,0,0,0.5);
  }

  .menu-icon { display: inline; }

  .sidebar-title > span { display: inline; }

  .main-cards {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .charts { grid-template-columns: 1fr; }
}

@media screen and (max-width: 576px) {
  .main-container { padding: 16px; }
  .main-title h2 { font-size: 18px; }
  .table { font-size: 12px; }
  .table-bordered th,
  .table-bordered td { padding: 6px 8px; }
  .login-card { padding: 24px; }
}
