/* CCI Toolkit - Apple HIG Theme */

:root {
  /* System Colors */
  --system-blue: #007aff;
  --system-green: #34c759;
  --system-indigo: #5856d6;
  --system-orange: #ff9500;
  --system-pink: #ff2d55;
  --system-purple: #af52de;
  --system-red: #ff3b30;
  --system-teal: #5ac8fa;
  --system-yellow: #ffcc00;
  
  /* Gray Scale */
  --system-gray: #8e8e93;
  --system-gray2: #aeaeb2;
  --system-gray3: #c7c7cc;
  --system-gray4: #d1d1d6;
  --system-gray5: #e5e5ea;
  --system-gray6: #f2f2f7;
  
  /* Background Colors */
  --background-primary: #ffffff;
  --background-secondary: #f2f2f7;
  --background-tertiary: #ffffff;
  
  /* Text Colors */
  --text-primary: #1d1d1f;
  --text-secondary: #86868b;
  --text-tertiary: #aeaeb2;

  /* Separator */
  --separator: #c6c6c8;
  --separator-opaque: #C6C6C8;

  /* Branding */
  --logo-border: rgb(128, 128, 128);
  
  /* Shadows */
  --shadow-color: rgba(0, 0, 0, 0.1);
  --shadow-sm: 0 1px 3px var(--shadow-color);
  --shadow-md: 0 4px 12px var(--shadow-color);
  --shadow-lg: 0 8px 24px var(--shadow-color);
  
  /* Dimensions */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background-color: var(--background-secondary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* --- Components --- */

/* Buttons */
button,
[role="button"],
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  line-height: 1.2;
}

.btn-sm {
  padding: 8px;
  font-size: 13px;
}

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

.btn-primary {
  background-color: var(--system-blue);
  color: white;
}
.btn-primary:hover:not(:disabled) {
  background-color: #0056b3;
}

.btn-secondary {
  background-color: var(--background-primary);
  color: var(--system-blue);
  border-color: var(--separator);
}
.btn-secondary:hover:not(:disabled) {
  background-color: var(--system-gray6);
}

.btn-danger {
  background-color: var(--background-primary);
  color: var(--system-red);
  border-color: var(--system-red);
}
.btn-danger:hover:not(:disabled) {
  background-color: #fff2f2;
}

.btn-ghost {
  background: transparent;
  color: var(--system-blue);
}
.btn-ghost:hover:not(:disabled) {
  background-color: rgba(0, 122, 255, 0.1);
}

/* Cards */
.card {
  background: var(--background-primary);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--separator);
}

.card-header {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: var(--space-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Spinner */
.spinner {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: conic-gradient(
    transparent 0deg 90deg,
    rgba(157, 185, 231, 0) 90deg,
    rgba(157, 185, 231, 0.35) 110deg,
    #5a86d8 170deg,
    #266bd9 260deg,
    #266bd9 360deg
  );
  -webkit-mask: radial-gradient(circle, transparent 72%, #000 73%);
  mask: radial-gradient(circle, transparent 72%, #000 73%);
  animation: spin 1s linear infinite;
  display: inline-block;
}

/* Shared loading state - used across settings, security, capacity views */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  min-height: 200px;
  text-align: center;
  gap: 1rem;
}

.loading-state p,
.loading-state .loading-text {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0;
}

/* Development-only color tuner */
.color-tuner-popup {
  position: fixed;
  left: 0;
  top: 0;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  min-width: 240px;
  display: none;
  grid-template-columns: 1fr;
  gap: 8px;
  z-index: 4000;
  pointer-events: auto;
  font-size: 12px;
  color: #1f2937;
}

.color-tuner-popup.is-visible {
  display: grid;
}

.color-tuner-title {
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(0, 0, 0, 0.6);
}

.color-tuner-row {
  display: grid;
  grid-template-columns: 48px 1fr 56px;
  align-items: center;
  gap: 8px;
}

.color-tuner-label {
  font-weight: 600;
  color: rgba(0, 0, 0, 0.6);
}

.color-tuner-value {
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: rgba(0, 0, 0, 0.75);
}

.color-tuner-slider {
  width: 100%;
  accent-color: #2563eb;
}

.color-tuner-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 6px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.color-tuner-swatch {
  width: 34px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.color-tuner-hex {
  font-weight: 700;
  letter-spacing: 0.02em;
  color: rgba(0, 0, 0, 0.7);
}

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

/* Layout Utils */
.flex-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-sm);
}

.flex-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.spacer {
  flex: 1;
}

/* Inputs */
.input {
  padding: 8px 12px;
  border: 1px solid var(--separator);
  border-radius: var(--radius-sm);
  font-size: 13px;
  width: 100%;
  box-sizing: border-box;
}
.input:focus {
  outline: 2px solid var(--system-blue);
  border-color: var(--system-blue);
}
