/* ============================================================
   UtilityHub — Shared Dark Theme
   ============================================================ */

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* --- CSS Custom Properties --- */
:root {
  --bg:            #0f1117;
  --surface:       #1a1d27;
  --border:        #2a2d3a;
  --text:          #e4e4e7;
  --muted:         #9ca3af;
  --primary:       #6366f1;
  --primary-hover: #818cf8;
  --success:       #22c55e;
  --warning:       #f59e0b;
  --danger:        #ef4444;

  --radius:   8px;
  --radius-lg: 12px;
  --shadow:   0 2px 12px rgba(0,0,0,.4);
  --transition: .2s ease;
  --max-w:    960px;
}

/* --- Body Defaults --- */
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* --- Layout Helpers --- */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 1rem; }
.sr-only   { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: .875rem; font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
  white-space: nowrap;
  user-select: none;
}
.btn:hover { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; pointer-events: none; }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: 0 0 0 1px var(--primary-hover);
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-sm   { padding: .35rem .75rem; font-size: .8rem; }
.btn-lg   { padding: .75rem 1.5rem; font-size: 1rem; }

.btn-icon { padding: .5rem; border-radius: var(--radius); }

/* ============================================================
   Inputs
   ============================================================ */
.input, .textarea, .select {
  width: 100%;
  padding: .6rem .85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: .9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99,102,241,.25);
}
.input::placeholder { color: var(--muted); }

.textarea { resize: vertical; min-height: 5rem; }

.input-group { display: flex; flex-direction: column; gap: .35rem; }
.input-group label { font-size: .8rem; color: var(--muted); font-weight: 500; }

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  transition: border-color var(--transition);
}
.card:hover { border-color: var(--primary); }

.card-header { font-size: 1.1rem; font-weight: 600; margin-bottom: .75rem; }
.card-body   { font-size: .9rem; color: var(--muted); }

/* ============================================================
   Modal Overlay
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  opacity: 0; visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
}
.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 90%; max-width: 420px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transform: translateY(12px);
  transition: transform var(--transition);
}
.modal-overlay.active .modal { transform: translateY(0); }

.modal-title {
  font-size: 1.15rem; font-weight: 600;
  margin-bottom: 1rem;
}
.modal-actions {
  display: flex; gap: .5rem; justify-content: flex-end;
  margin-top: 1.25rem;
}

/* ============================================================
   Toast Notifications
   ============================================================ */
.toast-container {
  position: fixed; bottom: 1.25rem; right: 1.25rem;
  display: flex; flex-direction: column; gap: .5rem;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  display: flex; align-items: center; gap: .6rem;
  padding: .7rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: .85rem;
  pointer-events: auto;
  animation: toast-in .25s ease forwards;
  max-width: 340px;
}

.toast.toast-success { border-left: 3px solid var(--success); }
.toast.toast-warning { border-left: 3px solid var(--warning); }
.toast.toast-danger  { border-left: 3px solid var(--danger); }
.toast.toast-info    { border-left: 3px solid var(--primary); }

.toast.removing { animation: toast-out .2s ease forwards; }

@keyframes toast-in  { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toast-out { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(30px); } }

/* ============================================================
   Utility Helpers
   ============================================================ */
.text-primary { color: var(--primary); }
.text-muted   { color: var(--muted); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger  { color: var(--danger); }

.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }

.w-full { width: 100%; }
.hidden { display: none !important; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 640px) {
  .container { padding: 0 .65rem; }
  .btn       { padding: .5rem .9rem; font-size: .82rem; }
  .modal     { width: 95%; padding: 1.15rem; }
}
