/* ============================================================
   Wavenex WXOS — Main Stylesheet
   ============================================================ */

:root {
  --sidebar-w: 240px;
  --sidebar-bg: #0a1628;
  --sidebar-hover: #162035;
  --sidebar-active: #1a56db;
  --brand-primary: #1a56db;
  --brand-gradient: linear-gradient(135deg, #1a56db 0%, #0ea5e9 100%);
  --topbar-h: 58px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
}

* { box-sizing: border-box; }
body { font-family: var(--font); background: #f1f5f9; color: #1e293b; margin: 0; }

/* ── LOGIN ─────────────────────────────────────────────────── */
.login-body {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
}
.login-wrapper { width: 100%; max-width: 420px; padding: 1rem; }
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 2.5rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-logo { text-align: center; margin-bottom: 1.5rem; }
.login-logo-img {
  width: 80px; height: 80px;
  object-fit: contain;
  border-radius: 16px;
  background: #fff;
  padding: 4px;
}
.login-icon {
  width: 64px; height: 64px; border-radius: 16px;
  background: var(--brand-gradient);
  color: #fff; font-size: 1.8rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(26,86,219,.4);
}

/* ── SIDEBAR ───────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
  z-index: 1000;
  transition: transform .25s ease;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.brand-logo-img {
  width: 36px; height: 36px; border-radius: 8px;
  object-fit: contain; flex-shrink: 0;
  background: rgba(255,255,255,.08);
  padding: 2px;
}
.brand-logo {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  background: var(--brand-gradient);
  color: #fff; font-weight: 700; font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
}
.brand-name { color: #fff; font-weight: 700; font-size: .95rem; line-height: 1.2; }
.brand-sub  { color: rgba(255,255,255,.45); font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; }

.sidebar-section-label {
  padding: 12px 16px 4px;
  font-size: .63rem; font-weight: 600; letter-spacing: .08em;
  color: rgba(255,255,255,.3); text-transform: uppercase;
}
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; margin: 1px 8px;
  border-radius: 8px; text-decoration: none;
  color: rgba(255,255,255,.7); font-size: .875rem; font-weight: 500;
  transition: all .15s;
}
.sidebar-link:hover  { background: var(--sidebar-hover); color: #fff; }
.sidebar-link.active { background: var(--brand-gradient); color: #fff; }
.sidebar-link i      { font-size: 1rem; opacity: .9; }

.sidebar-footer {
  margin-top: auto;
  padding: 14px;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex; align-items: center; gap: 8px;
}

/* ── MAIN CONTENT ──────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
}
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 0 #e2e8f0;
}
.topbar-title { font-weight: 600; font-size: 1rem; color: #1e293b; }
.page-body { padding: 24px; flex: 1; }

/* ── CARDS ─────────────────────────────────────────────────── */
.card {
  border: 1px solid #e2e8f0 !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow) !important;
}
.card-header {
  background: #fff !important;
  border-bottom: 1px solid #e2e8f0 !important;
  border-radius: var(--radius) var(--radius) 0 0 !important;
  padding: 12px 16px !important;
}

/* ── STAT CARDS ─────────────────────────────────────────────── */
.stat-card {
  border-radius: var(--radius);
  padding: 20px 20px 16px;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow);
  border: none;
}
.stat-card::after {
  content: '';
  position: absolute; right: -10px; top: -10px;
  width: 80px; height: 80px; border-radius: 50%;
  background: rgba(255,255,255,.12);
}
.stat-blue   { background: var(--brand-gradient); color: #fff; }
.stat-green  { background: linear-gradient(135deg, #16a34a, #15803d); color: #fff; }
.stat-orange { background: linear-gradient(135deg, #ea580c, #c2410c); color: #fff; }
.stat-purple { background: linear-gradient(135deg, #7c3aed, #6d28d9); color: #fff; }
.stat-icon   { font-size: 1.4rem; opacity: .85; margin-bottom: 8px; }
.stat-value  { font-size: 1.7rem; font-weight: 700; line-height: 1; }
.stat-label  { font-size: .75rem; opacity: .8; margin-top: 4px; }

/* ── KPI CARDS (project detail) ─────────────────────────────── */
.kpi-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.kpi-label { font-size: .72rem; font-weight: 500; color: #64748b; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.kpi-val   { font-size: 1.3rem; font-weight: 700; color: #1e293b; }

/* ── METRIC MINI (project cards) ────────────────────────────── */
.metric-mini { background: #f8fafc; border-radius: 8px; padding: 8px 10px; }
.metric-val  { font-size: .85rem; font-weight: 700; color: #1e293b; }
.metric-lbl  { font-size: .67rem; color: #94a3b8; margin-top: 1px; }

/* ── PROJECT CARDS ─────────────────────────────────────────── */
.project-card { transition: transform .15s, box-shadow .15s; }
.project-card:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(0,0,0,.1) !important; }
.project-header-card { border-left: 4px solid #2563eb !important; }

/* ── AVATAR ─────────────────────────────────────────────────── */
.avatar-sm {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  color: #fff; font-size: .7rem; font-weight: 700;
  flex-shrink: 0;
  border: 2px solid #fff;
}

/* ── SMALL BUTTONS ──────────────────────────────────────────── */
.btn-xs {
  padding: 2px 7px; font-size: .75rem;
  border-radius: 5px; line-height: 1.5;
}

/* ── TIMESHEET GRID ─────────────────────────────────────────── */
.timesheet-grid th { white-space: nowrap; font-size: .78rem; }
.ts-cell { cursor: pointer; }
.ts-cell:hover { opacity: .75; }

/* ── GANTT CHART ────────────────────────────────────────────── */
.gantt-wrapper { padding: 8px 0; }
.gantt-content { display: flex; }
.gantt-labels-column { width: 220px; min-width: 220px; flex-shrink: 0; }
.gantt-timelines-column { flex: 1; overflow-x: auto; overflow-y: hidden; }
.gantt-header  {
  display: flex; border-bottom: 1px solid #e2e8f0;
  background: #f8fafc; padding: 8px 0;
  height: 40px;
}
.gantt-row {
  display: flex; align-items: center;
  border-bottom: 1px solid #f1f5f9;
  padding: 6px 0;
  height: 44px;
}
.gantt-row:hover .gantt-label-col { background: #f8fafc; }
.gantt-label-col {
  width: 220px; min-width: 220px;
  padding: 0 12px;
  display: flex; flex-direction: column; justify-content: center;
  flex-shrink: 0;
  gap: 2px;
  overflow: hidden;
}
.gantt-label-col a {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.gantt-label-col .text-muted {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gantt-header .gantt-label-col {
  font-size: .75rem; font-weight: 600; color: #64748b;
  text-transform: uppercase; letter-spacing: .04em;
  align-items: flex-start;
}
.gantt-timeline {
  position: relative;
  display: flex;
  align-items: center;
  margin-right: 12px;
  flex: 1;
}
.gantt-header .gantt-timeline { min-height: 24px; }
.gantt-bar {
  position: absolute; top: 50%; transform: translateY(-50%);
  height: 20px; border-radius: 10px;
  display: flex; align-items: center; padding: 0 8px;
  min-width: 24px; z-index: 2;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
  transition: opacity .15s;
}
.gantt-bar:hover { opacity: .85; }
.gantt-bar span { color: #fff; font-size: .68rem; font-weight: 700; white-space: nowrap; }
.gantt-alloc {
  position: absolute; top: 50%; transform: translateY(-50%);
  height: 8px; border-radius: 4px;
  background: rgba(0,0,0,.06);
  left: 0;
}
.gantt-month-label {
  position: absolute; top: 2px;
  font-size: .65rem; color: #94a3b8; font-weight: 500;
  white-space: nowrap;
}
.gantt-today {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: #ef4444; z-index: 3;
}
.gantt-today span {
  position: absolute; top: -4px; left: 4px;
  font-size: .6rem; color: #ef4444; font-weight: 700;
  white-space: nowrap;
}

/* ── TABLES ─────────────────────────────────────────────────── */
.table { font-size: .875rem; }
.table th { font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: #64748b; }
.table-hover > tbody > tr:hover > td { background-color: #f8fafc; }

/* ── FORMS ──────────────────────────────────────────────────── */
.form-control, .form-select {
  border-color: #e2e8f0;
  border-radius: 8px;
  font-size: .875rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}
.input-group-text {
  background: #f8fafc; border-color: #e2e8f0;
  color: #64748b;
}

/* ── MODAL ──────────────────────────────────────────────────── */
.modal-content { border-radius: 14px !important; border: 0 !important; }
.modal-header  { border-bottom: 1px solid #e2e8f0 !important; border-radius: 14px 14px 0 0 !important; }
.modal-footer  { border-top: 1px solid #e2e8f0 !important; }

/* ── BADGES ─────────────────────────────────────────────────── */
.badge { font-weight: 500 !important; }

/* ── ALERTS ─────────────────────────────────────────────────── */
.alert { border-radius: var(--radius) !important; }

/* ── BREADCRUMB ─────────────────────────────────────────────── */
.breadcrumb { font-size: .85rem; }

/* ── PROGRESS ───────────────────────────────────────────────── */
.progress { border-radius: 99px !important; background: #e2e8f0; }

/* ── SCROLLBAR (webkit) ──────────────────────────────────────── */
::-webkit-scrollbar         { width: 5px; height: 5px; }
::-webkit-scrollbar-track   { background: transparent; }
::-webkit-scrollbar-thumb   { background: #cbd5e1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 40px rgba(0,0,0,.4);
  }
  .main-content { margin-left: 0; }
}

@media (max-width: 576px) {
  .page-body { padding: 12px; }
  .stat-value { font-size: 1.3rem; }
}

/* ── PRINT ──────────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-body { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* ── SEARCH TOOLBAR ─────────────────────────────────────────── */
.search-box { position: relative; min-width: 220px; }
.search-box .bi { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #94a3b8; pointer-events: none; }
.search-box input { padding-left: 32px; }

/* ── CALENDAR VIEW ──────────────────────────────────────────── */
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 3px; }
.cal-head-cell {
  text-align: center; font-size: .7rem; font-weight: 600;
  color: #64748b; padding: 6px 2px; text-transform: uppercase; letter-spacing: .04em;
}
.cal-cell {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 8px;
  padding: 7px 8px; min-height: 78px; position: relative;
  transition: background .1s;
}
.cal-cell.other-month { background: #f8fafc; opacity: .55; }
.cal-cell.today        { border-color: var(--brand-primary); background: #eff6ff; }
.cal-cell.holiday      { background: #fffbeb; border-color: #f59e0b; }
.cal-cell.weekend      { background: #fafafa; }
.cal-cell:not(.other-month):hover { background: #f0f9ff; cursor: pointer; }
.cal-day-num { font-size: .82rem; font-weight: 600; color: #374151; }
.cal-cell.today .cal-day-num { color: var(--brand-primary); }
.cal-cell.other-month .cal-day-num { color: #94a3b8; }
.cal-hours-chip {
  display: inline-block; margin-top: 5px;
  background: var(--brand-primary); color: #fff;
  font-size: .68rem; font-weight: 700;
  border-radius: 99px; padding: 2px 7px;
}
.cal-holiday-name {
  display: block; font-size: .6rem; color: #92400e;
  background: #fde68a; border-radius: 4px;
  padding: 1px 5px; margin-top: 3px; line-height: 1.5;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── MONTHLY ANALYTICS ──────────────────────────────────────── */
.proj-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.proj-bar-label { width: 160px; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-bar-track { flex: 1; background: #e2e8f0; border-radius: 99px; height: 8px; }
.proj-bar-fill  { height: 8px; border-radius: 99px; background: var(--brand-gradient); }
.proj-bar-pct   { width: 42px; text-align: right; font-size: .78rem; font-weight: 600; color: #64748b; }

/* ── CLIENT LIST VIEW ───────────────────────────────────────── */
.client-list-row {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 12px 16px; display: flex; align-items: center;
  gap: 14px; transition: box-shadow .15s;
}
.client-list-row:hover { box-shadow: 0 2px 14px rgba(0,0,0,.08); }
.client-list-avatar {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  background: var(--brand-gradient);
  color: #fff; font-weight: 700; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
}
.client-list-name { font-weight: 600; font-size: .9rem; margin-bottom: 2px; }
.client-list-meta { font-size: .78rem; color: #64748b; }

/* ── VIEW TOGGLE ────────────────────────────────────────────── */
.view-btn.active { background: var(--brand-primary) !important; border-color: var(--brand-primary) !important; color: #fff !important; }

/* ── DASHBOARD GANTT ────────────────────────────────────────── */
.dash-gantt-label { width: 200px; min-width: 200px; flex-shrink: 0; padding: 0 12px; font-size: .82rem; }
.dash-gantt-bar-wrap { flex: 1; position: relative; height: 34px; margin-right: 12px; }
.dash-gantt-bar {
  position: absolute; top: 50%; transform: translateY(-50%);
  height: 22px; border-radius: 11px; min-width: 28px;
  display: flex; align-items: center; padding: 0 10px;
  z-index: 2; box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.dash-gantt-bar span { color: #fff; font-size: .67rem; font-weight: 700; white-space: nowrap; overflow: hidden; }
.dash-gantt-stage-badge {
  position: absolute; top: 50%; transform: translateY(-50%);
  right: 16px; font-size: .62rem; font-weight: 700;
  color: #fff; border-radius: 99px; padding: 2px 7px; white-space: nowrap;
}
