/* ==========================================================================
   BI Connect - Main Stylesheet (High-Contrast Light & Dark Themes)
   Official Identity: Power BI Yellow (#F2C811) & Deep Black (#090C12)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Outfit:wght@500;600;700;800&display=swap');

:root {
  /* Default Dark Mode (Deep Black & Power BI Yellow) */
  --bg-app: #090c12;
  --bg-surface: #111520;
  --bg-surface-subtle: #171d2b;
  --bg-input: #0e121b;
  --bg-sidebar: #07090e;
  --bg-sidebar-hover: rgba(242, 200, 17, 0.08);

  /* Power BI Yellow */
  --brand-yellow: #f2c811;
  --brand-yellow-hover: #d9b208;
  --brand-yellow-subtle: rgba(242, 200, 17, 0.12);
  --brand-yellow-border: rgba(242, 200, 17, 0.35);

  /* Primary Brand */
  --primary: #f2c811;
  --primary-hover: #e0b808;
  --primary-subtle: rgba(242, 200, 17, 0.12);
  --primary-border: rgba(242, 200, 17, 0.35);
  --primary-text: #000000;

  /* Borders */
  --border-color: #1f2738;
  --border-subtle: #2a3449;
  --border-focus: #f2c811;

  /* Typography Colors */
  --text-main: #ffffff;
  --text-body: #cbd5e1;
  --text-muted: #8b99ad;
  --text-light: #64748b;
  --text-sidebar: #f8fafc;
  --text-sidebar-muted: #8b99ad;

  /* Status Colors */
  --color-paid: #10b981;
  --bg-paid: rgba(16, 185, 129, 0.12);
  --border-paid: rgba(16, 185, 129, 0.3);

  --color-pending: #f59e0b;
  --bg-pending: rgba(245, 158, 11, 0.12);
  --border-pending: rgba(245, 158, 11, 0.3);

  --color-profit: #f2c811;
  --bg-profit: rgba(242, 200, 17, 0.12);
  --border-profit: rgba(242, 200, 17, 0.35);

  --color-danger: #ef4444;
  --bg-danger: rgba(239, 68, 68, 0.12);
  --border-danger: rgba(239, 68, 68, 0.3);

  /* Shadows & Glow */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 2px 5px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.75);
  --glow-yellow: 0 0 20px rgba(242, 200, 17, 0.25);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 9999px;

  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --transition: all 0.18s ease-in-out;
}

/* ==========================================================================
   HIGH-CONTRAST LIGHT THEME (Perfect legibility, deep dark text, clear badges)
   ========================================================================== */
body.light-theme {
  --bg-app: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-surface-subtle: #f8fafc;
  --bg-input: #ffffff;
  --bg-sidebar: #0b0e14; /* Deep crisp contrast sidebar */
  --bg-sidebar-hover: rgba(242, 200, 17, 0.15);

  /* Power BI Yellow & Amber for Light mode */
  --brand-yellow: #d97706; /* Rich golden amber for readable text on light cards */
  --brand-yellow-hover: #b45309;
  --brand-yellow-subtle: #fef3c7;
  --brand-yellow-border: #fcd34d;

  --primary: #f2c811; /* Buttons still use Power BI yellow background */
  --primary-hover: #eab308;
  --primary-subtle: #fef9c3;
  --primary-border: #fde047;
  --primary-text: #000000; /* Crisp black on yellow buttons */

  --border-color: #cbd5e1;
  --border-subtle: #94a3b8;
  --border-focus: #d97706;

  /* Typography: High-Contrast Dark on White */
  --text-main: #0f172a;
  --text-body: #1e293b;
  --text-muted: #475569;
  --text-light: #64748b;
  --text-sidebar: #ffffff;
  --text-sidebar-muted: #94a3b8;

  /* High-Contrast Status Colors */
  --color-paid: #047857;
  --bg-paid: #ecfdf5;
  --border-paid: #6ee7b7;

  --color-pending: #b45309;
  --bg-pending: #fffbeb;
  --border-pending: #fcd34d;

  --color-profit: #b45309;
  --bg-profit: #fef9c3;
  --border-profit: #fde047;

  --color-danger: #b91c1c;
  --bg-danger: #fef2f2;
  --border-danger: #fca5a5;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 24px rgba(0, 0, 0, 0.12);
  --glow-yellow: 0 0 15px rgba(217, 119, 6, 0.2);
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-body);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-main);
  font-weight: 700;
  letter-spacing: -0.02em;
}

p {
  color: var(--text-muted);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Layout */
.app-container {
  display: flex;
  width: 100vw;
  min-height: 100vh;
  position: relative;
  z-index: 1;
  background: transparent;
}

/* Sidebar BI Connect */
.sidebar {
  width: 270px;
  background-color: var(--bg-sidebar);
  color: var(--text-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 50;
  border-right: 1px solid var(--border-color);
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-badge-bi {
  width: 44px;
  height: 44px;
  background: #000000;
  border: 2px solid #f2c811;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(242, 200, 17, 0.35);
}

.brand-badge-bi .bi-text {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 1.25rem;
  color: #f2c811;
  letter-spacing: -0.05em;
}

.brand-info h1 {
  font-size: 1.15rem;
  color: #ffffff;
  font-weight: 800;
  line-height: 1.1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-info h1 span {
  color: #f2c811;
}

.brand-info p {
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Navigation Links */
.nav-menu {
  list-style: none;
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  font-weight: 700;
  padding: 10px 12px 4px 12px;
}

.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-sidebar-muted);
  font-family: var(--font-family);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}

.nav-btn svg {
  width: 18px;
  height: 18px;
  color: #94a3b8;
  transition: var(--transition);
}

.nav-btn:hover {
  background: var(--bg-sidebar-hover);
  color: #ffffff;
}

.nav-btn:hover svg {
  color: #f2c811;
}

.nav-btn.active {
  background: #f2c811;
  color: #000000;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(242, 200, 17, 0.35);
}

.nav-btn.active svg {
  color: #000000;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.theme-toggle-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.theme-toggle-btn:hover {
  border-color: #f2c811;
  color: #f2c811;
}

/* Main Content Wrapper */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
}

/* Top App Header - Compact & Crisp */
.top-header {
  height: 56px;
  padding: 0 24px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.active-company-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
}

.active-company-badge .icon {
  width: 24px;
  height: 24px;
  background-color: #f2c811;
  color: #000000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.75rem;
}

.active-company-badge {
  max-width: 320px;
  overflow: hidden;
}

.active-company-badge .info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.company-select-inline {
  background: transparent;
  border: none;
  font-family: var(--font-family);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
  max-width: 240px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.company-select-inline option {
  background: var(--bg-surface);
  color: var(--text-main);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-profit-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--bg-profit);
  border: 1px solid var(--border-profit);
  font-size: 0.78rem;
}

.header-profit-pill .label {
  color: var(--brand-yellow);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.header-profit-pill .val {
  font-family: var(--font-heading);
  font-weight: 800;
  color: var(--text-main);
}

/* Content Area - Compact padding */
.content-area {
  padding: 16px 24px 40px 24px;
  flex: 1;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.2s ease-in-out;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1024px) {
  .sidebar { width: 230px; }
  .content-area { padding: 20px; }
  .top-header { padding: 0 20px; }
}
