/* ============================
   TUNLEY — Main Stylesheet
   ============================ */

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

:root {
  --tunley-bg: #0f0f0f;
  --tunley-sidebar: #161616;
  --tunley-surface: #1e1e1e;
  --tunley-surface-2: #252525;
  --tunley-border: #2a2a2a;
  --tunley-text: #e8e8e8;
  --tunley-text-muted: #888;
  --tunley-accent: #7c6ef7;
  --tunley-accent-glow: #9d91f8;
  --tunley-green: #22c55e;
  --tunley-red: #ef4444;
  --tunley-amber: #f59e0b;
  --tunley-danger-bg: rgba(239, 68, 68, 0.1);
  --tunley-success-bg: rgba(34, 197, 94, 0.1);
  --tunley-warning-bg: rgba(245, 158, 11, 0.1);
  
  --sidebar-width: 280px;
  --header-height: 0px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --transition: all 0.2s ease;
}

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

html, body {
  width: 100%;
  height: 100%;
  max-width: 100vw;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--tunley-bg);
  color: var(--tunley-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  color: var(--tunley-accent-glow);
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  outline: none;
  background: none;
  color: inherit;
}

input, textarea {
  font-family: inherit;
  outline: none;
  border: none;
  background: none;
  color: inherit;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--tunley-border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--tunley-text-muted);
}

/* ============================
   Utility Classes
   ============================ */

.hidden {
  display: none !important;
}

.flex-row {
  display: flex;
  align-items: center;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.gap-sm { gap: 6px; }
.gap-md { gap: 12px; }
.gap-lg { gap: 20px; }

.text-muted {
  color: var(--tunley-text-muted);
}

.text-accent {
  color: var(--tunley-accent);
}

.text-sm {
  font-size: 13px;
}

.text-xs {
  font-size: 11px;
}

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================
   Loading Spinner
   ============================ */

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--tunley-border);
  border-top-color: var(--tunley-accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ============================
   Button Styles
   ============================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--tunley-accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--tunley-accent-glow);
  box-shadow: 0 0 20px rgba(124, 110, 247, 0.3);
}

.btn-secondary {
  background: var(--tunley-surface-2);
  color: var(--tunley-text);
  border: 1px solid var(--tunley-border);
}

.btn-secondary:hover {
  background: var(--tunley-surface);
  border-color: var(--tunley-accent);
}

.btn-danger {
  background: var(--tunley-danger-bg);
  color: var(--tunley-red);
  border: 1px solid transparent;
}

.btn-danger:hover {
  border-color: var(--tunley-red);
}

.btn-ghost {
  background: transparent;
  color: var(--tunley-text-muted);
}

.btn-ghost:hover {
  background: var(--tunley-surface-2);
  color: var(--tunley-text);
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 16px;
  border-radius: var(--radius-md);
}

.btn-block {
  width: 100%;
}

/* ============================
   Input Styles
   ============================ */

.input {
  width: 100%;
  padding: 10px 14px;
  background: var(--tunley-surface);
  border: 1px solid var(--tunley-border);
  border-radius: var(--radius-sm);
  color: var(--tunley-text);
  font-size: 14px;
  transition: var(--transition);
}

.input:focus {
  border-color: var(--tunley-accent);
  box-shadow: 0 0 0 3px rgba(124, 110, 247, 0.15);
}

.input::placeholder {
  color: var(--tunley-text-muted);
}

/* ============================
   Modal / Overlay
   ============================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--tunley-surface);
  border: 1px solid var(--tunley-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 90%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.modal h2 {
  font-size: 20px;
  margin-bottom: 20px;
  font-weight: 600;
}

.modal .form-group {
  margin-bottom: 16px;
}

.modal .form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--tunley-text-muted);
  font-weight: 500;
}

.modal .form-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  justify-content: flex-end;
}

/* ============================
   Progress / Usage Bar
   ============================ */

.usage-bar {
  height: 4px;
  background: var(--tunley-surface-2);
  border-radius: 2px;
  overflow: hidden;
}

.usage-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease, background 0.3s ease;
}

.usage-bar-fill.normal {
  background: var(--tunley-accent);
}

.usage-bar-fill.warning {
  background: var(--tunley-amber);
}

.usage-bar-fill.critical {
  background: var(--tunley-red);
}

/* ============================
   Badge
   ============================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}

.badge-accent {
  background: rgba(124, 110, 247, 0.15);
  color: var(--tunley-accent);
}

.badge-green {
  background: var(--tunley-success-bg);
  color: var(--tunley-green);
}

.badge-amber {
  background: var(--tunley-warning-bg);
  color: var(--tunley-amber);
}

.badge-red {
  background: var(--tunley-danger-bg);
  color: var(--tunley-red);
}
