:root {
  --bg-color-light: #e9f9ff;
  --text-color-light: #333333;
  --bg-color-dark: #141f28;
  --text-color-dark: #ffffff;
  --accent-color: #2980b9;
  --accent-color-hover: #3498db;
  --sidebar-bg: #2c3e50;
  --sidebar-brand-bg: #233343;
  --sidebar-border: #34495e;
  --sidebar-hover-bg: #34495e;

  /* Additional styling variables */
  --card-bg-light: #d8ecf0;
  --card-bg-dark: #21384a;
  --border-color-light: #c7d5dc;
  --border-color-dark: #212e46;
  --tab-bg: #d2e3ea;
  --tab-bg-dark: #2a2a2a;
  --tab-active-bg: var(--bg-color-light);
  --tab-active-bg-dark: var(--card-bg-dark);
  --tab-border: #97b1c5;
  --tab-border-dark: #243644;
  --success-color: #28a745;
  --secondary-color: #6c757d;
  --transition-duration: 0.3s;
}

/* Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Body theme transitions */
body {
  font-family: 'Roboto', sans-serif;
  display: flex;
  min-height: 100vh;
  transition: background-color var(--transition-duration), color var(--transition-duration);
  line-height: 1.6;
}

body[data-theme="dark"] {
  background-color: var(--bg-color-dark);
  color: var(--text-color-dark);
}

body[data-theme="dark"] * {
  color: var(--text-color-dark);
}

body[data-theme="light"] {
  background-color: var(--bg-color-light);
  color: var(--text-color-light);
}

/* Sidebar */
.sidebar {
  width: 250px;
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  background-color: var(--sidebar-bg);
  color: #fff;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition-duration), color var(--transition-duration);
  z-index: 1000;
  overflow-y: auto;
}

.sidebar-brand {
  font-size: 1.75rem;
  padding: 1.25rem;
  text-align: center;
  background-color: var(--sidebar-brand-bg);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.sidebar ul {
  list-style: none;
  flex: 1;
}

.sidebar li {
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: #fff;
  padding: 1.25rem;
  text-decoration: none;
  transition: background-color var(--transition-duration);
}

.sidebar a i {
  width: 20px;
  text-align: center;
}

.sidebar a:hover,
.sidebar a.active {
  background-color: var(--sidebar-hover-bg);
}

/* Theme toggle container in sidebar */
.toggle-container {
  padding: 1.25rem;
  border-top: 1px solid var(--sidebar-border);
}

.theme-toggle {
  width: 100%;
  padding: 0.75rem;
  border: none;
  border-radius: 5px;
  background-color: var(--accent-color);
  color: #fff;
  cursor: pointer;
  transition: background-color var(--transition-duration);
  font-size: 0.9rem;
}

.theme-toggle:hover {
  background-color: var(--accent-color-hover);
}

/* Main content */
.main-content {
  flex: 1;
  padding: 2.5rem;
  transition: all var(--transition-duration);
  margin-left: 250px;
}

.main-content h1 {
  font-size: 2.2rem;
  margin-bottom: 1.5rem;
  color: var(--accent-color);
}

/* Billing Page Specific Styles */

/* Tab Menu */
.tab-menu {
  display: flex;
  border-bottom: 2px solid var(--border-color-light);
  margin-bottom: 2rem;
}

body[data-theme="dark"] .tab-menu {
  border-bottom-color: var(--border-color-dark);
}

.tab-button {
  padding: 0.8rem 1.5rem;
  cursor: pointer;
  border: none;
  background-color: transparent;
  font-size: 1rem;
  color: var(--text-color-light);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

body[data-theme="dark"] .tab-button {
  color: var(--text-color-dark);
}

.tab-button:hover {
  color: var(--accent-color);
}

.tab-button.active {
  color: var(--accent-color);
  border-bottom-color: var(--accent-color);
  font-weight: bold;
}

/* Tab Content */
.tab-content-container {
  margin-top: 1.5rem;
}

.tab-content {
  display: none;
  animation: fadeIn 0.5s;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Billing Section Styling */
.billing-section {
  background-color: var(--card-bg-light);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
  transition: all var(--transition-duration);
  margin-bottom: 2rem;
}

body[data-theme="dark"] .billing-section {
  background-color: var(--card-bg-dark);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.billing-section h2 {
  font-size: 1.5rem;
  margin-bottom: 1.25rem;
  color: var(--accent-color);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color-light);
}

body[data-theme="dark"] .billing-section h2 {
  border-bottom-color: var(--border-color-dark);
}

.billing-section p {
  margin-bottom: 1rem;
  font-size: 1rem;
}

.billing-section a {
  color: var(--accent-color);
  text-decoration: none;
}

.billing-section a:hover {
  text-decoration: underline;
}

/* Overview Tab Specifics */
.credit-balance {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.balance-container {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 2.2rem;
}

.balance-loading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.balance-spinner {
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-left-color: var(--accent-color);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 1s linear infinite;
}

body[data-theme="dark"] .balance-spinner {
  border-color: rgba(255, 255, 255, 0.2);
  border-left-color: var(--accent-color);
}

.balance-amount {
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--accent-color);
  margin: 0;
}

.add-credits-btn {
  padding: 0.6rem 1.2rem;
}

.auto-recharge {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background-color: rgba(0, 102, 204, 0.05);
  border-radius: 8px;
}

body[data-theme="dark"] .auto-recharge {
  background-color: rgba(0, 102, 204, 0.15);
}

.recharge-info {
  font-size: 0.9rem;
  color: #555;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
}

body[data-theme="dark"] .recharge-info {
  color: #ccc;
}

#recharge-toggle-btn {
  padding: 0.6rem 1.2rem;
}

.plan-management {
  margin-top: 1.5rem;
  border-top: 1px solid var(--border-color-light);
  padding-top: 1.5rem;
}

body[data-theme="dark"] .plan-management {
  border-top-color: var(--border-color-dark);
}

.cancel-plan-btn {
  background-color: #dc3545;
  color: white;
  padding: 0.6rem 1.2rem;
}

.cancel-plan-btn:hover {
  background-color: #c82333;
}

/* Payment Methods Tab Specifics */
.payment-method-list {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border: 1px solid var(--border-color-light);
  border-radius: 8px;
  margin-bottom: 1rem;
}

body[data-theme="dark"] .payment-method-list {
  border-color: var(--border-color-dark);
}

.add-payment-btn {
  padding: 0.6rem 1.2rem;
}

/* Billing History Table */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.5rem;
  font-size: 0.95rem;
}

th,
td {
  padding: 0.8rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color-light);
}

body[data-theme="dark"] th,
body[data-theme="dark"] td {
  border-bottom-color: var(--border-color-dark);
}

th {
  background-color: var(--card-bg-light);
  font-weight: bold;
}

body[data-theme="dark"] th {
  background-color: var(--card-bg-dark);
}

tbody tr:nth-child(even) {
  background-color: rgba(0, 0, 0, 0.02);
}

body[data-theme="dark"] tbody tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.05);
}

td a {
  font-weight: bold;
}

/* Credit Grants Tab Specifics */
.credit-balance-value,
.credit-total-value {
  font-weight: bold;
}

/* Preferences Tab Form */
#preferences-form .form-group {
  margin-bottom: 1.5rem;
}

#preferences-form label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: bold;
}

#preferences-form input[type="text"],
#preferences-form input[type="email"] {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color-light);
  border-radius: 5px;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

body[data-theme="dark"] #preferences-form input[type="text"],
body[data-theme="dark"] #preferences-form input[type="email"] {
  background-color: #444;
  border-color: #555;
  color: var(--text-color-dark);
}

#preferences-form small {
  display: block;
  font-size: 0.85rem;
  color: #666;
}

body[data-theme="dark"] #preferences-form small {
  color: #bbb;
}

#preferences-form button[type="submit"] {
  padding: 0.8rem 1.5rem;
  margin-top: 1rem;
}

/* General Button Styling */
button {
  background-color: var(--accent-color);
  color: #fff;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color var(--transition-duration);
  font-size: 1rem;
}

button:hover {
  background-color: var(--accent-color-hover);
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

/* Widget Styling */
.widget {
  background-color: var(--card-bg-light);
  border-radius: 15px;
  padding: 2.5rem;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  transition: all var(--transition-duration);
  position: relative;
  overflow: hidden;
}

body[data-theme="dark"] .widget {
  background-color: var(--card-bg-dark);
  box-shadow: 0 7px 20px rgba(0, 0, 0, 0.2);
}

.widget::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background: linear-gradient(to right, var(--accent-color), transparent);
  opacity: 0;
  transition: opacity var(--transition-duration);
}

.widget:hover::before {
  opacity: 1;
}

.widget h2 {
  font-size: 1.5rem;
  margin-bottom: 1.25rem;
  color: var(--accent-color);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color-light);
}

body[data-theme="dark"] .widget h2 {
  border-bottom-color: var(--border-color-dark);
}

.widget p {
  margin-bottom: 1rem;
  font-size: 1rem;
}

.widget a {
  color: var(--accent-color);
  text-decoration: none;
}

.widget a:hover {
  text-decoration: underline;
}

/* Add Credits Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background-color: var(--card-bg-light);
  margin: 5% auto;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  position: relative;
  animation: slideIn 0.3s ease;
}

body[data-theme="dark"] .modal-content {
  background-color: var(--card-bg-dark);
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-color-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

body[data-theme="dark"] .modal-header {
  border-bottom-color: var(--border-color-dark);
}

.modal-header h2 {
  margin: 0;
  color: var(--accent-color);
}

.close {
  font-size: 2rem;
  font-weight: bold;
  line-height: 1;
  cursor: pointer;
  color: var(--text-color-light);
  opacity: 0.5;
  transition: opacity 0.2s;
}

body[data-theme="dark"] .close {
  color: var(--text-color-dark);
}

.close:hover {
  opacity: 1;
}

.modal-body {
  padding: 2rem;
}

.modal-footer {
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--border-color-light);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

body[data-theme="dark"] .modal-footer {
  border-top-color: var(--border-color-dark);
}

/* Current Balance Section */
.current-balance-section {
  text-align: center;
  margin-bottom: 2rem;
  padding: 1rem;
  background-color: rgba(0, 102, 204, 0.05);
  border-radius: 8px;
}

body[data-theme="dark"] .current-balance-section {
  background-color: rgba(0, 102, 204, 0.15);
}

.current-balance-section p {
  margin: 0;
  font-size: 0.9rem;
  color: #666;
}

body[data-theme="dark"] .current-balance-section p {
  color: #aaa;
}

.current-balance-section h3 {
  margin: 0.5rem 0 0 0;
  font-size: 2rem;
  color: var(--accent-color);
}

/* Amount Selection */
.amount-selection {
  margin-bottom: 2rem;
}

.amount-selection>p {
  font-weight: bold;
  margin-bottom: 1rem;
}

.preset-amounts {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  justify-content: center;
}

.preset-amount {
  flex: 1;
  padding: 1rem;
  border: 2px solid var(--border-color-light);
  background-color: transparent;
  color: var(--text-color-light);
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}

body[data-theme="dark"] .preset-amount {
  border-color: var(--border-color-dark);
  color: var(--text-color-dark);
}

.preset-amount:hover {
  border-color: var(--accent-color);
  transform: translateY(-2px);
}

.preset-amount.selected {
  background-color: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
}

/* Custom Amount */
.custom-amount-section {
  text-align: center;
}

.custom-amount-section p {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.custom-amount-input {
  display: flex;
  align-items: center;
  max-width: 280px;
  margin: 0 auto;
  border: 2px solid var(--border-color-light);
  border-radius: 8px;
  overflow: visible;
  background-color: var(--bg-color-light);
}

body[data-theme="dark"] .custom-amount-input {
  border-color: var(--border-color-dark);
  background-color: #444;
}

.currency-symbol {
  padding: 0.75rem 1rem;
  background-color: rgba(0, 102, 204, 0.1);
  border-right: 1px solid var(--border-color-light);
  font-weight: bold;
}

body[data-theme="dark"] .currency-symbol {
  border-right-color: var(--border-color-dark);
}

#custom-amount {
  flex: 1;
  padding: 0.75rem;
  border: none;
  background: transparent;
  font-size: 1.1rem;
  text-align: right;
  outline: none;
  color: var(--text-color-light);
}

body[data-theme="dark"] #custom-amount {
  color: var(--text-color-dark);
}

/* Payment Method */
.payment-method-section {
  margin-bottom: 2rem;
}

.payment-method-section p {
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.payment-method {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border-color-light);
  border-radius: 8px;
  background-color: rgba(0, 0, 0, 0.02);
}

body[data-theme="dark"] .payment-method {
  border-color: var(--border-color-dark);
  background-color: rgba(255, 255, 255, 0.05);
}

.payment-method i {
  font-size: 1.5rem;
  color: var(--accent-color);
}

/* Selected Amount Summary */
.selected-amount-summary {
  text-align: center;
  padding: 1rem;
  background-color: rgba(0, 102, 204, 0.05);
  border-radius: 8px;
}

body[data-theme="dark"] .selected-amount-summary {
  background-color: rgba(0, 102, 204, 0.15);
}

.selected-amount-summary p {
  margin: 0;
  font-size: 0.9rem;
}

.selected-amount-summary h3 {
  margin: 0.5rem 0 0 0;
  font-size: 1.5rem;
  color: var(--accent-color);
}

/* Modal Buttons */
.cancel-btn {
  background-color: #6c757d;
  padding: 0.75rem 1.5rem;
}

.cancel-btn:hover {
  background-color: #5a6268;
}

.process-btn {
  background-color: var(--accent-color);
  padding: 0.75rem 1.5rem;
  flex: 1;
}

.process-btn:hover:not(:disabled) {
  background-color: var(--accent-color-hover);
}

.process-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Payment Loading */
.payment-loading {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

body[data-theme="dark"] .payment-loading {
  background-color: rgba(30, 30, 30, 0.95);
}

.payment-loading.show {
  display: flex;
}

.spinner {
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-left-color: var(--accent-color);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.payment-loading p {
  margin-top: 1rem;
  font-size: 1.1rem;
  color: var(--text-color-light);
}

body[data-theme="dark"] .payment-loading p {
  color: var(--text-color-dark);
}

/* Payment Success */
.payment-success {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

body[data-theme="dark"] .payment-success {
  background-color: rgba(30, 30, 30, 0.95);
}

.payment-success.show {
  display: flex;
}

.success-checkmark {
  font-size: 4rem;
  color: var(--success-color);
  animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
  from {
    transform: scale(0);
  }

  to {
    transform: scale(1);
  }
}

.payment-success p {
  margin-top: 1rem;
  font-size: 1.2rem;
  font-weight: bold;
}

.success-details {
  font-size: 1rem !important;
  font-weight: normal !important;
  color: #666;
}

body[data-theme="dark"] .success-details {
  color: #aaa;
}

/* Funds Alert Section */
.funds-alert-section {
  margin-bottom: 2rem;
}

.funds-alert-container {
  padding: 1.5rem;
  background-color: rgba(0, 102, 204, 0.03);
  border-radius: 8px;
}

body[data-theme="dark"] .funds-alert-container {
  background-color: rgba(0, 102, 204, 0.08);
}

.alert-settings {
  margin-bottom: 1.5rem;
}

.alert-toggle-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* Toggle Switch Styles */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 34px;
}

body[data-theme="dark"] .toggle-slider {
  background-color: #555;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.toggle-switch input:checked+.toggle-slider {
  background-color: var(--accent-color);
}

.toggle-switch input:checked+.toggle-slider:before {
  transform: translateX(24px);
}

.toggle-label {
  font-weight: 500;
  font-size: 1rem;
}

/* Threshold Input Row */
.threshold-input-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.threshold-input-row label {
  font-weight: 500;
  min-width: 120px;
}

.threshold-input-container {
  display: flex;
  align-items: center;
  border: 2px solid var(--border-color-light);
  border-radius: 8px;
  background-color: var(--bg-color-light);
  overflow: hidden;
  max-width: 200px;
}

body[data-theme="dark"] .threshold-input-container {
  border-color: var(--border-color-dark);
  background-color: #444;
}

.threshold-input-container .currency-symbol {
  padding: 0.6rem 0.8rem;
  background-color: rgba(0, 102, 204, 0.1);
  border-right: 1px solid var(--border-color-light);
  font-weight: bold;
}

body[data-theme="dark"] .threshold-input-container .currency-symbol {
  border-right-color: var(--border-color-dark);
}

#funds-alert-threshold {
  flex: 1;
  padding: 0.6rem;
  border: none;
  background: transparent;
  font-size: 1rem;
  text-align: right;
  outline: none;
  color: var(--text-color-light);
  min-width: 100px;
}

body[data-theme="dark"] #funds-alert-threshold {
  color: var(--text-color-dark);
}

.save-threshold-btn {
  padding: 0.6rem 1.2rem;
  background-color: var(--success-color);
  font-size: 0.9rem;
}

.save-threshold-btn:hover {
  background-color: #218838;
}

.save-threshold-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Alert Status Container */
.alert-status {
  padding: 1rem;
  background-color: rgba(0, 0, 0, 0.02);
  border-radius: 8px;
  border-left: 4px solid var(--accent-color);
}

body[data-theme="dark"] .alert-status {
  background-color: rgba(255, 255, 255, 0.05);
}

.status-item {
  display: flex;
  align-items: center;
  margin-bottom: 0.75rem;
}

.status-item:last-child {
  margin-bottom: 0;
}

.status-label {
  font-weight: 500;
  min-width: 180px;
  color: #666;
  font-size: 0.95rem;
}

body[data-theme="dark"] .status-label {
  color: #aaa;
}

.status-value {
  font-weight: 400;
  color: var(--text-color-light);
  font-size: 0.95rem;
}

body[data-theme="dark"] .status-value {
  color: var(--text-color-dark);
}

/* Status value colors */
.status-value.status-active {
  color: var(--success-color);
  font-weight: 500;
}

.status-value.status-warning {
  color: #ff9800;
  font-weight: 500;
}

.status-value.status-danger {
  color: #dc3545;
  font-weight: 500;
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background-color: #333;
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(100%);
  transition: all 0.3s ease;
  z-index: 3000;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  background-color: var(--success-color);
}

.toast.error {
  background-color: #dc3545;
}

.toast.info {
  background-color: var(--accent-color);
}

/* API Usage Page Styles */
.usage-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background-color: var(--card-bg-light);
  border-radius: 12px;
  align-items: end;
}

body[data-theme="dark"] .usage-filters {
  background-color: var(--card-bg-dark);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 150px;
}

.filter-group label {
  font-weight: bold;
  font-size: 0.9rem;
}

.filter-group select,
.filter-group input[type="date"] {
  padding: 0.5rem;
  border: 1px solid var(--border-color-light);
  border-radius: 6px;
  background-color: var(--bg-color-light);
  color: var(--text-color-light);
  font-size: 0.9rem;
}

body[data-theme="dark"] .filter-group select,
body[data-theme="dark"] .filter-group input[type="date"] {
  border-color: var(--border-color-dark);
  background-color: #444;
  color: var(--text-color-dark);
}

.export-btn {
  background-color: var(--secondary-color);
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.export-btn:hover {
  background-color: #5a6268;
}

/* Responsive */
@media screen and (max-width: 768px) {
  body {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    height: auto;
    /* Adjust height for horizontal layout */
    position: static;
    /* Override fixed position on small screens */
  }

  .sidebar-brand {
    display: none;
    /* Hide brand on small screens */
  }

  .sidebar ul {
    display: flex;
    flex-direction: row;
    flex: 1;
    /* Allow items to take space */
  }

  .sidebar li {
    border-bottom: none;
    border-right: 1px solid var(--sidebar-border);
  }

  .sidebar li:last-child {
    border-right: none;
  }

  .sidebar a {
    padding: 1rem 0.8rem;
    /* Adjust padding */
    white-space: nowrap;
    justify-content: center;
    /* Center icon and text */
  }

  .sidebar a i {
    margin-right: 0.4rem;
    /* Smaller gap on mobile */
  }

  .toggle-container {
    border-top: none;
    border-left: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    /* Adjust padding */
  }

  .theme-toggle {
    width: auto;
    white-space: nowrap;
    padding: 0.5rem 0.8rem;
  }

  .main-content {
    padding: 1.5rem;
    /* Reduce padding */
    margin-left: 0;
    /* Remove margin on small screens */
  }

  .main-content h1 {
    font-size: 1.8rem;
  }

  .tab-menu {
    overflow-x: auto;
    /* Allow horizontal scrolling for tabs */
    white-space: nowrap;
  }

  .tab-button {
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
  }

  .billing-section {
    padding: 1.5rem;
  }

  .billing-section h2 {
    font-size: 1.3rem;
  }

  table {
    font-size: 0.9rem;
  }

  th,
  td {
    padding: 0.6rem 0.8rem;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    /* Stack widgets on small screens */
  }

  .widget {
    padding: 1.5rem;
  }

  .widget h2 {
    font-size: 1.2rem;
  }

  /* Modal responsiveness */
  .modal-content {
    width: 95%;
    margin: 2% auto;
  }

  .modal-header {
    padding: 1rem 1.5rem;
  }

  .modal-body {
    padding: 1.5rem;
  }

  .modal-footer {
    padding: 1rem 1.5rem;
    flex-direction: column;
  }

  .preset-amounts {
    flex-direction: column;
    gap: 0.5rem;
  }

  .custom-amount-input {
    max-width: 100%;
  }

  /* Usage filters responsiveness */
  .usage-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-group {
    min-width: auto;
    width: 100%;
  }

  /* Toast positioning */
  .toast {
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
    right: auto;
    width: auto;
  }

  /* API Docs responsiveness */
  .code-block-wrapper pre {
    padding: 1rem;
    padding-top: 2rem;
    font-size: 0.85rem;
  }

  .param-list {
    padding-left: 0;
  }

  .param-list>li {
    padding-left: 0.5rem;
    margin-bottom: 1rem;
  }

  /* Payment method responsiveness */
  .payment-method {
    flex-direction: column;
    text-align: center;
    gap: 0.5rem;
  }

  .payment-method-list {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }

  /* Credit balance adjustments */
  .credit-balance {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .balance-amount {
    font-size: 1.5rem;
  }

  /* Auto recharge section */
  .auto-recharge {
    padding: 0.75rem;
  }

  /* Form adjustments */
  #preferences-form input[type="text"],
  #preferences-form input[type="email"] {
    font-size: 16px;
    /* Prevent zoom on iOS */
  }

  /* Button adjustments */
  button {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
  }

  .add-credits-btn,
  #recharge-toggle-btn,
  .cancel-plan-btn,
  .add-payment-btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
  }

  /* Enhanced table responsiveness */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    border: 1px solid var(--border-color-light);
  }

  body[data-theme="dark"] .table-container {
    border-color: var(--border-color-dark);
  }

  .table-container table {
    margin-top: 0;
    min-width: 600px;
    /* Ensure table doesn't get too compressed */
  }

  /* Reduce table text size further on mobile */
  table {
    font-size: 0.8rem;
  }

  th,
  td {
    padding: 0.5rem 0.6rem;
    white-space: nowrap;
  }

  /* Hide less critical columns on very small screens */
  @media screen and (max-width: 480px) {
    .hide-on-mobile {
      display: none;
    }

    table {
      font-size: 0.75rem;
    }

    th,
    td {
      padding: 0.4rem 0.5rem;
    }

    .button-small {
      padding: 0.25rem 0.5rem;
      font-size: 0.7rem;
    }
  }

  /* Better mobile button spacing in table cells */
  td .button-small {
    margin: 0 0.2rem 0.2rem 0;
  }

  /* Ensure action buttons don't break layout */
  td:last-child {
    min-width: 100px;
  }
}