/* ============================================================
   NEATFI COMMAND CENTER — Custom Styles
   Built on top of Tailwind CSS CDN
   ============================================================ */

/* ─── ROOT VARIABLES ─── */
:root {
  --neatfi-primary: #2563eb;
  --neatfi-primary-dark: #1d4ed8;
  --neatfi-primary-light: #dbeafe;
  --neatfi-success: #22c55e;
  --neatfi-warning: #f59e0b;
  --neatfi-danger: #ef4444;
  --neatfi-info: #06b6d4;
  --sidebar-width: 240px;
  --header-height: 64px;
}

/* ─── LAYOUT ─── */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f8fafc;
  color: #1e293b;
  margin: 0;
  padding: 0;
}

.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: #0f172a;
  color: #e2e8f0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 40;
  transition: transform 0.3s ease;
}

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
}

.header {
  height: var(--header-height);
  background: white;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  padding: 0 24px;
  justify-content: space-between;
}

.page-content {
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

/* ─── SIDEBAR STYLES ─── */
.sidebar-logo {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo h1 {
  font-size: 20px;
  font-weight: 700;
  color: white;
  margin: 0;
  letter-spacing: -0.5px;
}

.sidebar-logo span {
  font-size: 11px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-nav {
  padding: 16px 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 2px;
  transition: all 0.15s ease;
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: white;
}

.nav-item.active {
  background: var(--neatfi-primary);
  color: white;
}

.nav-item svg,
.nav-item .nav-icon {
  width: 18px;
  height: 18px;
  margin-right: 12px;
  flex-shrink: 0;
}

/* ─── KPI CARDS ─── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #e2e8f0;
  transition: box-shadow 0.2s ease;
}

.kpi-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.kpi-label {
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
}

.kpi-trend {
  font-size: 13px;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ─── CHART CONTAINERS ─── */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.chart-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #e2e8f0;
}

.chart-card-full {
  grid-column: 1 / -1;
}

.chart-title {
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 16px;
}

/* ─── DATA TABLES ─── */
.data-table-container {
  background: white;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  margin-bottom: 24px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead th {
  background: #f8fafc;
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #e2e8f0;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.data-table thead th:hover {
  color: #2563eb;
}

.data-table tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.1s ease;
}

.data-table tbody tr:hover {
  background: #f8fafc;
}

.data-table tbody td {
  padding: 12px 16px;
  font-size: 14px;
  color: #334155;
}

.data-table .sort-arrow {
  display: inline-block;
  margin-left: 4px;
  opacity: 0.5;
}

.data-table .sort-active .sort-arrow {
  opacity: 1;
  color: #2563eb;
}

/* ─── ALERT BADGES ─── */
.alert-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.alert-badge-critical { background: #fef2f2; color: #dc2626; }
.alert-badge-high { background: #fff7ed; color: #ea580c; }
.alert-badge-medium { background: #fefce8; color: #ca8a04; }
.alert-badge-low { background: #f0f9ff; color: #0284c7; }

/* ─── INVENTORY STATUS BADGES ─── */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.status-stockout { background: #fef2f2; color: #dc2626; }
.status-critical { background: #fef2f2; color: #dc2626; }
.status-low { background: #fff7ed; color: #ea580c; }
.status-moderate { background: #fefce8; color: #ca8a04; }
.status-ok { background: #f0fdf4; color: #16a34a; }

/* ─── ALERT FEED ─── */
.alert-item {
  padding: 16px;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.1s ease;
}

.alert-item:hover {
  background: #f8fafc;
}

.alert-item:last-child {
  border-bottom: none;
}

/* ─── DATE RANGE SELECTOR ─── */
.date-range-selector {
  display: flex;
  gap: 4px;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 3px;
}

.date-range-btn {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.date-range-btn:hover {
  color: #1e293b;
}

.date-range-btn.active {
  background: white;
  color: #2563eb;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ─── SETTINGS TABS ─── */
.settings-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 24px;
}

.settings-tab {
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  color: #64748b;
  border: none;
  background: transparent;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s ease;
}

.settings-tab:hover { color: #1e293b; }
.settings-tab.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

/* ─── FORMS ─── */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.15s ease;
  box-sizing: border-box;
}

.form-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ─── BUTTONS ─── */
.btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary { background: #2563eb; color: white; }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: #f1f5f9; color: #374151; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger { background: #fef2f2; color: #dc2626; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-icon { padding: 8px; border-radius: 8px; }

/* ─── RESPONSIVE ─── */
@media (max-width: 1024px) {
  .chart-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .kpi-grid { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }

  .data-table-container { overflow-x: auto; }
}

/* ─── ANIMATIONS ─── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.3s ease forwards; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.animate-pulse { animation: pulse 2s ease-in-out infinite; }

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ─── LOGIN PAGE ─── */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.login-card {
  background: white;
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo h1 {
  font-size: 28px;
  font-weight: 700;
  color: #0f172a;
}

.login-logo p {
  color: #64748b;
  font-size: 14px;
  margin-top: 4px;
}
