/* ============================================================
   Green Stream / NanoBanana — Opportunity Tracker
   Custom CSS — Arabic RTL Dashboard
   ============================================================ */

/* ── Base typography ─────────────────────────────────────── */
body {
  font-family: 'Noto Kufi Arabic', Tahoma, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Noto Kufi Arabic', Tahoma, Arial, sans-serif;
  font-weight: 700;
}

/* ── Layout ──────────────────────────────────────────────── */
.sidebar {
  width: 240px;
  min-height: 100vh;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
  transition: transform 0.3s ease;
  z-index: 100;
}

.main-content {
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 52px;
}

/* Sidebar nav links */
.sidebar .nav-link {
  padding: 0.6rem 1rem;
  border-radius: 6px;
  margin: 2px 8px;
  font-size: 13.5px;
  transition: background 0.15s;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
  background: rgba(255, 255, 255, 0.12);
}

.sidebar .nav-link.active {
  background: #1d4ed8;
  font-weight: 600;
}

/* Mobile sidebar */
@media (max-width: 767px) {
  .sidebar {
    position: fixed;
    right: 0;
    top: 0;
    transform: translateX(100%);
    box-shadow: -4px 0 20px rgba(0,0,0,0.3);
  }
  .sidebar.sidebar-open {
    transform: translateX(0);
  }
  .main-content {
    width: 100%;
  }
}

/* ── KPI cards ───────────────────────────────────────────── */
.kpi-card {
  transition: transform 0.15s, box-shadow 0.15s;
  border-radius: 10px;
  cursor: pointer;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.1) !important;
}

.kpi-urgent {
  border: 2px solid #dc3545 !important;
  animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
  0%, 100% { border-color: #dc3545; }
  50%       { border-color: #ff8fa3; }
}

.kpi-value {
  line-height: 1;
}

.kpi-label {
  font-size: 11px;
  line-height: 1.3;
}

/* ── Table enhancements ──────────────────────────────────── */
.table th {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}

.row-stale {
  opacity: 0.75;
  background: rgba(108, 117, 125, 0.05);
}

/* ── Status badges ───────────────────────────────────────── */
.badge {
  font-family: 'Noto Kufi Arabic', Tahoma, sans-serif;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 20px;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
  border-radius: 10px;
}

.card-header {
  font-size: 14px;
  padding: 12px 16px;
}

/* ── Forms ───────────────────────────────────────────────── */
.form-control, .form-select {
  font-family: 'Noto Kufi Arabic', Tahoma, sans-serif;
  font-size: 14px;
  border-radius: 8px;
}

.form-control:focus, .form-select:focus {
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.15);
  border-color: #1d4ed8;
}

/* ── Timeline (activity log) ─────────────────────────────── */
.timeline-item {
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  right: 7px;
  top: 24px;
  width: 2px;
  height: calc(100% + 4px);
  background: #e5e7eb;
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-icon {
  width: 18px;
  font-size: 15px;
  position: relative;
  z-index: 1;
}

/* ── Pagination ──────────────────────────────────────────── */
.page-link {
  font-size: 13px;
  padding: 4px 10px;
}

/* ── Alert flash ─────────────────────────────────────────── */
.alert {
  border-radius: 8px;
  font-size: 13.5px;
}

/* ── Page header ─────────────────────────────────────────── */
.page-header h4 {
  font-size: 1.2rem;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  font-family: 'Noto Kufi Arabic', Tahoma, sans-serif;
  font-size: 13.5px;
  border-radius: 8px;
}

.btn-primary {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.btn-primary:hover {
  background: #1e40af;
  border-color: #1e40af;
}

/* ── Dark mode overrides ─────────────────────────────────── */
[data-bs-theme="dark"] .sidebar {
  background: #111827 !important;
}

[data-bs-theme="dark"] .topbar {
  background: #1f2937 !important;
  border-color: #374151 !important;
}

[data-bs-theme="dark"] .card {
  background: #1f2937;
  border-color: #374151;
}

[data-bs-theme="dark"] .table-light th,
[data-bs-theme="dark"] .card-header {
  background: rgba(255,255,255,0.05) !important;
}

[data-bs-theme="dark"] .kpi-card {
  background: #1f2937;
  border-color: #374151 !important;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
  background: #374151;
  border-color: #4b5563;
  color: #f9fafb;
}

/* ── Loading states ──────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  display: none;
}

.loading-overlay.active {
  display: flex;
}

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

/* ── Print ───────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .btn, .no-print { display: none !important; }
  .main-content { margin: 0 !important; }
  body { font-size: 12px; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}
