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

:root {
  --navy: #0f172a;
  --navy-800: #1e293b;
  --navy-700: #334155;
  --navy-600: #475569;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --green: #22c55e;
  --green-light: #dcfce7;
  --red: #ef4444;
  --red-light: #fee2e2;
  --yellow: #f59e0b;
  --yellow-light: #fef3c7;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
}

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

html, body {
  height: 100%;
  background-color: var(--gray-50);
  color: var(--text-primary);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--navy-600); }

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }

.animate-fade-in { animation: fadeIn 0.3s ease-out forwards; }
.animate-slide-in { animation: slideIn 0.25s ease-out forwards; }

/* Card */
.card {
  background: white;
  border-radius: 12px;
  border: 1px solid var(--gray-200);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: box-shadow 0.2s ease;
}
.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

/* Buttons */
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; background: var(--accent); color: white;
  border: none; border-radius: 8px; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: background 0.2s ease, transform 0.1s ease;
  text-decoration: none;
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); color: white; }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-danger {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; background: var(--red); color: white;
  border: none; border-radius: 8px; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: background 0.2s ease; text-decoration: none;
}
.btn-danger:hover { background: #dc2626; color: white; }

.btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; background: white; color: var(--text-primary);
  border: 1px solid var(--gray-200); border-radius: 8px;
  font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease; text-decoration: none;
}
.btn-secondary:hover { background: var(--gray-50); border-color: var(--gray-300); color: var(--text-primary); }

.btn-success {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; background: var(--green); color: white;
  border: none; border-radius: 8px; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: background 0.2s ease; text-decoration: none;
}
.btn-success:hover { background: #16a34a; color: white; }

/* Inputs */
.input-field {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--gray-200); border-radius: 8px;
  font-size: 14px; color: var(--text-primary);
  background: white; transition: border-color 0.2s ease, box-shadow 0.2s ease;
  outline: none; font-family: 'Inter', sans-serif;
}
.input-field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
.input-field::placeholder { color: var(--text-muted); }

.select-field {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--gray-200); border-radius: 8px;
  font-size: 14px; color: var(--text-primary);
  background: white; cursor: pointer; outline: none;
  transition: border-color 0.2s ease; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px;
  font-family: 'Inter', sans-serif;
}
.select-field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }

/* Badge */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 500;
}
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: var(--green-light); color: #15803d; }
.badge-red { background: var(--red-light); color: #b91c1c; }
.badge-yellow { background: var(--yellow-light); color: #92400e; }
.badge-orange { background: #ffedd5; color: #c2410c; }
.badge-gray { background: var(--gray-100); color: var(--text-secondary); }

/* Table */
.table-wrapper { overflow-x: auto; border-radius: 10px; border: 1px solid var(--gray-200); }
table { width: 100%; border-collapse: collapse; }
thead { background: var(--gray-50); }
th {
  padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); text-transform: uppercase;
  letter-spacing: 0.05em; border-bottom: 1px solid var(--gray-200); white-space: nowrap;
}
td { padding: 12px 16px; font-size: 14px; color: var(--text-primary); border-bottom: 1px solid var(--gray-100); }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.15s ease; }
tbody tr:hover { background: var(--gray-50); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px); display: flex; align-items: center;
  justify-content: center; z-index: 1000; padding: 20px;
  animation: fadeIn 0.2s ease;
}
.modal-content {
  background: white; border-radius: 16px; padding: 28px;
  width: 100%; max-width: 520px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15); animation: fadeIn 0.25s ease;
}

/* Sidebar */
.sidebar {
  width: 260px; min-height: 100vh; background: var(--navy);
  display: flex; flex-direction: column; position: fixed;
  top: 0; left: 0; z-index: 100; transition: transform 0.3s ease;
}
.sidebar-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; border-radius: 8px; font-size: 14px;
  font-weight: 500; color: #94a3b8; cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  text-decoration: none; margin: 2px 0; border: none; background: none; width: 100%;
}
.sidebar-item:hover { background: rgba(255,255,255,0.07); color: white; }
.sidebar-item.active { background: var(--accent); color: white; }

/* Stat card */
.stat-card {
  background: white; border-radius: 12px; padding: 20px 24px;
  border: 1px solid var(--gray-200); display: flex; align-items: center;
  gap: 16px; transition: box-shadow 0.2s ease, transform 0.2s ease;
  text-decoration: none; color: inherit;
}
.stat-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.08); transform: translateY(-2px); color: inherit; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* Page header */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.page-subtitle { font-size: 14px; color: var(--text-secondary); margin-top: 2px; }

/* Form label */
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }

/* Alert */
.alert-box { padding: 12px 16px; border-radius: 8px; font-size: 14px; display: flex; align-items: flex-start; gap: 10px; }
.alert-warning { background: var(--yellow-light); color: #78350f; border: 1px solid #fde68a; }
.alert-error { background: var(--red-light); color: #7f1d1d; border: 1px solid #fca5a5; }
.alert-success { background: var(--green-light); color: #14532d; border: 1px solid #86efac; }
.alert-info { background: #dbeafe; color: #1e3a5f; border: 1px solid #93c5fd; }

/* Spinner */
.spinner {
  width: 20px; height: 20px; border: 2px solid var(--gray-200);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.7s linear infinite; display: inline-block;
}

/* Toast */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 18px; border-radius: 10px; font-size: 14px; font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15); animation: fadeIn 0.25s ease; min-width: 260px;
  display: flex; align-items: center; gap: 10px;
}
.toast-success { background: #f0fdf4; color: #15803d; border: 1px solid #86efac; }
.toast-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fca5a5; }
.toast-info { background: #eff6ff; color: #1d4ed8; border: 1px solid #93c5fd; }

/* Main layout */
.main-content { margin-left: 260px; flex: 1; padding: 28px; background: #f8fafc; min-height: 100vh; }

/* Mobile hamburger */
.mobile-menu-btn {
  position: fixed; top: 14px; left: 14px; z-index: 200;
  width: 40px; height: 40px; background: var(--navy);
  border: none; border-radius: 10px; display: none;
  align-items: center; justify-content: center;
  cursor: pointer; color: white; box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 70px 16px 16px; }
  .mobile-menu-btn { display: flex; }
}
