/* ===== Design System - Cloud Dashboard ===== */

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

* {
  box-sizing: border-box;
}

.no-scrollbar { scrollbar-width: none; -ms-overflow-style: none; }
.no-scrollbar::-webkit-scrollbar { display: none; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #F8FAFC !important;
}

/* ===== Content cards shadow ===== */
.shadow-sm {
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 2px 8px 0 rgba(0, 0, 0, 0.04) !important;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Sidebar scrollbar */
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }

/* ===== Config Slider ===== */
.cfg-slider-wrap {
  padding: 16px 16px 12px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.cfg-slider-wrap:hover {
  border-color: #d1d5db;
}
.cfg-slider-wrap:has(.cfg-slider:active) {
  border-color: #111827;
  box-shadow: 0 0 0 3px rgba(17,24,39,0.06);
}
.cfg-slider-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cfg-slider {
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  height: 6px;
  border-radius: 9999px;
  margin: 4px 0;
}
.cfg-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #111827;
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.04);
  cursor: grab;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.cfg-slider::-webkit-slider-thumb:hover {
  transform: scale(1.12);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25), 0 0 0 1px rgba(0,0,0,0.06);
}
.cfg-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.0);
  box-shadow: 0 0 0 5px rgba(17,24,39,0.1), 0 2px 6px rgba(0,0,0,0.18);
}
.cfg-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #111827;
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.04);
  cursor: grab;
}
.cfg-slider::-moz-range-thumb:active {
  cursor: grabbing;
}
.cfg-slider::-moz-range-track {
  height: 6px;
  border-radius: 9999px;
  background: transparent;
}
.cfg-slider-value {
  font-variant-numeric: tabular-nums;
  transition: color 0.15s ease;
}
.cfg-slider-subtotal {
  font-variant-numeric: tabular-nums;
}

/* ===== Order Sidebar ===== */
.order-sidebar-inner {
  box-shadow: 0 8px 32px rgba(0,0,0,0.25), 0 2px 8px rgba(0,0,0,0.15);
}
#sidebar-total {
  font-variant-numeric: tabular-nums;
}
#sidebar-monthly {
  font-variant-numeric: tabular-nums;
}

/* ===== Loading Spinner ===== */
.spinner {
  border: 2px solid #e5e7eb;
  border-top: 2px solid #9ca3af;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: spin 0.7s linear infinite;
  margin: 0 auto;
}

.spinner-small {
  border: 2px solid #e5e7eb;
  border-top: 2px solid #9ca3af;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ===== Skeleton Loading ===== */
.sk {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: 8px;
}
.hidden .sk, .hidden.sk {
  animation: none;
}

@keyframes skeleton-pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== Form Elements ===== */
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.08);
}

input, select, textarea {
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* ===== Transitions ===== */
a, button {
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

/* ===== Toggle Switch ===== */
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}

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

.toggle-slider {
  position: absolute;
  inset: 0;
  background-color: #d1d5db;
  border-radius: 9999px;
  transition: background-color 0.25s ease, box-shadow 0.25s ease;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #fff;
  border-radius: 50%;
  transition: transform 0.25s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: #22c55e;
}

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

.toggle-switch input:focus-visible + .toggle-slider {
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
}

.toggle-switch.toggle-danger input:checked + .toggle-slider {
  background-color: #ef4444;
}

.toggle-switch.toggle-danger input:focus-visible + .toggle-slider {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25);
}

/* ===== Layout with Sidebar ===== */
@media (min-width: 1024px) {
  body:has(#sidebar) {
    padding-left: 16rem;
  }
}

@media (max-width: 1023px) {
  #page-content {
    padding-top: 3.5rem;
  }
}

/* ===== Table Styles ===== */
table th {
  font-weight: 600;
  letter-spacing: 0.025em;
}

table tbody tr {
  transition: background-color 0.1s ease;
}

/* ===== Smooth page load ===== */
#page-content {
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Stripe Elements ===== */
.stripe-field {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 12px;
}
.stripe-field.focused {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.08);
}
.stripe-field.invalid {
  border-color: #ef4444;
}

/* ===== Selection ===== */
::selection {
  background: rgba(59, 130, 246, 0.15);
  color: inherit;
}

/* ===== Product Description (WHMCS features list) ===== */
#product-desc ul {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.375rem;
}
#product-desc li {
  font-size: 0.8125rem;
  color: #6b7280;
  padding-left: 1.25rem;
  position: relative;
}
#product-desc li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3b82f6;
}
#product-desc li b {
  color: #111827;
  font-weight: 600;
}

/* ===== Reinstall Modal (Dark Theme) ===== */

.reinstall-panel {
  background: #0f1225;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.reinstall-search {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.reinstall-search:focus {
  background: rgba(255, 255, 255, 0.1);
  border-color: #7c3aed;
  box-shadow: none;
}

.reinstall-warning {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.15);
}

.reinstall-checkbox {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 2px solid #4b5563;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
}
.reinstall-checkbox:checked {
  background: #7c3aed;
  border-color: #7c3aed;
}
.reinstall-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 6px;
  height: 11px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.reinstall-checkbox:focus {
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.3);
  border-color: #7c3aed;
}

.spinner-dark {
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top: 3px solid #7c3aed;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

/* Templates Grid Scrollbar (dark) */
#templates-grid::-webkit-scrollbar {
  width: 6px;
}
#templates-grid::-webkit-scrollbar-track {
  background: transparent;
}
#templates-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}
#templates-grid::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ===== OS Card ===== */

.os-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.os-card:hover {
  background: rgba(255, 255, 255, 0.07);
}

.os-card-selected {
  border-color: #7c3aed !important;
  background: rgba(124, 58, 237, 0.08) !important;
  box-shadow: 0 0 0 1px #7c3aed;
}

/* Version rows */
.version-row {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* ===== PHP INI Range Sliders ===== */
.ini-range {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: #e5e7eb;
  outline: none;
}
.ini-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #6c5ce7;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.ini-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #6c5ce7;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.version-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.version-row.version-selected {
  background: rgba(124, 58, 237, 0.06);
}

/* Versions panel */
.versions-panel {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* Expand arrow */
.expand-arrow {
  transition: transform 0.2s ease;
}

/* ===== Underline Tabs ===== */
.tab-btn {
  padding: 0.75rem 0;
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.15s ease;
  cursor: pointer;
  border: none;
  outline: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab-active {
  color: #111827;
  border-bottom-color: #111827;
  font-weight: 600;
}

.tab-inactive {
  color: #9ca3af;
}
.tab-inactive:hover {
  color: #4b5563;
}

/* ===== Onboarding Tour (Driver.js) ===== */
.driver-popover.onboarding-popover {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.06);
  padding: 20px;
  max-width: 340px;
}

.driver-popover.onboarding-popover .driver-popover-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 6px;
  line-height: 1.4;
}

.driver-popover.onboarding-popover .driver-popover-description {
  font-size: 0.8125rem;
  color: #6b7280;
  line-height: 1.6;
}

.driver-popover.onboarding-popover .driver-popover-footer {
  margin-top: 16px;
  gap: 8px;
}

.driver-popover.onboarding-popover .driver-popover-footer button {
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.driver-popover.onboarding-popover .driver-popover-next-btn,
.driver-popover.onboarding-popover .driver-popover-done-btn {
  background: #111827;
  color: #ffffff;
}
.driver-popover.onboarding-popover .driver-popover-next-btn:hover,
.driver-popover.onboarding-popover .driver-popover-done-btn:hover {
  background: #1f2937;
}

.driver-popover.onboarding-popover .driver-popover-prev-btn {
  background: transparent;
  color: #6b7280;
  border: 1px solid #e5e7eb;
}
.driver-popover.onboarding-popover .driver-popover-prev-btn:hover {
  background: #f9fafb;
  color: #374151;
}

.driver-popover.onboarding-popover .driver-popover-close-btn {
  color: #9ca3af;
}
.driver-popover.onboarding-popover .driver-popover-close-btn:hover {
  color: #6b7280;
}

.driver-popover.onboarding-popover .driver-popover-progress-text {
  font-size: 0.6875rem;
  color: #9ca3af;
  font-weight: 500;
}

.driver-popover.onboarding-popover .driver-popover-arrow-side-left.driver-popover-arrow,
.driver-popover.onboarding-popover .driver-popover-arrow-side-right.driver-popover-arrow,
.driver-popover.onboarding-popover .driver-popover-arrow-side-top.driver-popover-arrow,
.driver-popover.onboarding-popover .driver-popover-arrow-side-bottom.driver-popover-arrow {
  border-color: #ffffff;
}
