/* ============================================================
   TenderPortal — portal.css
   Design: Deep navy slate + amber gold, utilitarian precision
   ============================================================ */

:root {
  --tp-navy:        #0f172a;
  --tp-navy-2:      #1e293b;
  --tp-navy-3:      #334155;
  --tp-slate:       #475569;
  --tp-slate-light: #94a3b8;
  --tp-border:      #e2e8f0;
  --tp-bg:          #f1f5f9;
  --tp-white:       #ffffff;
  --tp-gold:        #f59e0b;
  --tp-gold-light:  #fef3c7;
  --tp-success:     #10b981;
  --tp-danger:      #ef4444;
  --tp-warning:     #f59e0b;
  --tp-info:        #3b82f6;
  --tp-sidebar-w:   260px;
  --tp-topbar-h:    60px;
  --tp-radius:      10px;
  --tp-shadow:      0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.04);
  --tp-shadow-lg:   0 8px 32px rgba(0,0,0,.12);
  --tp-font:        'DM Sans', sans-serif;
  --tp-mono:        'JetBrains Mono', monospace;
  --tp-transition:  0.22s cubic-bezier(0.4,0,0.2,1);
}

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  font-family: var(--tp-font);
  background: var(--tp-bg);
  color: var(--tp-navy);
  font-size: 14px;
  line-height: 1.6;
}

/* ── Layout ──────────────────────────────────────────────── */
.tp-sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--tp-sidebar-w);
  height: 100vh;
  background: var(--tp-navy);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: width var(--tp-transition), transform var(--tp-transition);
  overflow: hidden;
}

.tp-sidebar.collapsed {
  width: 64px;
}

.tp-content {
  margin-left: var(--tp-sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--tp-transition);
}

.tp-content.expanded {
  margin-left: 64px;
}

/* ── Sidebar Brand ───────────────────────────────────────── */
.tp-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  min-height: 72px;
  overflow: hidden;
  white-space: nowrap;
}

.tp-brand-icon {
  width: 36px; height: 36px;
  background: var(--tp-gold);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--tp-navy);
  font-size: 18px;
  flex-shrink: 0;
}

.tp-brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--tp-white);
  letter-spacing: -.3px;
}

.tp-brand-sub {
  font-size: 10px;
  color: var(--tp-slate-light);
  text-transform: uppercase;
  letter-spacing: .6px;
}

/* ── Navigation ──────────────────────────────────────────── */
.tp-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
}

.tp-nav::-webkit-scrollbar { width: 4px; }
.tp-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.tp-nav-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--tp-slate-light);
  padding: 16px 10px 6px;
  white-space: nowrap;
  overflow: hidden;
}

.collapsed .tp-nav-label {
  opacity: 0;
  height: 0;
  padding: 0;
}

.tp-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--tp-transition);
  white-space: nowrap;
  overflow: hidden;
  position: relative;
  margin-bottom: 2px;
}

.tp-nav-item i {
  font-size: 16px;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.tp-nav-item:hover {
  background: rgba(255,255,255,.08);
  color: var(--tp-white);
}

.tp-nav-item.active {
  background: var(--tp-gold);
  color: var(--tp-navy);
  font-weight: 600;
}

.tp-badge {
  margin-left: auto;
  background: var(--tp-danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  flex-shrink: 0;
}

.collapsed .tp-nav-item span,
.collapsed .tp-badge { display: none; }

/* Collapsed: icon-only — hide brand text, user name/role/logout, nav labels */
.collapsed .tp-brand-name,
.collapsed .tp-brand-sub    { display: none; }
.collapsed .tp-sidebar-brand{ justify-content: center; padding: 20px 0; }
.collapsed .tp-user-info .tp-user-name,
.collapsed .tp-user-info .tp-user-role { display: none; }
.collapsed .tp-logout       { display: none; }
.collapsed .tp-sidebar-footer { justify-content: center; padding: 12px 0; }
.collapsed .tp-nav-item     { justify-content: center; padding: 10px 0; }
.collapsed .tp-nav-item i   { width: auto; margin: 0; }

/* ── Sidebar Footer ──────────────────────────────────────── */
.tp-sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.tp-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
}

.tp-user-avatar {
  width: 32px; height: 32px;
  background: var(--tp-gold);
  color: var(--tp-navy);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.tp-user-avatar-sm {
  width: 28px; height: 28px;
  background: var(--tp-navy-2);
  color: var(--tp-gold);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}

.tp-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--tp-white);
}

.tp-user-role {
  font-size: 11px;
  color: var(--tp-slate-light);
}

.tp-logout {
  color: var(--tp-slate-light);
  font-size: 18px;
  text-decoration: none;
  transition: color var(--tp-transition);
  flex-shrink: 0;
}

.tp-logout:hover { color: var(--tp-danger); }

/* ── Topbar ──────────────────────────────────────────────── */
.tp-topbar {
  height: var(--tp-topbar-h);
  background: var(--tp-white);
  border-bottom: 1px solid var(--tp-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--tp-shadow);
}

.tp-topbar-left, .tp-topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tp-toggle-btn {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--tp-slate);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background var(--tp-transition);
}

.tp-toggle-btn:hover { background: var(--tp-border); }

.breadcrumb {
  font-size: 13px;
  margin: 0;
}

.breadcrumb-item + .breadcrumb-item::before { color: var(--tp-slate-light); }

.tp-date-badge {
  font-size: 12px;
  font-family: var(--tp-mono);
  color: var(--tp-slate);
  background: var(--tp-bg);
  padding: 4px 10px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Page Body ───────────────────────────────────────────── */
.tp-page-body {
  flex: 1;
  padding: 28px 28px 16px;
}

.tp-page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--tp-navy);
  margin-bottom: 20px;
  letter-spacing: -.4px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Cards ───────────────────────────────────────────────── */
.tp-card {
  background: var(--tp-white);
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius);
  box-shadow: var(--tp-shadow);
  overflow: hidden;
}

.tp-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--tp-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 14px;
  color: var(--tp-navy-2);
}

.tp-card-body { padding: 20px; }

/* ── Stat Cards ──────────────────────────────────────────── */
.tp-stat {
  background: var(--tp-white);
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--tp-shadow);
  transition: transform var(--tp-transition), box-shadow var(--tp-transition);
}

.tp-stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--tp-shadow-lg);
}

.tp-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--tp-slate);
  font-weight: 600;
  margin-bottom: 8px;
}

.tp-stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--tp-navy);
  letter-spacing: -.5px;
  line-height: 1;
  margin-bottom: 6px;
}

.tp-stat-sub {
  font-size: 12px;
  color: var(--tp-slate-light);
}

.tp-stat-icon {
  position: absolute;
  top: 16px; right: 16px;
  width: 44px; height: 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 20px;
}

.tp-stat-icon.gold    { background: var(--tp-gold-light);    color: var(--tp-gold); }
.tp-stat-icon.success { background: #d1fae5;                  color: var(--tp-success); }
.tp-stat-icon.danger  { background: #fee2e2;                  color: var(--tp-danger); }
.tp-stat-icon.info    { background: #dbeafe;                  color: var(--tp-info); }
.tp-stat-icon.slate   { background: var(--tp-bg);             color: var(--tp-slate); }

/* ── Alert Cards ─────────────────────────────────────────── */
.tp-alert-card {
  background: var(--tp-white);
  border: 1px solid var(--tp-border);
  border-left: 4px solid transparent;
  border-radius: var(--tp-radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  transition: all var(--tp-transition);
  text-decoration: none;
  color: inherit;
}

.tp-alert-card:hover { box-shadow: var(--tp-shadow); color: inherit; }
.tp-alert-card.danger  { border-left-color: var(--tp-danger); }
.tp-alert-card.warning { border-left-color: var(--tp-warning); }
.tp-alert-card.success { border-left-color: var(--tp-success); }

.tp-alert-icon {
  width: 38px; height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}

.tp-alert-card.danger  .tp-alert-icon { background: #fee2e2; color: var(--tp-danger); }
.tp-alert-card.warning .tp-alert-icon { background: #fef3c7; color: var(--tp-gold); }
.tp-alert-card.success .tp-alert-icon { background: #d1fae5; color: var(--tp-success); }

/* ── Tables ──────────────────────────────────────────────── */
.tp-table-wrap {
  overflow-x: auto;
  border-radius: var(--tp-radius);
  border: 1px solid var(--tp-border);
  background: var(--tp-white);
  box-shadow: var(--tp-shadow);
}

.table { margin-bottom: 0; font-size: 13.5px; }
.table th {
  background: var(--tp-navy);
  color: rgba(255,255,255,.9);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 600;
  padding: 12px 14px;
  border: none;
  white-space: nowrap;
}

.table td {
  padding: 11px 14px;
  vertical-align: middle;
  border-color: var(--tp-border);
  color: var(--tp-navy-2);
}

.table tbody tr { transition: background var(--tp-transition); }
.table tbody tr:hover { background: var(--tp-bg); }

/* ── Forms ───────────────────────────────────────────────── */
.form-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--tp-slate);
  margin-bottom: 5px;
}

.form-control, .form-select {
  border: 1px solid var(--tp-border);
  border-radius: 7px;
  font-size: 13.5px;
  padding: 8px 12px;
  transition: all var(--tp-transition);
  font-family: var(--tp-font);
}

.form-control:focus, .form-select:focus {
  border-color: var(--tp-gold);
  box-shadow: 0 0 0 3px rgba(245,158,11,.12);
}

.input-group-text {
  background: var(--tp-bg);
  border-color: var(--tp-border);
  font-size: 13px;
  color: var(--tp-slate);
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  font-size: 13px;
  font-weight: 600;
  border-radius: 7px;
  padding: 8px 16px;
  transition: all var(--tp-transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--tp-navy);
  border-color: var(--tp-navy);
  color: var(--tp-white);
}
.btn-primary:hover { background: var(--tp-navy-3); border-color: var(--tp-navy-3); }

.btn-gold {
  background: var(--tp-gold);
  border: none;
  color: var(--tp-navy);
}
.btn-gold:hover { background: #d97706; color: var(--tp-navy); }

.btn-outline-secondary {
  border-color: var(--tp-border);
  color: var(--tp-slate);
}

/* ── Section Headers ─────────────────────────────────────── */
.tp-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.tp-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--tp-navy);
  display: flex;
  align-items: center;
  gap: 8px;
}

.tp-section-title::before {
  content: '';
  display: block;
  width: 4px; height: 18px;
  background: var(--tp-gold);
  border-radius: 2px;
}

/* ── Validity chip ───────────────────────────────────────── */
.validity-chip {
  font-family: var(--tp-mono);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
  white-space: nowrap;
}

/* ── Money display ───────────────────────────────────────── */
.money-cell {
  font-family: var(--tp-mono);
  font-size: 13px;
  text-align: right;
  white-space: nowrap;
}

/* ── Detail page ─────────────────────────────────────────── */
.tp-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.tp-detail-item { display: flex; flex-direction: column; gap: 3px; }

.tp-detail-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--tp-slate-light);
  font-weight: 600;
}

.tp-detail-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--tp-navy);
}

/* ── Chart container ─────────────────────────────────────── */
.tp-chart-wrap {
  position: relative;
  height: 250px;
}

/* ── Footer ──────────────────────────────────────────────── */
.tp-footer {
  padding: 14px 28px;
  border-top: 1px solid var(--tp-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--tp-slate-light);
  background: var(--tp-white);
}

/* ── Login page ──────────────────────────────────────────── */
.tp-login-page {
  min-height: 100vh;
  display: flex;
  background: var(--tp-navy);
  position: relative;
  overflow: hidden;
}

.tp-login-bg {
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(ellipse 60% 60% at 20% 50%, rgba(245,158,11,.12) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 80% 20%, rgba(59,130,246,.08) 0%, transparent 60%);
}

.tp-login-card {
  width: 420px;
  margin: auto;
  background: var(--tp-white);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,.4);
  position: relative;
  z-index: 1;
}

.tp-login-head {
  background: var(--tp-navy-2);
  padding: 32px;
  text-align: center;
}

.tp-login-body { padding: 32px; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .tp-sidebar {
    transform: translateX(-100%);
    width: var(--tp-sidebar-w) !important;
    z-index: 1050;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    transition: transform .25s ease;
  }
  .tp-sidebar.mobile-open { transform: translateX(0); }
  .tp-content { margin-left: 0 !important; }
  .tp-page-body { padding: 16px; }
  .tp-topbar { padding-left: 12px; }
}

/* Mobile overlay — sits behind open sidebar, darkens content */
#sidebarOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1049;
  cursor: pointer;
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
}
#sidebarOverlay.active { display: block; }

/* ── Utilities ───────────────────────────────────────────── */
.gap-10 { gap: 10px; }
.text-mono { font-family: var(--tp-mono); }
.tp-uid { font-family: var(--tp-mono); font-size: 12px; color: var(--tp-slate); background: var(--tp-bg); padding: 2px 7px; border-radius: 4px; }
.cursor-pointer { cursor: pointer; }

/* ── DataTables overrides ────────────────────────────────── */
div.dataTables_wrapper div.dataTables_length select,
div.dataTables_wrapper div.dataTables_filter input {
  border: 1px solid var(--tp-border);
  border-radius: 7px;
  padding: 5px 20px;
  font-size: 13px;
}
#bankTable_wrapper {padding-top: 6px;}
#bankTable_filter, #bankTable_length {padding: 0 5px;}
div.dataTables_info { font-size: 12px; color: var(--tp-slate-light); }
div.dataTables_paginate { font-size: 13px; }

/* ── Extra utilities ─────────────────────────────────────── */
.btn-xs {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 5px;
  line-height: 1.5;
}

.fw-500 { font-weight: 500; }

/* ── Validity progress bar ───────────────────────────────── */
.tp-validity-bar {
  height: 6px;
  background: var(--tp-border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}

.tp-validity-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .4s ease;
}

/* ── Print styles ────────────────────────────────────────── */
@media print {
  .tp-sidebar, .tp-topbar, .tp-footer,
  .btn, .nav-tabs, form, .modal { display: none !important; }
  .tp-content { margin-left: 0 !important; }
  .tp-page-body { padding: 0 !important; }
  .tp-card { box-shadow: none !important; border: 1px solid #ccc !important; }
  .table th { background: #1e293b !important; color: white !important; -webkit-print-color-adjust: exact; }
}

/* ── Dark mode support (optional) ───────────────────────── */
@media (prefers-color-scheme: dark) {
  [data-bs-theme="auto"] {
    --tp-bg:     #0f172a;
    --tp-white:  #1e293b;
    --tp-border: #334155;
    --tp-navy:   #f8fafc;
  }
}

/* ── Notification dot on nav item ───────────────────────── */
.tp-nav-item .tp-dot {
  width: 8px; height: 8px;
  background: var(--tp-danger);
  border-radius: 50%;
  margin-left: auto;
  flex-shrink: 0;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .6; transform: scale(1.3); }
}

/* ── Stats hover lift ────────────────────────────────────── */
.tp-stat::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: var(--tp-gold);
  border-radius: 10px 0 0 10px;
  opacity: 0;
  transition: opacity var(--tp-transition);
}
.tp-stat:hover::after { opacity: 1; }

/* ── Table row actions visible on hover ─────────────────── */
.table tbody tr td:last-child .d-flex { opacity: 0.4; transition: opacity .15s; }
.table tbody tr:hover td:last-child .d-flex { opacity: 1; }

/* ── Avatar image support ────────────────────────────────── */
.tp-user-avatar img,
.tp-user-avatar-sm img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

/* Topbar profile button */
.tp-profile-btn {
  display: flex;
  align-items: center;
  text-decoration: none;
  cursor: pointer;
}

.tp-profile-btn:hover .tp-user-avatar-sm {
  border: 2px solid var(--tp-gold);
}

/* Sidebar footer link */
.tp-user-info {
  color: inherit;
}

.tp-user-info:hover .tp-user-name {
  color: var(--tp-gold);
}
