/**
 * KBilling Modern Cloud SaaS Theme Stylesheet
 * Matching View 4 of modern_saas_showcase.html
 * 
 * Clean slate/charcoal elevated surfaces, rounded-2xl cards (border-radius: 1rem),
 * subtle border hairlines, Plus Jakarta Sans typography, and pulsing status badges.
 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --saas-bg: #030712;
  --saas-surface: #0f172a;
  --saas-surface-elevated: rgba(15, 23, 42, 0.75);
  --saas-surface-subtle: #1e293b;
  --saas-surface-hover: rgba(30, 41, 59, 0.85);
  --saas-border: rgba(51, 65, 85, 0.65);
  --saas-border-light: rgba(148, 163, 184, 0.12);
  --saas-text-primary: #f8fafc;
  --saas-text-secondary: #cbd5e1;
  --saas-text-muted: #94a3b8;
  --saas-text-subtle: #64748b;
  --saas-accent: #6366f1;
  --saas-accent-hover: #4f46e5;
  --saas-accent-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  --saas-emerald: #10b981;
  --saas-amber: #f59e0b;
  --saas-rose: #f43f5e;
  --saas-radius-lg: 1rem;
  --saas-radius-md: 0.75rem;
  --saas-radius-sm: 0.5rem;
}

/* Base Body & Reset */
html, body {
  background-color: var(--saas-bg) !important;
  color: var(--saas-text-secondary) !important;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

.font-mono, code, kbd, pre, samp {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
}

/* Custom Sleek Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.45);
}

/* Pulsing Status Dot Animation */
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.85); }
}

.animate-pulse-dot {
  animation: pulse-dot 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Modern Card Surfaces (rounded-2xl) */
.saas-card,
.card,
.whmcs-panel,
.whmcs-tile-card {
  background-color: var(--saas-surface-elevated) !important;
  border: 1px solid var(--saas-border) !important;
  border-radius: var(--saas-radius-lg) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.35);
  color: var(--saas-text-secondary) !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.saas-card:hover,
.card:hover,
.whmcs-tile-card:hover {
  border-color: rgba(99, 102, 241, 0.4) !important;
}

/* Elevated Sub-surfaces & Insets */
.saas-inset,
.bg-slate-800\/30,
.bg-slate-800\/40,
.bg-slate-800\/50,
.bg-slate-800\/60,
.bg-slate-800\/70,
.bg-slate-800\/80,
.bg-slate-800 {
  background-color: rgba(30, 41, 59, 0.55) !important;
  border: 1px solid rgba(51, 65, 85, 0.5) !important;
  border-radius: var(--saas-radius-md);
}

.bg-slate-900,
.bg-slate-900\/60,
.bg-slate-900\/70,
.bg-slate-900\/80 {
  background-color: rgba(15, 23, 42, 0.8) !important;
}

.bg-slate-950 {
  background-color: #030712 !important;
}

.border-slate-800,
.border-slate-800\/80,
.border-slate-700,
.border-slate-700\/50,
.border-slate-700\/60,
.border-slate-700\/80 {
  border-color: var(--saas-border) !important;
}

.rounded-2xl {
  border-radius: 1rem !important;
}

.rounded-xl {
  border-radius: 0.75rem !important;
}

/* Text Colors */
.text-white { color: #ffffff !important; }
.text-slate-100 { color: #f1f5f9 !important; }
.text-slate-200 { color: #e2e8f0 !important; }
.text-slate-300 { color: #cbd5e1 !important; }
.text-slate-400 { color: #94a3b8 !important; }
.text-slate-500 { color: #64748b !important; }
.text-muted { color: #94a3b8 !important; }
.text-dark { color: #f8fafc !important; }

/* Status Badges */
.badge,
.saas-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-weight: 600;
  font-size: 0.75rem;
  line-height: 1;
  padding: 0.35rem 0.65rem;
  border-radius: 9999px;
  border: 1px solid transparent;
}

.badge-success,
.bg-success,
.bg-success-subtle,
.badge-emerald,
.bg-emerald-500\/10 {
  background-color: rgba(16, 185, 129, 0.12) !important;
  color: #34d399 !important;
  border: 1px solid rgba(16, 185, 129, 0.28) !important;
}

.badge-primary,
.bg-primary,
.bg-primary-subtle,
.badge-indigo,
.bg-indigo-500\/10 {
  background-color: rgba(99, 102, 241, 0.12) !important;
  color: #818cf8 !important;
  border: 1px solid rgba(99, 102, 241, 0.28) !important;
}

.badge-warning,
.bg-warning,
.bg-warning-subtle,
.badge-amber,
.bg-amber-500\/10 {
  background-color: rgba(245, 158, 11, 0.12) !important;
  color: #fbbf24 !important;
  border: 1px solid rgba(245, 158, 11, 0.28) !important;
}

.badge-danger,
.bg-danger,
.bg-danger-subtle,
.badge-rose,
.bg-rose-500\/10 {
  background-color: rgba(244, 63, 94, 0.12) !important;
  color: #fb7185 !important;
  border: 1px solid rgba(244, 63, 94, 0.28) !important;
}

.badge-secondary,
.bg-secondary,
.bg-secondary-subtle,
.bg-slate-500\/10 {
  background-color: rgba(148, 163, 184, 0.12) !important;
  color: #94a3b8 !important;
  border: 1px solid rgba(148, 163, 184, 0.25) !important;
}

.badge-info,
.bg-info,
.bg-info-subtle,
.bg-cyan-500\/10 {
  background-color: rgba(6, 182, 212, 0.12) !important;
  color: #22d3ee !important;
  border: 1px solid rgba(6, 182, 212, 0.25) !important;
}

/* Modern Buttons */
.btn {
  border-radius: var(--saas-radius-md) !important;
  font-weight: 600 !important;
  font-size: 0.875rem !important;
  padding: 0.55rem 1.15rem;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  text-decoration: none;
}

.btn-primary,
.btn-saas-primary {
  background: var(--saas-accent-gradient) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35) !important;
}

.btn-primary:hover,
.btn-saas-primary:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%) !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.45) !important;
  color: #ffffff !important;
}

.btn-outline-primary {
  background: transparent !important;
  color: #818cf8 !important;
  border: 1px solid rgba(99, 102, 241, 0.5) !important;
}

.btn-outline-primary:hover {
  background: rgba(99, 102, 241, 0.15) !important;
  color: #ffffff !important;
  border-color: #6366f1 !important;
}

.btn-secondary,
.btn-outline-secondary,
.btn-slate {
  background-color: var(--saas-surface-subtle) !important;
  color: var(--saas-text-secondary) !important;
  border: 1px solid var(--saas-border) !important;
}

.btn-secondary:hover,
.btn-outline-secondary:hover,
.btn-slate:hover {
  background-color: var(--saas-surface-hover) !important;
  color: #ffffff !important;
  border-color: rgba(148, 163, 184, 0.4) !important;
}

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3) !important;
}

.btn-success:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
}

.btn-sm {
  padding: 0.35rem 0.75rem !important;
  font-size: 0.785rem !important;
  border-radius: var(--saas-radius-sm) !important;
}

.btn-lg {
  padding: 0.75rem 1.5rem !important;
  font-size: 1rem !important;
  border-radius: var(--saas-radius-md) !important;
}

/* Modern Form Inputs & Selects */
.form-control,
.form-select {
  background-color: rgba(30, 41, 59, 0.75) !important;
  border: 1px solid var(--saas-border) !important;
  border-radius: var(--saas-radius-md) !important;
  color: #f8fafc !important;
  padding: 0.625rem 0.875rem !important;
  font-size: 0.875rem !important;
  transition: all 0.2s ease;
}

.form-control:focus,
.form-select:focus {
  background-color: rgba(30, 41, 59, 0.95) !important;
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25) !important;
  color: #ffffff !important;
  outline: none !important;
}

.form-control::placeholder {
  color: #64748b !important;
}

.form-select option {
  background-color: #0f172a !important;
  color: #f8fafc !important;
}

.input-group-text {
  background-color: rgba(30, 41, 59, 0.9) !important;
  border: 1px solid var(--saas-border) !important;
  color: #94a3b8 !important;
}

.form-label {
  color: #cbd5e1 !important;
  font-weight: 600;
  font-size: 0.8125rem;
  margin-bottom: 0.375rem;
}

.form-text {
  color: #64748b !important;
}

.form-check-input {
  background-color: rgba(30, 41, 59, 0.8) !important;
  border-color: rgba(148, 163, 184, 0.3) !important;
}

.form-check-input:checked {
  background-color: #6366f1 !important;
  border-color: #6366f1 !important;
}

/* Modern Tables */
.table,
.whmcs-table {
  color: var(--saas-text-secondary) !important;
  border-color: rgba(51, 65, 85, 0.5) !important;
  vertical-align: middle;
}

.table thead th,
.whmcs-table thead th {
  background-color: rgba(30, 41, 59, 0.5) !important;
  color: #94a3b8 !important;
  font-size: 0.75rem !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.875rem 1rem !important;
  border-bottom: 1px solid var(--saas-border) !important;
}

.table tbody td,
.whmcs-table tbody td {
  background-color: transparent !important;
  color: var(--saas-text-secondary) !important;
  padding: 1rem !important;
  border-bottom: 1px solid rgba(51, 65, 85, 0.4) !important;
}

.table tbody tr:hover td,
.whmcs-table tbody tr:hover td {
  background-color: rgba(30, 41, 59, 0.35) !important;
}

/* Modern Dropdown Menus */
.dropdown-menu {
  background-color: #0f172a !important;
  border: 1px solid var(--saas-border) !important;
  border-radius: var(--saas-radius-lg) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
  padding: 0.5rem !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.dropdown-item {
  color: #cbd5e1 !important;
  border-radius: var(--saas-radius-sm) !important;
  padding: 0.5rem 0.75rem !important;
  font-size: 0.8125rem !important;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background-color: rgba(99, 102, 241, 0.15) !important;
  color: #ffffff !important;
}

.dropdown-header {
  color: #64748b !important;
  font-size: 0.6875rem !important;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.5rem 0.75rem 0.25rem !important;
}

.dropdown-divider {
  border-top: 1px solid rgba(51, 65, 85, 0.6) !important;
  margin: 0.35rem 0 !important;
}

/* Modern Alerts */
.alert {
  border-radius: var(--saas-radius-md) !important;
  border: 1px solid transparent !important;
  backdrop-filter: blur(10px);
}

.alert-success {
  background-color: rgba(16, 185, 129, 0.12) !important;
  color: #34d399 !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
}

.alert-danger {
  background-color: rgba(244, 63, 94, 0.12) !important;
  color: #fb7185 !important;
  border-color: rgba(244, 63, 94, 0.3) !important;
}

.alert-warning {
  background-color: rgba(245, 158, 11, 0.12) !important;
  color: #fbbf24 !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
}

/* Modern List Groups & Modals */
.list-group {
  background-color: transparent !important;
  border-radius: var(--saas-radius-md) !important;
}

.list-group-item {
  background-color: rgba(30, 41, 59, 0.4) !important;
  border: 1px solid var(--saas-border) !important;
  color: var(--saas-text-secondary) !important;
  font-size: 0.8125rem;
  padding: 0.75rem 1rem;
}

.list-group-item:hover,
.list-group-item-action:hover {
  background-color: rgba(30, 41, 59, 0.7) !important;
  color: #ffffff !important;
}

.list-group-item.active {
  background-color: #6366f1 !important;
  border-color: #6366f1 !important;
  color: #ffffff !important;
}

.modal-content {
  background-color: #0f172a !important;
  border: 1px solid var(--saas-border) !important;
  border-radius: var(--saas-radius-lg) !important;
  color: var(--saas-text-secondary) !important;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6) !important;
}

.alert-info {
  background-color: rgba(99, 102, 241, 0.12) !important;
  color: #818cf8 !important;
  border-color: rgba(99, 102, 241, 0.3) !important;
}

/* Modern Navigation Bars */
.saas-header {
  position: sticky;
  top: 0;
  z-index: 1040;
  background-color: rgba(15, 23, 42, 0.85) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--saas-border);
  padding: 0.75rem 0;
}

.saas-nav-link {
  color: #94a3b8 !important;
  font-weight: 600;
  font-size: 0.8125rem;
  padding: 0.5rem 0.85rem !important;
  border-radius: var(--saas-radius-md);
  text-decoration: none;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.saas-nav-link:hover {
  color: #ffffff !important;
  background-color: rgba(30, 41, 59, 0.6);
}

.saas-nav-link.active {
  color: #ffffff !important;
  background-color: #6366f1 !important;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* User Avatar Pill */
.user-avatar-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  background-color: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--saas-border);
  color: #f1f5f9;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.8125rem;
  transition: all 0.2s ease;
}

.user-avatar-pill:hover {
  background-color: rgba(51, 65, 85, 0.8);
  color: #ffffff;
}

.user-avatar-circle {
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Modern Tab Switcher Pill Container */
.saas-tab-switcher {
  display: inline-flex;
  background-color: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--saas-border);
  border-radius: var(--saas-radius-md);
  padding: 0.25rem;
  gap: 0.25rem;
}

.saas-tab-btn {
  padding: 0.4rem 0.875rem;
  font-size: 0.785rem;
  font-weight: 600;
  border-radius: var(--saas-radius-sm);
  color: #94a3b8;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.saas-tab-btn.active,
.saas-tab-btn:hover {
  color: #ffffff;
}

.saas-tab-btn.active {
  background-color: #6366f1;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

/* Breadcrumb Component */
.saas-breadcrumb-bar {
  background-color: rgba(15, 23, 42, 0.4);
  border-bottom: 1px solid rgba(51, 65, 85, 0.4);
  padding: 0.6rem 0;
  font-size: 0.785rem;
}

.breadcrumb-item a {
  color: #94a3b8;
  text-decoration: none;
}

.breadcrumb-item a:hover {
  color: #818cf8;
}

.breadcrumb-item.active {
  color: #f1f5f9;
  font-weight: 600;
}

.breadcrumb-item + .breadcrumb-item::before {
  color: #64748b;
}

/* Modern Footer */
.saas-footer {
  background-color: #030712;
  border-top: 1px solid var(--saas-border);
  color: #94a3b8;
  font-size: 0.8125rem;
  padding: 3rem 0 1.5rem;
  margin-top: auto;
}

.saas-footer a {
  color: #94a3b8;
  text-decoration: none;
  transition: color 0.15s ease;
}

.saas-footer a:hover {
  color: #ffffff;
}

.saas-footer h6 {
  color: #ffffff;
  font-weight: 700;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.saas-footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.saas-footer ul li {
  margin-bottom: 0.5rem;
}

.saas-sub-footer {
  border-top: 1px solid rgba(51, 65, 85, 0.5);
  margin-top: 2rem;
  padding-top: 1.5rem;
}

/* WHMCS Panels backward-compatibility mapped to Modern SaaS */
.whmcs-topbar {
  display: none !important;
}

.whmcs-panel-header {
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--saas-border);
  font-weight: 700;
  font-size: 0.95rem;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.whmcs-panel-body {
  padding: 1.5rem;
}

.whmcs-info-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.whmcs-info-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(51, 65, 85, 0.4);
  font-size: 0.8125rem;
}

.whmcs-info-list li:last-child {
  border-bottom: none;
}

.whmcs-info-list .info-label {
  color: #94a3b8;
}

.whmcs-info-list .info-value {
  color: #f1f5f9;
  font-weight: 600;
}

.whmcs-action-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--saas-radius-md);
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.whmcs-action-item:hover {
  background-color: rgba(30, 41, 59, 0.7);
  color: #ffffff;
}

.whmcs-action-item i {
  width: 2rem;
  height: 2rem;
  border-radius: var(--saas-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

/* Service Details Shortcut Grid */
.cpanel-shortcut-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.25rem 0.875rem;
  border-radius: var(--saas-radius-lg);
  background-color: rgba(30, 41, 59, 0.45);
  border: 1px solid var(--saas-border);
  color: #cbd5e1;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  height: 100%;
}

.cpanel-shortcut-card:hover {
  background-color: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.5);
  transform: translateY(-2px);
  color: #ffffff;
  box-shadow: 0 8px 20px -4px rgba(99, 102, 241, 0.25);
}

.cpanel-shortcut-icon {
  width: 3rem;
  height: 3rem;
  border-radius: var(--saas-radius-md);
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  margin-bottom: 0.75rem;
  border: 1px solid rgba(99, 102, 241, 0.25);
  transition: all 0.2s ease;
}

.cpanel-shortcut-card:hover .cpanel-shortcut-icon {
  background: #6366f1;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.cpanel-shortcut-title {
  font-weight: 700;
  font-size: 0.875rem;
  color: #ffffff;
  margin-bottom: 0.25rem;
}

.cpanel-shortcut-desc {
  font-size: 0.725rem;
  color: #94a3b8;
}

/* Cart Badge & Counter */
.saas-cart-badge {
  background-color: #10b981;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  line-height: 1;
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
  .saas-nav-links {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--saas-border);
  }
}
