/* ============================================================
   WEVLO WEBSITE — Global Design System
   ============================================================ */

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

/* ── CSS Variables ── */
:root {
  --primary:       #2563eb;
  --primary-light: #3b82f6;
  --primary-dark:  #1d4ed8;
  --accent:        #06b6d4;
  --success:       #10b981;
  --warning:       #f59e0b;
  --danger:        #ef4444;

  --bg:            #f8fafc;
  --bg-dark:       #0f172a;
  --surface:       #ffffff;
  --surface2:      #f1f5f9;
  --border:        #e2e8f0;
  --border-dark:   #cbd5e1;

  --text:          #0f172a;
  --text-muted:    #64748b;
  --text-light:    #94a3b8;

  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  16px;
  --radius-xl:  24px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:     0 4px 16px rgba(0,0,0,.08);
  --shadow-lg:  0 10px 40px rgba(0,0,0,.12);

  --font:       'Inter', sans-serif;
  --font-mono:  'Space Mono', monospace;

  --header-h:  60px;
  --sidebar-w: 240px;
  --transition: .2s ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: var(--font); cursor: pointer; border: none; outline: none; }
input, textarea, select { font-family: var(--font); outline: none; }

/* ── Typography ── */
h1 { font-size: 2rem;    font-weight: 700; letter-spacing: -.03em; line-height: 1.2; }
h2 { font-size: 1.5rem;  font-weight: 700; letter-spacing: -.02em; }
h3 { font-size: 1.15rem; font-weight: 600; }
h4 { font-size: 1rem;    font-weight: 600; }
p  { color: var(--text-muted); }

/* ============================================================
   HEADER / NAVBAR
   ============================================================ */
.header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px;
  z-index: 1000;
  gap: 16px;
}

.header-logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 1.1rem;
  color: var(--text); flex-shrink: 0;
}
.header-logo-icon {
  width: 34px; height: 34px;
  background: var(--primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: .9rem;
}

.header-search {
  flex: 1; max-width: 360px;
  position: relative;
}
.header-search input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px 8px 36px;
  font-size: .875rem;
  color: var(--text);
  transition: border-color var(--transition);
}
.header-search input:focus { border-color: var(--primary); background: #fff; }
.header-search input::placeholder { color: var(--text-light); }
.header-search .search-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--text-light); font-size: .9rem; pointer-events: none;
}

.header-nav {
  display: flex; align-items: center; gap: 4px;
  margin-left: auto;
}
.header-nav a {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition);
}
.header-nav a:hover { background: var(--surface2); color: var(--text); }
.header-nav a.active { background: #eff6ff; color: var(--primary); }

.header-actions { display: flex; align-items: center; gap: 10px; }

/* Avatar / user menu */
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: .85rem;
  cursor: pointer; flex-shrink: 0;
  position: relative;
}
.avatar-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  overflow: hidden;
  display: none;
  z-index: 1001;
}
.avatar-menu.open { display: block; animation: fadeDown .15s ease; }
.avatar-menu-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.avatar-menu-header .name { font-weight: 600; font-size: .9rem; }
.avatar-menu-header .email { font-size: .78rem; color: var(--text-muted); }
.avatar-menu a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  font-size: .875rem;
  transition: background var(--transition);
}
.avatar-menu a:hover { background: var(--surface2); }
.avatar-menu .logout { color: var(--danger); }

/* ============================================================
   SIDEBAR (Dashboard layout)
   ============================================================ */
.layout { display: flex; padding-top: var(--header-h); min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: fixed;
  top: var(--header-h); bottom: 0; left: 0;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex; flex-direction: column; gap: 4px;
  z-index: 900;
}

.sidebar-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition);
  cursor: pointer;
}
.sidebar-item:hover { background: var(--surface2); color: var(--text); }
.sidebar-item.active { background: #eff6ff; color: var(--primary); }
.sidebar-item .icon { font-size: 1.1rem; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-divider {
  height: 1px; background: var(--border);
  margin: 8px 0;
}
.sidebar-label {
  font-size: .68rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-light);
  padding: 8px 12px 4px;
}

/* ── Main content area ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 28px;
  max-width: 1200px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: .875rem; font-weight: 600;
  transition: all var(--transition);
  cursor: pointer; border: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--primary); color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,.3); }
.btn-secondary {
  background: var(--surface2); color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--border-dark); background: #e8edf3; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: .8rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 13px 26px; font-size: 1rem; border-radius: var(--radius-lg); }
.btn-full { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.card-hover {
  transition: all var(--transition);
  cursor: pointer;
}
.card-hover:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: .8rem; font-weight: 600;
  color: var(--text); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: .04em;
}
.form-input {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: .9rem; color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.form-input::placeholder { color: var(--text-light); }
.form-input.error { border-color: var(--danger); }
.form-hint { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: .75rem; color: var(--danger); margin-top: 4px; display: none; }
.form-error.show { display: block; }

/* Toggle switch */
.toggle-wrap {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--transition);
  user-select: none;
}
.toggle-wrap:hover { border-color: var(--border-dark); }
.toggle-wrap.on { border-color: rgba(37,99,235,.4); background: #eff6ff; }
.toggle-label { font-size: .875rem; font-weight: 500; color: var(--text); }
.toggle-sub { font-size: .75rem; color: var(--text-muted); }
.toggle-switch {
  width: 40px; height: 22px;
  background: var(--border-dark);
  border-radius: 11px;
  position: relative;
  transition: background var(--transition);
  flex-shrink: 0;
}
.toggle-switch::after {
  content: '';
  position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-wrap.on .toggle-switch { background: var(--primary); }
.toggle-wrap.on .toggle-switch::after { transform: translateX(18px); }

/* ============================================================
   BADGES & TAGS
   ============================================================ */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 8px;
  border-radius: 100px;
  font-size: .72rem; font-weight: 600;
  letter-spacing: .02em;
}
.badge-primary { background: #dbeafe; color: var(--primary); }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-gray    { background: var(--surface2); color: var(--text-muted); }

/* ============================================================
   LOADING / SKELETON
   ============================================================ */
.spinner {
  width: 22px; height: 22px;
  border: 2.5px solid rgba(37,99,235,.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--surface2) 25%, #e8edf3 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 100%; max-width: 480px;
  transform: translateY(20px);
  transition: transform var(--transition);
  max-height: 90vh; overflow-y: auto;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 1rem;
  transition: background var(--transition);
}
.modal-close:hover { background: var(--border-dark); }

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 9999;
}
.toast {
  display: flex; align-items: center; gap: 12px;
  background: var(--text);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: .875rem; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideUp .3s ease;
  min-width: 240px; max-width: 360px;
}
.toast.success { background: #065f46; }
.toast.error   { background: #991b1b; }
.toast.warning { background: #92400e; }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center;
  padding: 60px 20px; text-align: center;
}
.empty-state .icon { font-size: 3.5rem; margin-bottom: 16px; opacity: .4; }
.empty-state h3 { font-size: 1.1rem; color: var(--text); margin-bottom: 8px; }
.empty-state p { font-size: .875rem; color: var(--text-muted); max-width: 300px; }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap; gap: 12px;
}
.page-header h1 { font-size: 1.5rem; }
.page-header p  { font-size: .875rem; color: var(--text-muted); margin-top: 2px; }

/* ============================================================
   GRID LAYOUTS
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }

/* ============================================================
   UTILITIES
   ============================================================ */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }
.mt-24  { margin-top: 24px; }
.mb-16  { margin-bottom: 16px; }
.mb-24  { margin-bottom: 24px; }
.text-sm   { font-size: .875rem; }
.text-xs   { font-size: .78rem; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.font-mono { font-family: var(--font-mono); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn .3s ease; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform var(--transition); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .main-content { padding: 16px; }
  .grid-2, .grid-3, .grid-4, .grid-auto { grid-template-columns: 1fr; }
  .header-search { display: none; }
  h1 { font-size: 1.5rem; }
}
