/* ===== 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;
}

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

/* ===== 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: #374151; border-radius: 4px; }

/* ===== Loading Spinner ===== */
.spinner {
  border: 3px solid #e2e8f0;
  border-top: 3px solid #3b82f6;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

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

/* ===== 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: all 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); }
}

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