/* =====================================================================
   Energy Future Tech - EFT Procurement AI
   Core stylesheet. Brand palette + dashboard shell + components.
   ===================================================================== */

:root {
  --eft-navy: #0B1F3A;
  --eft-navy-soft: #122a4d;
  --eft-navy-softer: #16315c;
  --eft-blue: #0D6EFD;
  --eft-green: #198754;
  --eft-bg: #F5F8FC;
  --eft-white: #FFFFFF;
  --eft-text: #1F2937;
  --eft-muted: #6B7280;
  --eft-border: #E5EAF2;
  --eft-radius: 0.85rem;
  --eft-radius-sm: 0.55rem;
  --eft-shadow: 0 1px 2px rgba(15, 31, 58, 0.04), 0 6px 18px rgba(15, 31, 58, 0.06);
  --eft-sidebar-width: 264px;
}

/* Keep Bootstrap's theme tokens in lock-step with the brand palette */
:root,
[data-bs-theme="light"] {
  --bs-primary: var(--eft-blue);
  --bs-primary-rgb: 13, 110, 253;
  --bs-success: var(--eft-green);
  --bs-success-rgb: 25, 135, 84;
  --bs-body-color: var(--eft-text);
  --bs-body-bg: var(--eft-bg);
  --bs-link-color: var(--eft-blue);
}

* { box-sizing: border-box; }

html, body {
  background: var(--eft-bg);
  color: var(--eft-text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

a { text-decoration: none; }

h1, h2, h3, h4, h5, h6 {
  color: var(--eft-navy);
  font-weight: 700;
}

.text-navy { color: var(--eft-navy) !important; }
.text-muted-eft { color: var(--eft-muted) !important; }
.bg-navy { background-color: var(--eft-navy) !important; }
.bg-eft-light { background-color: var(--eft-bg) !important; }

.btn-primary {
  background-color: var(--eft-blue);
  border-color: var(--eft-blue);
}
.btn-primary:hover, .btn-primary:focus {
  background-color: #0b5ed7;
  border-color: #0a58ca;
}
.btn-success { background-color: var(--eft-green); border-color: var(--eft-green); }
.btn-outline-navy {
  color: var(--eft-navy);
  border-color: var(--eft-navy);
}
.btn-outline-navy:hover {
  background-color: var(--eft-navy);
  color: var(--eft-white);
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--eft-border);
  background: var(--eft-white);
  color: var(--eft-navy);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  transition: background-color .15s ease, color .15s ease;
}
.btn-icon:hover { background-color: var(--eft-bg); }

/* ---------------------------------------------------------------------
   App shell (sidebar + main content)
   --------------------------------------------------------------------- */

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

.sidebar {
  width: var(--eft-sidebar-width);
  flex-shrink: 0;
  background: var(--eft-navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1040;
  transition: transform .25s ease;
}

.sidebar-brand {
  background: var(--eft-white);
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: .65rem;
  border-bottom: 1px solid var(--eft-border);
  min-height: 76px;
}
.sidebar-brand img { height: 34px; width: auto; object-fit: contain; }
.sidebar-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.sidebar-brand-text .brand-name { display: none; }
.sidebar-brand-text .brand-sub {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--eft-muted);
  text-transform: uppercase;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: .9rem .75rem 1.25rem; }
.sidebar-nav .nav-item { margin-bottom: .2rem; }
.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: rgba(255, 255, 255, 0.72);
  font-size: .92rem;
  font-weight: 500;
  padding: .62rem .85rem;
  border-radius: var(--eft-radius-sm);
  border-left: 3px solid transparent;
  transition: background-color .15s ease, color .15s ease;
}
.sidebar-nav .nav-link i { font-size: 1.05rem; width: 20px; text-align: center; }
.sidebar-nav .nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--eft-white);
}
.sidebar-nav .nav-link.active {
  background: rgba(13, 110, 253, 0.18);
  color: var(--eft-white);
  border-left-color: var(--eft-blue);
}
.sidebar-nav .badge { font-size: .65rem; }
.sidebar-logout { margin-top: .5rem; padding-top: .5rem; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.sidebar-logout .nav-link:hover { color: #ff8a8a; }

.main-wrapper {
  margin-left: var(--eft-sidebar-width);
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

/* ---------------------------------------------------------------------
   Topbar
   --------------------------------------------------------------------- */

.topbar {
  background: var(--eft-white);
  border-bottom: 1px solid var(--eft-border);
  height: 72px;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}
.topbar-brand img { height: 30px; width: auto; object-fit: contain; }
.topbar-spacer { flex: 1; }
.sidebar-toggle {
  border: 1px solid var(--eft-border);
  background: var(--eft-white);
  border-radius: var(--eft-radius-sm);
  width: 40px;
  height: 40px;
  color: var(--eft-navy);
  font-size: 1.2rem;
}
.topbar-actions { display: flex; align-items: center; gap: .65rem; }

.notification-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: .6rem;
  padding: .25em .42em;
}

.user-dropdown .btn-user {
  display: flex;
  align-items: center;
  gap: .6rem;
  background: var(--eft-white);
  border: 1px solid var(--eft-border);
  border-radius: 999px;
  padding: .3rem .75rem .3rem .3rem;
}
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--eft-navy);
  color: var(--eft-white);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
}
.user-meta { display: flex; flex-direction: column; text-align: left; line-height: 1.1; }
.user-meta .user-name { font-size: .82rem; font-weight: 600; color: var(--eft-text); }
.user-meta .user-role { font-size: .7rem; color: var(--eft-muted); }

/* Notification dropdown panel */
.notification-panel { width: 340px; padding: 0; border: 1px solid var(--eft-border); box-shadow: var(--eft-shadow); }
.notification-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 1rem;
  font-weight: 700;
  color: var(--eft-navy);
  border-bottom: 1px solid var(--eft-border);
}
.notification-panel-body { max-height: 320px; overflow-y: auto; }
.notification-item {
  display: flex;
  gap: .65rem;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--eft-border);
}
.notification-item.is-unread { background: rgba(13, 110, 253, 0.05); }
.notification-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: .4rem; flex-shrink: 0; }
.notification-title { font-size: .85rem; font-weight: 600; margin: 0; color: var(--eft-text); }
.notification-message { font-size: .78rem; color: var(--eft-muted); margin: .15rem 0 0; }
.notification-time { font-size: .7rem; color: var(--eft-muted); }
.notification-empty { text-align: center; padding: 2rem 1rem; color: var(--eft-muted); }
.notification-empty i { font-size: 1.8rem; display: block; margin-bottom: .4rem; }
.notification-panel-footer { padding: .65rem 1rem; text-align: center; border-top: 1px solid var(--eft-border); }
.notification-panel-footer a { font-size: .82rem; font-weight: 600; }

/* ---------------------------------------------------------------------
   Page content
   --------------------------------------------------------------------- */

.page-content { padding: 1.75rem; flex: 1; }
.page-title { font-size: 1.5rem; margin-bottom: .15rem; }
.page-subtitle { color: var(--eft-muted); font-size: .92rem; }

.page-footer {
  padding: 1rem 1.75rem;
  color: var(--eft-muted);
  font-size: .8rem;
  border-top: 1px solid var(--eft-border);
}

/* Cards */
.card {
  border: 1px solid var(--eft-border);
  border-radius: var(--eft-radius);
  box-shadow: var(--eft-shadow);
}
.card-header {
  background: var(--eft-white);
  border-bottom: 1px solid var(--eft-border);
  font-weight: 700;
  color: var(--eft-navy);
}

.stat-card {
  background: var(--eft-white);
  border: 1px solid var(--eft-border);
  border-radius: var(--eft-radius);
  box-shadow: var(--eft-shadow);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 100%;
}
.stat-card .stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--eft-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.stat-card .stat-value { font-size: 1.6rem; font-weight: 800; color: var(--eft-navy); line-height: 1.1; }
.stat-card .stat-label { font-size: .8rem; color: var(--eft-muted); font-weight: 600; }

.stat-icon.bg-soft-primary { background: rgba(13, 110, 253, .12); color: var(--eft-blue); }
.stat-icon.bg-soft-success { background: rgba(25, 135, 84, .12); color: var(--eft-green); }
.stat-icon.bg-soft-warning { background: rgba(255, 193, 7, .15); color: #b8860b; }
.stat-icon.bg-soft-danger  { background: rgba(220, 53, 69, .12); color: #dc3545; }
.stat-icon.bg-soft-navy    { background: rgba(11, 31, 58, .1); color: var(--eft-navy); }
.stat-icon.bg-soft-info    { background: rgba(13, 202, 240, .15); color: #0aa8c4; }
.stat-icon.bg-soft-secondary { background: rgba(107, 114, 128, .15); color: var(--eft-muted); }

/* Welcome / banner card on dashboards */
.welcome-card {
  background: linear-gradient(120deg, var(--eft-navy) 0%, #112a52 100%);
  border-radius: var(--eft-radius);
  color: var(--eft-white);
  padding: 2rem;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.welcome-card h2 { color: var(--eft-white); margin-bottom: .4rem; }
.welcome-card p { color: rgba(255,255,255,.78); max-width: 480px; margin-bottom: 0; }
.welcome-banner-img {
  max-width: 320px;
  width: 100%;
  border-radius: var(--eft-radius-sm);
}
.welcome-card .welcome-banner-img {
  background: rgba(255,255,255,.92);
  padding: .5rem;
}

/* Tables */
.table-responsive { border-radius: var(--eft-radius); overflow: hidden; border: 1px solid var(--eft-border); }
table.table { margin-bottom: 0; }
.table > thead { background: var(--eft-bg); }
.table > thead th {
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--eft-muted);
  font-weight: 700;
  border-bottom-width: 1px;
}
.table > :not(caption) > * > * { padding: .85rem 1rem; }

/* Forms */
.form-label { font-weight: 600; font-size: .85rem; color: var(--eft-text); }
.form-control, .form-select {
  border-color: var(--eft-border);
  border-radius: var(--eft-radius-sm);
  padding: .55rem .85rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--eft-blue);
  box-shadow: 0 0 0 .2rem rgba(13, 110, 253, .15);
}
.input-group-text { background: var(--eft-bg); border-color: var(--eft-border); }

/* Empty states / placeholders */
.placeholder-card { padding: 3.5rem 1.5rem; max-width: 640px; }
.placeholder-icon {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: rgba(13, 110, 253, .1);
  color: var(--eft-blue);
  font-size: 2.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--eft-muted); }
.empty-state i { font-size: 2rem; display: block; margin-bottom: .5rem; color: var(--eft-border); }

/* Report header preview (used by Reports placeholder) */
.report-header-preview {
  border: 1px solid var(--eft-border);
  border-radius: var(--eft-radius-sm);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--eft-white);
  margin-bottom: 1.5rem;
}
.report-header-preview img { height: 32px; width: auto; object-fit: contain; }

/* ---------------------------------------------------------------------
   Auth pages (login)
   --------------------------------------------------------------------- */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  background: var(--eft-bg);
}
.auth-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem 4rem;
  max-width: 560px;
}
.auth-logo { height: 46px; width: auto; object-fit: contain; margin-bottom: 1.75rem; }
.auth-system-name { font-size: 1.6rem; font-weight: 800; color: var(--eft-navy); margin-bottom: .25rem; }
.auth-tagline { color: var(--eft-blue); font-weight: 600; margin-bottom: 1rem; }
.auth-description { color: var(--eft-muted); margin-bottom: 2rem; }
.auth-card {
  background: var(--eft-white);
  border: 1px solid var(--eft-border);
  border-radius: var(--eft-radius);
  box-shadow: var(--eft-shadow);
  padding: 2rem;
}
.auth-right {
  flex: 1;
  background: linear-gradient(135deg, #0d2147 0%, var(--eft-navy) 60%, #0a1830 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
}
.auth-right img { max-width: 100%; border-radius: var(--eft-radius); box-shadow: 0 20px 45px rgba(0,0,0,.25); }
.auth-footer { margin-top: 1.5rem; color: var(--eft-muted); font-size: .82rem; }

/* ---------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------- */

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 31, 58, .45);
  z-index: 1035;
  display: none;
}
.sidebar-backdrop.show { display: block; }

@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.show {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0;
  }
}

@media (max-width: 767.98px) {
  .page-content { padding: 1.1rem; }
  .auth-page { flex-direction: column; }
  .auth-left { padding: 2rem 1.5rem; max-width: none; }
  .auth-right { padding: 2rem; min-height: 280px; }
  .welcome-card { flex-direction: column; text-align: center; }
}

/* ---------------------------------------------------------------------
   Print (comparison pages, AI reports, printable reports)
   --------------------------------------------------------------------- */

.highlight-best { background-color: rgba(25, 135, 84, .12) !important; font-weight: 700; }
.highlight-risk { background-color: rgba(220, 53, 69, .1) !important; }

@media print {
  .sidebar, .topbar, .page-footer, .page-actions, .no-print { display: none !important; }
  .main-wrapper { margin-left: 0 !important; }
  .page-content { padding: 0 !important; }
  body { background: var(--eft-white) !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; }
}
