/* TongaAI Demo ERP — Main Stylesheet */
:root {
  --erp-primary: #c8102e;
  --erp-gold:    #f4c430;
  --erp-dark:    #1a1a2e;
  --sidebar-w:   240px;
  --navbar-h:    56px;
}

/* ---- NAVBAR ---- */
.erp-navbar {
  background: linear-gradient(90deg, #1a1a2e 0%, #0f3460 100%);
  height: var(--navbar-h);
  z-index: 1050;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}

/* ---- SIDEBAR ---- */
.erp-sidebar {
  width: var(--sidebar-w);
  min-height: calc(100vh - var(--navbar-h));
  background: #1a1a2e;
  flex-shrink: 0;
  overflow-y: auto;
  transition: width .25s ease;
  z-index: 1040;
}
.erp-sidebar.collapsed { width: 0; overflow: hidden; }
.sidebar-inner { padding-top: 8px; min-height: 100%; }
.sidebar-role { border-bottom: 1px solid rgba(255,255,255,.1); }

/* Sidebar links */
.sidebar-link {
  color: rgba(255,255,255,.75);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: .85rem;
  font-weight: 500;
  text-decoration: none;
  transition: all .15s;
  margin-bottom: 2px;
}
.sidebar-link:hover { background: rgba(255,255,255,.1); color: #fff; }
.sidebar-link.active { background: var(--erp-primary) !important; color: #fff !important; }
.sidebar-child {
  color: rgba(255,255,255,.6);
  font-size: .8rem;
  padding: 5px 10px;
  border-radius: 6px;
  text-decoration: none;
  display: block;
  transition: all .15s;
}
.sidebar-child:hover { color: #fff; background: rgba(255,255,255,.08); }
.sidebar-child.active { color: var(--erp-gold) !important; font-weight: 600; }
.sidebar-chevron { font-size: .7rem; transition: transform .2s; }
[aria-expanded="true"] .sidebar-chevron { transform: rotate(180deg); }

/* ---- MAIN CONTENT ---- */
.erp-main {
  min-height: calc(100vh - var(--navbar-h));
  background: #f4f6f9;
  overflow-x: hidden;
}

/* ---- KPI CARDS ---- */
.kpi-card {
  background: #fff;
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  border-left: 4px solid transparent;
  transition: transform .15s, box-shadow .15s;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,.1); }
.kpi-card.kpi-alert { animation: pulse-border 1.5s infinite; }
@keyframes pulse-border { 0%,100% { border-color: var(--erp-primary); } 50% { border-color: #ff6b6b; } }

.kpi-green  { border-left-color: #28a745; }
.kpi-red    { border-left-color: #dc3545; }
.kpi-blue   { border-left-color: #1976d2; }
.kpi-yellow { border-left-color: #ffc107; }
.kpi-orange { border-left-color: #fd7e14; }
.kpi-purple { border-left-color: #7b1fa2; }

.kpi-label { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: #6c757d; margin-bottom: 4px; }
.kpi-value { font-size: 1.4rem; font-weight: 700; color: #1a1a2e; line-height: 1.2; }
.kpi-sub   { font-size: .72rem; color: #6c757d; margin-top: 2px; }

/* ---- CARDS ---- */
.card { border: 1px solid #e9ecef; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.card-header { background: #fff; border-bottom: 1px solid #e9ecef; border-radius: 10px 10px 0 0 !important; }

/* ---- TABLES ---- */
.table th { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.table td { font-size: .85rem; vertical-align: middle; }
.btn-xs { font-size: .7rem; padding: .15rem .4rem; }

/* ---- BADGES ---- */
.badge { font-weight: 600; }

/* ---- PROGRESS ---- */
.progress { height: 8px; border-radius: 4px; }

/* ---- DEMO BANNER ---- */
.demo-mode-banner {
  background: linear-gradient(90deg, var(--erp-primary), var(--erp-gold));
  color: #fff;
  text-align: center;
  font-size: .75rem;
  font-weight: 700;
  padding: 4px;
  letter-spacing: 1px;
}

/* ---- PRINT ---- */
@media print {
  .erp-navbar, .erp-sidebar, .btn, .nav-tabs, .dataTables_wrapper .dataTables_filter,
  .dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_paginate { display: none !important; }
  .erp-main { margin: 0 !important; padding: 10px !important; background: #fff !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
  body { font-size: 11pt; }
  #printArea { page-break-inside: avoid; }
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .erp-sidebar { position: fixed; left: -240px; top: var(--navbar-h); height: calc(100% - var(--navbar-h)); transition: left .25s; z-index: 1045; }
  .erp-sidebar.mobile-open { left: 0; }
  .erp-main { margin-left: 0 !important; }
  .kpi-value { font-size: 1.1rem; }
}

/* ---- CHARTS ---- */
canvas { max-height: 280px; }

/* ---- LANGUAGE SWITCHER ---- */
.lang-toggle .btn-warning { color: #1a1a2e; font-weight: 700; }

/* ---- MODAL ---- */
.modal-header { border-bottom: none; }
.modal-footer { border-top: 1px solid #e9ecef; }

/* ---- FORMS ---- */
.form-label { font-weight: 600; font-size: .85rem; }
.form-control, .form-select { font-size: .9rem; }

/* ---- ALERTS ---- */
.alert { border-radius: 8px; }

/* ---- STATUS PILLS ---- */
.status-paid    { background: #d4edda; color: #155724; }
.status-unpaid  { background: #fff3cd; color: #856404; }
.status-overdue { background: #f8d7da; color: #721c24; }
.status-active  { background: #cce5ff; color: #004085; }

/* ---- INVOICE PRINT TEMPLATE ---- */
.invoice-print-header { border-bottom: 3px solid var(--erp-primary); padding-bottom: 16px; }
.invoice-line-total { font-weight: 700; color: var(--erp-primary); }

/* ---- GANTT (Projects) ---- */
.gantt-bar { height: 22px; border-radius: 4px; display: flex; align-items: center; padding: 0 8px; color: #fff; font-size: .75rem; font-weight: 600; }

/* ---- ANIMATIONS ---- */
.fade-in { animation: fadeIn .4s ease-in; }
@keyframes fadeIn { from { opacity:0; transform: translateY(8px); } to { opacity:1; transform: translateY(0); } }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a8a8a8; }
