/* ============================================================
   PACKAGING DESIGN & ARTWORK MANAGEMENT PLATFORM
   Global Styles
   ============================================================ */

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

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

html, body {
  height: 100%;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: #111827;
  background: #F8FAFC;
  -webkit-font-smoothing: antialiased;
}

#app-root { height: 100%; }

/* ── Scrollbars ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9CA3AF; }

/* ── Typography ─────────────────────────────────────────────── */
h1 { font-size: 24px; font-weight: 800; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
h4 { font-size: 14px; font-weight: 600; }

/* ── Utility classes ────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.hidden { display: none !important; }

/* ── Status Pills ───────────────────────────────────────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.status-pending    { background: #F3F4F6; color: #6B7280; }
.status-draft      { background: #FEF3C7; color: #92400E; }
.status-in-review  { background: #DBEAFE; color: #1E40AF; }
.status-submitted  { background: #EDE9FE; color: #5B21B6; }
.status-approved   { background: #D1FAE5; color: #065F46; }
.status-rejected   { background: #FEE2E2; color: #991B1B; }
.status-locked     { background: #F3F4F6; color: #6B7280; }
.status-completed  { background: #D1FAE5; color: #065F46; }
.status-in-progress { background: #DBEAFE; color: #1E40AF; }
.status-issues-found { background: #FEE2E2; color: #991B1B; }
.status-overdue    { background: #FEE2E2; color: #991B1B; }
.status-conditionally-approved { background: #FEF3C7; color: #92400E; }
.status-changes-requested { background: #FEE2E2; color: #991B1B; }
.status-escalated  { background: #FEE2E2; color: #7C2D12; }

/* ── Role Badges ────────────────────────────────────────────── */
.role-badge {
  display: inline-block;
  background: #D8F3DC;
  color: #1B4332;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.03em;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn:hover { opacity: 0.88; }
.btn:active { transform: scale(0.97); }
.btn-primary   { background: #1B4332; color: white; }
.btn-success   { background: #10B981; color: white; }
.btn-danger    { background: #EF4444; color: white; }
.btn-warning   { background: #F59E0B; color: white; }
.btn-secondary { background: #F3F4F6; color: #374151; }
.btn-outline   { background: white; color: #1B4332; border: 1.5px solid #1B4332; }
.btn-ghost     { background: transparent; color: #6B7280; }
.btn-sm        { padding: 5px 10px; font-size: 11px; border-radius: 6px; }
.btn-xs        { padding: 3px 8px; font-size: 10px; border-radius: 5px; }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: white;
  border-radius: 12px;
  border: 1px solid #E5E7EB;
  padding: 16px;
  transition: box-shadow 0.15s;
}
.card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.07); }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #F3F4F6;
}

/* ── Form Elements ──────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-label {
  font-size: 11px;
  font-weight: 700;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.form-label .required { color: #EF4444; margin-left: 2px; }

input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
textarea,
select {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid #E5E7EB;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  color: #111827;
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: #1B4332;
  box-shadow: 0 0 0 3px rgba(27,67,50,0.1);
}
textarea { resize: vertical; min-height: 72px; }

/* ── Progress Bar ───────────────────────────────────────────── */
.progress-bar-wrap {
  background: #E5E7EB;
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: #10B981;
  transition: width 0.4s ease;
}
.progress-bar-fill.warning { background: #F59E0B; }
.progress-bar-fill.danger  { background: #EF4444; }

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  border-radius: 0;
  transition: background 0.12s, color 0.12s;
  text-decoration: none;
  position: relative;
}
.sidebar-nav-item:hover { background: rgba(255,255,255,0.07); color: white; }
.sidebar-nav-item.active { background: rgba(255,255,255,0.15); color: white; font-weight: 600; }
.sidebar-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: #52B788;
  border-radius: 0 2px 2px 0;
}

/* ── Stage Progress Bar ─────────────────────────────────────── */
.stage-bar {
  display: flex;
  align-items: center;
  padding: 0 20px;
  background: white;
  border-bottom: 1px solid #E5E7EB;
  height: 52px;
  gap: 0;
  flex-shrink: 0;
  overflow-x: auto;
}
.stage-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.12s;
  white-space: nowrap;
  flex-shrink: 0;
}
.stage-step:hover { background: #F3F4F6; }
.stage-step.active { background: #D8F3DC; }
.stage-step.locked { opacity: 0.45; cursor: not-allowed; }
.stage-step.completed .stage-num { background: #10B981; }
.stage-circle {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #E5E7EB;
  color: #6B7280;
  font-size: 11px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stage-step.active .stage-circle { background: #1B4332; color: white; }
.stage-connector {
  width: 24px; height: 2px;
  background: #E5E7EB;
  flex-shrink: 0;
}
.stage-connector.completed { background: #10B981; }

/* ── Substep Tabs ───────────────────────────────────────────── */
.substep-tabs {
  display: flex;
  gap: 4px;
  padding: 12px 0;
  border-bottom: 2px solid #E5E7EB;
  margin-bottom: 16px;
  overflow-x: auto;
}
.substep-tab {
  padding: 7px 14px;
  border-radius: 8px 8px 0 0;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: #6B7280;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.12s;
  white-space: nowrap;
}
.substep-tab:hover { color: #1B4332; background: #F3F4F6; }
.substep-tab.active { color: #1B4332; border-bottom-color: #1B4332; background: white; }
.substep-tab.completed { color: #10B981; }

/* ── Section Headers ────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-title {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Info Boxes ─────────────────────────────────────────────── */
.info-box {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
}
.info-box-blue   { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }
.info-box-green  { background: #F0FDF4; color: #166534; border: 1px solid #BBF7D0; }
.info-box-amber  { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }
.info-box-red    { background: #FFF1F2; color: #9F1239; border: 1px solid #FECDD3; }
.info-box-purple { background: #F5F3FF; color: #5B21B6; border: 1px solid #DDD6FE; }

/* ── Timeline ───────────────────────────────────────────────── */
.gantt-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #F3F4F6;
  gap: 12px;
}
.gantt-bar-wrap {
  position: relative;
  height: 24px;
  background: #F3F4F6;
  border-radius: 4px;
  overflow: hidden;
}
.gantt-bar {
  position: absolute;
  top: 0; bottom: 0;
  border-radius: 4px;
  display: flex;
  align-items: center;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 700;
  color: white;
  white-space: nowrap;
  overflow: hidden;
}

/* ── Notification ───────────────────────────────────────────── */
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid #F3F4F6;
  cursor: pointer;
  transition: background 0.12s;
}
.notif-item:hover { background: #F9FAFB; }
.notif-item.unread { background: #F0FDF4; }
.notif-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

/* ── Comment Thread ─────────────────────────────────────────── */
.comment-thread { display: flex; flex-direction: column; gap: 8px; }
.comment-item {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #F9FAFB;
}
.comment-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #D8F3DC;
  color: #1B4332;
  font-size: 10px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.comment-body { flex: 1; }
.comment-header { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.comment-text { font-size: 13px; color: #374151; line-height: 1.5; }
.comment-input-row { display: flex; gap: 8px; margin-top: 8px; }

/* ── Checklist ──────────────────────────────────────────────── */
.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #F9FAFB;
}
.checklist-item:last-child { border-bottom: none; }
.checklist-radio-group { display: flex; gap: 6px; flex-shrink: 0; }
.radio-btn {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid #E5E7EB;
  background: white;
  color: #6B7280;
  transition: all 0.12s;
}
.radio-btn:hover { border-color: #9CA3AF; }
.radio-btn.ok     { border-color: #10B981; background: #D1FAE5; color: #065F46; }
.radio-btn.issue  { border-color: #EF4444; background: #FEE2E2; color: #991B1B; }
.radio-btn.query  { border-color: #F59E0B; background: #FEF3C7; color: #92400E; }

/* ── Traffic Light ──────────────────────────────────────────── */
.traffic-light {
  width: 14px; height: 14px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.tl-green  { background: #10B981; box-shadow: 0 0 6px rgba(16,185,129,0.5); }
.tl-amber  { background: #F59E0B; box-shadow: 0 0 6px rgba(245,158,11,0.5); }
.tl-red    { background: #EF4444; box-shadow: 0 0 6px rgba(239,68,68,0.5); }

/* ── RACI Panel ─────────────────────────────────────────────── */
.raci-panel {
  width: 260px;
  background: white;
  border-left: 1px solid #E5E7EB;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}
.raci-tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
}
.raci-r { background: #FEE2E2; color: #991B1B; }
.raci-a { background: #DBEAFE; color: #1E40AF; }
.raci-c { background: #FEF3C7; color: #92400E; }
.raci-i { background: #F3F4F6; color: #6B7280; }

/* ── Dashboard Stats ────────────────────────────────────────── */
.stat-card {
  background: white;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-value { font-size: 28px; font-weight: 800; }
.stat-label { font-size: 11px; font-weight: 600; color: #6B7280; text-transform: uppercase; letter-spacing: 0.05em; }

/* ── Table ──────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 12px;
  border-bottom: 2px solid #E5E7EB;
  background: #F9FAFB;
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #F3F4F6;
  font-size: 13px;
  vertical-align: middle;
}
.data-table tr:hover td { background: #F9FAFB; }
.data-table tr:last-child td { border-bottom: none; }

/* ── Action Cards (My Actions) ──────────────────────────────── */
.action-card {
  background: white;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: box-shadow 0.15s;
}
.action-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.08); }
.action-card-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.action-priority-high { border-left: 3px solid #EF4444; }
.action-priority-medium { border-left: 3px solid #F59E0B; }
.action-priority-low { border-left: 3px solid #10B981; }

/* ── Audit Trail ────────────────────────────────────────────── */
.audit-entry {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #F3F4F6;
}
.audit-timeline-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #1B4332;
  margin-top: 5px;
  flex-shrink: 0;
}
.audit-line {
  width: 2px;
  background: #E5E7EB;
  flex-shrink: 0;
  align-self: stretch;
  margin-left: 3px;
}

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.modal-content {
  background: white;
  border-radius: 14px;
  max-width: 560px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0,0,0,0.2);
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #E5E7EB;
  display: flex; align-items: center;
  position: sticky; top: 0;
  background: white;
  z-index: 1;
  border-radius: 14px 14px 0 0;
}
.modal-body { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid #E5E7EB;
  display: flex; gap: 8px; justify-content: flex-end;
}

/* ── Gate Banner ────────────────────────────────────────────── */
.gate-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 600;
}
.gate-locked   { background: #F9FAFB; border: 2px dashed #D1D5DB; color: #6B7280; }
.gate-active   { background: #EFF6FF; border: 2px solid #BFDBFE; color: #1E40AF; }
.gate-passed   { background: #F0FDF4; border: 2px solid #BBF7D0; color: #166534; }
.gate-failed   { background: #FFF1F2; border: 2px solid #FECDD3; color: #9F1239; }

/* ── Content Element Cards ──────────────────────────────────── */
.content-element {
  background: white;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  overflow: hidden;
  transition: box-shadow 0.15s;
}
.content-element:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.07); }
.content-element.status-approved-bg { border-color: #A7F3D0; }
.ce-header {
  padding: 12px 14px;
  display: flex; align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #F3F4F6;
}
.ce-body { padding: 12px 14px; }

/* ── Artwork Preview ────────────────────────────────────────── */
.artwork-preview {
  width: 100%;
  border-radius: 8px;
  border: 1px solid #E5E7EB;
  overflow: hidden;
  background: #F9FAFB;
  display: flex; align-items: center; justify-content: center;
  min-height: 120px;
}
.artwork-preview img {
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
  display: block;
}

/* ── Version Badge ──────────────────────────────────────────── */
.version-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #1B4332;
  color: white;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

/* ── Upload Zone ────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed #D1D5DB;
  border-radius: 10px;
  padding: 28px;
  text-align: center;
  background: #FAFAFA;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.upload-zone:hover { border-color: #1B4332; background: #F0FDF4; }

/* ── Animations ─────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.fade-in { animation: fadeIn 0.2s ease; }
.slide-down { animation: slideDown 0.15s ease; }
.pulse { animation: pulse 2s infinite; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { width: 0; overflow: hidden; }
  .raci-panel { display: none; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Print ──────────────────────────────────────────────────── */
@media print {
  .sidebar, .raci-panel, .modal-overlay { display: none; }
  .card { break-inside: avoid; }
}
