/* CYSM Packaging System — Shared styles */

:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-2: #1e1e1e;
  --surface-3: #2a2a2a;
  --border: #333;
  --border-hover: #555;
  --text: #e8e8e8;
  --text-dim: #888;
  --text-muted: #555;
  --accent: #c8a87c;
  --accent-hover: #dbbf96;
  --accent-dim: rgba(200,168,124,0.15);
  --red: #e74c4c;
  --red-dim: rgba(231,76,76,0.15);
  --green: #4caf50;
  --green-dim: rgba(76,175,80,0.15);
  --blue: #5b9bd5;
  --blue-dim: rgba(91,155,213,0.15);
  --yellow: #f5c542;
  --orange: #e89b3e;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
}

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

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

/* ─── BUTTONS ─── */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn:hover { border-color: var(--border-hover); background: var(--surface-3); }

.btn-accent {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

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

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

.btn-sm {
  padding: 4px 10px;
  font-size: 11px;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

/* ─── BADGES ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.badge-concept { background: var(--blue-dim); color: var(--blue); border-color: var(--blue); }
.badge-in_development { background: var(--yellow-dim); color: var(--yellow); border-color: var(--yellow); }
.badge-in_review { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }
.badge-needs_changes { background: var(--red-dim); color: var(--red); border-color: var(--red); }
.badge-approved { background: var(--green-dim); color: var(--green); border-color: var(--green); }
.badge-needs_update { background: var(--orange); color: var(--bg); border-color: var(--orange); }

/* ─── INPUT FIELDS ─── */
input[type="text"],
input[type="email"],
input[type="url"],
textarea,
select {
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  transition: border-color 0.15s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
}

textarea {
  resize: vertical;
}

/* ─── MODALS ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.hidden { display: none; }

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

.modal h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

.modal p {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.modal input {
  width: 100%;
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* User identity modal */
.user-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.user-modal-content {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  max-width: 350px;
}

.user-modal-content h3 {
  font-size: 18px;
  margin-bottom: 12px;
  color: var(--accent);
}

.user-modal-content p {
  color: var(--text-dim);
  margin-bottom: 16px;
}

.user-modal-content input {
  width: 100%;
  margin-bottom: 16px;
}

.user-modal-content .btn {
  width: 100%;
}

/* ─── TOAST ─── */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: var(--shadow-sm);
  animation: slideIn 0.3s ease-out;
  z-index: 999;
}

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

/* ─── GRID ─── */
.grid {
  display: grid;
  gap: 16px;
}

.grid-2 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

/* ─── FLEX ─── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-center { align-items: center; justify-content: center; }
.flex-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

/* ─── TEXT ─── */
.text-xs { font-size: 11px; }
.text-sm { font-size: 12px; }
.text-base { font-size: 13px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 20px; }

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

.font-bold { font-weight: 600; }
.font-light { font-weight: 400; }

/* ─── SPACING ─── */
.p-1 { padding: 4px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }

.m-1 { margin: 4px; }
.m-2 { margin: 8px; }
.m-3 { margin: 12px; }
.m-4 { margin: 16px; }

/* ─── VISIBILITY ─── */
.hidden { display: none !important; }
.invisible { visibility: hidden; }

/* ─── BORDERS ─── */
.border { border: 1px solid var(--border); }
.border-top { border-top: 1px solid var(--border); }
.border-bottom { border-bottom: 1px solid var(--border); }

.rounded { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }

/* ─── RESPONSIVE ─── */
@media (max-width: 1100px) {
  /* Dashboard: sidebar gets a bit narrower */
  .sidebar { width: 180px; padding: 20px 12px; }
}

@media (max-width: 900px) {
  /* Header: search drops to a second row below the logo */
  .header {
    flex-wrap: wrap;
    padding: 12px 16px;
    gap: 12px;
  }
  .header-center {
    order: 3;
    width: 100%;
    flex-basis: 100%;
  }
  .search-wrap { max-width: none; }

  /* Sidebar converts to a horizontal filter strip */
  .main { flex-direction: column; height: auto; min-height: calc(100vh - 52px); }
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    overflow-x: auto;
  }
  .filter-section { margin-bottom: 0; }
  .filter-section h3 { display: none; }
  .filter-buttons {
    flex-direction: row;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
  }
  .filter-btn { white-space: nowrap; padding: 6px 12px; }

  .content { padding: 16px; }
  .grid-2 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

@media (max-width: 600px) {
  .header-left .logo { font-size: 15px; }
  .header-left .logo span { display: none; }
  .grid-2 { grid-template-columns: 1fr 1fr; gap: 12px; }
  .btn { padding: 7px 12px; font-size: 12px; }
}
