/* ==========================================================================
   Assignment 6 — React CRUD User Management
   Minimalist Editorial Utilitarian Stylesheet
   ========================================================================== */

:root {
  --bg-canvas: #F7F6F3;
  --bg-surface: #FFFFFF;
  --bg-subtle: #FBFBFA;
  --border-color: #EAEAEA;
  --border-strong: #D6D5D0;

  --text-primary: #111111;
  --text-body: #2F3437;
  --text-muted: #787774;

  /* Muted Spot Pastels */
  --pastel-red-bg: #FDEBEC;
  --pastel-red-text: #9F2F2D;
  --pastel-red-border: #F4CFD2;

  --pastel-blue-bg: #E1F3FE;
  --pastel-blue-text: #1F6C9F;

  --pastel-green-bg: #EDF3EC;
  --pastel-green-text: #346538;

  --pastel-yellow-bg: #FBF3DB;
  --pastel-yellow-text: #956400;

  /* Typography */
  --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-sans: 'Be Vietnam Pro', 'SF Pro Display', 'Helvetica Neue', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
}

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

html {
  background-color: var(--bg-canvas);
  color: var(--text-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text-body);
  background-color: var(--bg-canvas);
  min-height: 100vh;
}

/* ==========================================================================
   Top Navigation Bar
   ========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: rgba(247, 246, 243, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-color);
}

.topbar-inner {
  max-width: 1220px;
  margin: 0 auto;
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  color: var(--text-muted);
}

.topbar-brand a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.15s ease;
}

.topbar-brand a:hover {
  opacity: 0.7;
}

.topbar-sep {
  color: var(--border-strong);
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.nav-pill:hover {
  color: var(--text-primary);
  background-color: var(--bg-surface);
  border-color: var(--border-color);
}

.nav-pill.is-active {
  color: var(--text-primary);
  background-color: var(--bg-surface);
  border-color: var(--border-color);
}

/* ==========================================================================
   Main App Container & Page Header
   ========================================================================== */

.app-container {
  max-width: 1220px;
  margin: 0 auto;
  padding: 48px 28px 80px;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 28px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border-color);
}

.page-eyebrow {
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.page-title {
  font-family: var(--font-serif);
  font-size: clamp(32px, 4vw, 44px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.page-subtitle {
  font-size: 14.5px;
  color: var(--text-muted);
  max-width: 580px;
}

.header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 9999px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-blue {
  background-color: var(--pastel-blue-bg);
  color: var(--pastel-blue-text);
}

.badge-green {
  background-color: var(--pastel-green-bg);
  color: var(--pastel-green-text);
}

/* ==========================================================================
   Toolbar: SearchForm + AddUser Trigger
   ========================================================================== */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1 1 320px;
  max-width: 440px;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 40px;
  padding: 0 38px 0 36px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-primary);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

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

.search-input:focus {
  outline: none;
  border-color: var(--text-primary);
}

.search-clear {
  position: absolute;
  right: 8px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.search-clear:hover {
  background-color: var(--bg-canvas);
  color: var(--text-primary);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background-color: var(--text-primary);
  color: #FFFFFF;
}

.btn-primary:hover {
  background-color: #333333;
}

.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background-color: var(--bg-canvas);
  border-color: var(--text-primary);
}

.btn-sm {
  height: 30px;
  padding: 0 11px;
  font-size: 12.5px;
  border-radius: var(--radius-sm);
}

.btn-edit {
  background-color: var(--bg-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-edit:hover {
  background-color: var(--bg-canvas);
  border-color: var(--border-strong);
}

.btn-delete {
  background-color: var(--pastel-red-bg);
  color: var(--pastel-red-text);
  border: 1px solid var(--pastel-red-border);
}

.btn-delete:hover {
  background-color: #FADADC;
  border-color: #EAB8BC;
}

/* ==========================================================================
   Result Panel & Data Table
   ========================================================================== */

.table-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 20px;
  background-color: var(--bg-subtle);
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--text-muted);
}

.table-count strong {
  color: var(--text-primary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.status-banner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
  background-color: var(--pastel-green-bg);
  color: var(--pastel-green-text);
}

.status-banner.is-delete {
  background-color: var(--pastel-yellow-bg);
  color: var(--pastel-yellow-text);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.user-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13.5px;
}

.user-table thead th {
  padding: 12px 16px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background-color: var(--bg-subtle);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.user-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  color: var(--text-body);
}

.user-table tbody tr:last-child td {
  border-bottom: none;
}

.user-table tbody tr {
  transition: background-color 0.15s ease;
}

.user-table tbody tr:hover {
  background-color: #FAF9F6;
}

.cell-id {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  width: 56px;
}

.cell-name {
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
}

.cell-username {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-body);
  white-space: nowrap;
}

.cell-email {
  color: var(--text-body);
}

.cell-website {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
}

.cell-address {
  min-width: 210px;
  color: var(--text-body);
}

.cell-phone {
  font-family: var(--font-mono);
  font-size: 12.5px;
  white-space: nowrap;
  color: var(--text-body);
}

.cell-actions {
  white-space: nowrap;
  text-align: right;
}

.actions-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.text-placeholder {
  color: var(--text-muted);
  font-style: italic;
}

/* ==========================================================================
   Loading, Empty & Error States
   ========================================================================== */

.state-box {
  padding: 56px 24px;
  text-align: center;
  color: var(--text-muted);
}

.state-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.state-desc {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.loading-dots {
  display: inline-flex;
  gap: 6px;
  margin-bottom: 12px;
}

.loading-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--text-primary);
  opacity: 0.25;
  animation: pulseDot 1s infinite ease-in-out;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes pulseDot {
  0%, 80%, 100% {
    opacity: 0.25;
    transform: scale(0.9);
  }
  40% {
    opacity: 1;
    transform: scale(1.1);
  }
}

/* ==========================================================================
   Modal Overlay & Modal Content (Step 8)
   ========================================================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(17, 17, 17, 0.42);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  z-index: 999;
  animation: fadeInOverlay 0.16s ease-out;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: min(540px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
  animation: slideUpModal 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUpModal {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h4 {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.modal-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.modal-close:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* Form Layout inside Modal */
.form-section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 18px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-field.full-span {
  grid-column: 1 / -1;
}

.form-field label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-body);
}

.required-mark {
  color: var(--pastel-red-text);
  margin-left: 2px;
}

.form-field input {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--text-primary);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.form-field input:focus {
  outline: none;
  background-color: var(--bg-surface);
  border-color: var(--text-primary);
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border-color);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.page-footer {
  max-width: 1220px;
  margin: 0 auto;
  padding: 24px 28px 48px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-muted);
}

.page-footer a {
  color: var(--text-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border-strong);
}

.page-footer a:hover {
  text-decoration-color: var(--text-primary);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 720px) {
  .topbar-inner {
    padding: 0 16px;
  }

  .app-container {
    padding: 32px 16px 64px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    max-width: none;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .modal-content {
    padding: 20px;
  }

  .page-footer {
    padding: 20px 16px 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
