/* Certify Supplier Portal — Design System
   Tokens match the main Certify platform exactly. */

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

:root {
  --dark:    #162030;
  --dark2:   #253846;
  --dark3:   #0a1120;
  --gold:    #dabe6f;
  --gold2:   #dfcc98;
  --slate:   #64748b;
  --slate2:  #94a3b8;
  --slate3:  #cbd5e1;
  --white:   #ffffff;
  --red:     #f87171;
  --green:   #34d399;
  --amber:   #fbbf24;
  --border:  rgba(255, 255, 255, 0.07);
  --border2: rgba(218, 190, 111, 0.2);
  --glow:    rgba(218, 190, 111, 0.1);
}

/* ------------------------------------------------------------------ Reset */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: 'Poppins', sans-serif;
  background: var(--dark);
  color: var(--slate3);
  min-height: 100vh;
  line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Montserrat', sans-serif;
  color: var(--white);
  font-weight: 600;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold2); }

/* --------------------------------------------------------------- Navbar */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 64px;
  background: rgba(22, 32, 48, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 1000;
}

.navbar-brand {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 8px;
}
.navbar-brand .certify { color: var(--gold); }
.navbar-brand .portal-label {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-left: 8px;
  padding-left: 8px;
  border-left: 1px solid var(--border);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* -------------------------------------------------------------- Sidebar */
.sidebar {
  position: fixed;
  top: 64px; left: 0; bottom: 0;
  width: 240px;
  background: var(--dark3);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  overflow-y: auto;
  z-index: 999;
}

.sidebar-nav { list-style: none; }

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: var(--slate2);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}
.sidebar-nav li a:hover,
.sidebar-nav li a.active {
  color: var(--gold);
  background: rgba(218, 190, 111, 0.05);
  border-right: 2px solid var(--gold);
}
.sidebar-nav li a svg {
  width: 20px; height: 20px;
  flex-shrink: 0;
}

/* --------------------------------------------------------- Main content */
.main-content {
  margin-left: 240px;
  margin-top: 64px;
  padding: 32px;
  min-height: calc(100vh - 64px);
}
.main-content.full-width { margin-left: 0; }

/* ---------------------------------------------------------------- Cards */
.card {
  background: var(--dark2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 1.1rem; font-weight: 600; }

/* ----------------------------------------------------------- Stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--dark2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stat-card .stat-value {
  font-family: 'Montserrat', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold);
}
.stat-card .stat-label {
  font-size: 0.85rem;
  color: var(--slate2);
  font-weight: 500;
}

/* ------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  line-height: 1.4;
}
.btn-gold { background: var(--gold); color: var(--dark); }
.btn-gold:hover { background: var(--gold2); color: var(--dark); }

.btn-ghost {
  background: transparent;
  color: var(--slate2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--white); border-color: var(--slate); }

.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid rgba(248, 113, 113, 0.3);
}
.btn-danger:hover { background: rgba(248, 113, 113, 0.1); }

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }

/* --------------------------------------------------------------- Forms */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--slate2);
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--white);
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  transition: border-color 0.2s;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--glow);
}
.form-textarea { min-height: 100px; resize: vertical; }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* -------------------------------------------------------------- Tables */
.table-wrapper { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }
table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--slate);
  border-bottom: 1px solid var(--border);
}
table td {
  padding: 14px 16px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}
table tr:hover { background: rgba(255, 255, 255, 0.02); }

/* -------------------------------------------------------------- Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}
.badge-active,
.badge-approved  { background: rgba(52, 211, 153, 0.15);  color: var(--green); }
.badge-pending   { background: rgba(251, 191, 36, 0.15);  color: var(--amber); }
.badge-draft,
.badge-archived  { background: rgba(248, 113, 113, 0.15); color: var(--red);   }
.badge-category  { background: rgba(218, 190, 111, 0.12); color: var(--gold);  }

/* -------------------------------------------------------- Flash messages */
.flash-messages { margin-bottom: 24px; }
.flash {
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.flash-success { background: rgba(52, 211, 153, 0.1);  border: 1px solid rgba(52, 211, 153, 0.2);  color: var(--green); }
.flash-error   { background: rgba(248, 113, 113, 0.1); border: 1px solid rgba(248, 113, 113, 0.2); color: var(--red);   }
.flash-warning { background: rgba(251, 191, 36, 0.1);  border: 1px solid rgba(251, 191, 36, 0.2);  color: var(--amber); }
.flash-info    { background: rgba(218, 190, 111, 0.1); border: 1px solid rgba(218, 190, 111, 0.2); color: var(--gold);  }

/* ---------------------------------------------------------- Auth layout */
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 64px);
  padding: 32px;
}
.auth-card {
  background: var(--dark2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px;
  width: 100%;
  max-width: 440px;
  text-align: center;
}
.auth-card h1 { font-size: 1.5rem; margin-bottom: 8px; }
.auth-card .subtitle {
  color: var(--slate);
  margin-bottom: 32px;
  font-size: 0.9rem;
}

/* --------------------------------------------------------- Page header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h1 { font-size: 1.5rem; }

/* ------------------------------------------------------- Activity list */
.activity-list { list-style: none; }
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--gold);
  margin-top: 6px;
  flex-shrink: 0;
}
.activity-text { font-size: 0.9rem; }
.activity-time {
  font-size: 0.8rem;
  color: var(--slate);
  margin-top: 2px;
}

/* -------------------------------------------------- Checklist builder */
.checklist-items { list-style: none; }
.checklist-item {
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.checklist-item .drag-handle {
  cursor: grab;
  color: var(--slate);
  padding: 4px;
  flex-shrink: 0;
  user-select: none;
}
.checklist-item .item-content { flex: 1; }
.checklist-item .item-row {
  display: grid;
  grid-template-columns: 1fr 140px 140px 50px;
  gap: 10px;
  align-items: center;
}
.checklist-item .remove-item {
  color: var(--red);
  cursor: pointer;
  background: none;
  border: none;
  font-size: 1.2rem;
  padding: 4px 8px;
}
.checklist-item .remove-item:hover { opacity: 0.7; }

/* -------------------------------------------------------- Toggle switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 40px; height: 22px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--slate);
  border-radius: 22px;
  transition: 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 16px; width: 16px;
  left: 3px; bottom: 3px;
  background: var(--white);
  border-radius: 50%;
  transition: 0.2s;
}
.toggle input:checked + .toggle-slider { background: var(--gold); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ------------------------------------------------------ Preview items */
.preview-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.preview-item:last-child { border-bottom: none; }
.preview-order {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  color: var(--gold);
  font-size: 0.9rem;
  width: 30px;
  text-align: center;
}
.preview-text { flex: 1; }
.preview-meta {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ------------------------------------------------------ Welcome block */
.welcome { margin-bottom: 32px; }
.welcome h1 { font-size: 1.75rem; margin-bottom: 4px; }
.welcome p { color: var(--slate2); font-size: 0.95rem; }

/* -------------------------------------------------------- Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--slate);
}
.empty-state h3 { color: var(--slate2); margin-bottom: 8px; }

/* ------------------------------------------------- Checklist groups */
.checklist-group { margin-bottom: 32px; }
.checklist-group-title {
  font-size: 0.85rem;
  font-family: 'Montserrat', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--slate);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* ------------------------------------------------ Mobile menu toggle */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
}

/* -------------------------------------------------------- Responsive */
@media (max-width: 768px) {
  .mobile-menu-btn { display: block; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
  }
  .sidebar.open { transform: translateX(0); }

  .main-content {
    margin-left: 0;
    padding: 20px;
  }
  .stats-grid { grid-template-columns: 1fr; }

  .checklist-item .item-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

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

  .auth-card { padding: 32px 24px; }
  .navbar { padding: 0 16px; }
  .navbar-brand .portal-label { display: none; }

  .preview-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .preview-meta { margin-top: 4px; }
}
