/* ===================================================================
   ImpireX Clients — Admin Panel Styles
   =================================================================== */

:root {
  --sidebar-width: 260px;
  --header-height: 56px;
  --impirex-navy: #0f172a;
  --impirex-navy-light: #1e293b;
  --impirex-navy-dark: #0b1220;
  --impirex-accent: #2563eb;
  --impirex-accent-hover: #1d4ed8;
  --impirex-bg: #f1f5f9;
  --impirex-card: #ffffff;
  --impirex-border: #e2e8f0;
  --impirex-text: #334155;
  --impirex-text-muted: #64748b;
}

/* ───── Global reset ───── */

html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html { font-size: 15px; }
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--impirex-text);
  background-color: var(--impirex-bg);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem var(--impirex-accent);
}

/* ===================================================================
   APP SHELL — sidebar + main area
   =================================================================== */

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

/* ───── Sidebar ───── */

.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--impirex-navy);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform 0.25s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Brand block at top of sidebar */
.sidebar-brand {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand a {
  text-decoration: none;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.brand-text {
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: 0.01em;
  color: #ffffff;
}

.brand-accent {
  color: var(--impirex-accent);
}

.brand-sub {
  font-weight: 400;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #64748b;
}

/* Navigation */
.sidebar-nav {
  flex: 1 1 auto;
  padding: 0.75rem 0;
}

.sidebar-menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-section-label {
  padding: 1.1rem 1.25rem 0.35rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #475569;
  font-weight: 600;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 1.25rem;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
}

.sidebar-link:hover {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-link.active {
  color: #ffffff;
  background: rgba(37, 99, 235, 0.12);
  border-left-color: var(--impirex-accent);
}

.sidebar-link .bi {
  font-size: 1.05rem;
  width: 1.25rem;
  text-align: center;
}

/* User block at bottom of sidebar */
.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.75rem 1rem;
  margin-top: auto;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.sidebar-user-avatar {
  flex-shrink: 0;
  font-size: 1.6rem;
  color: #64748b;
  line-height: 1;
}

.sidebar-user-info {
  flex: 1 1 0;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.7rem;
  color: #64748b;
}

.sidebar-logout .btn-link {
  color: #64748b;
  font-size: 1.1rem;
  transition: color 0.15s;
}

.sidebar-logout .btn-link:hover {
  color: #ef4444;
}

/* ───── Main area (header + content + footer) ───── */

.app-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  transition: margin-left 0.25s ease;
}

/* Top header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 1020;
  height: var(--header-height);
  background: var(--impirex-card);
  border-bottom: 1px solid var(--impirex-border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
}

.app-header-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--impirex-navy);
  margin: 0;
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.sidebar-toggle {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--impirex-navy);
  padding: 0.25rem;
  cursor: pointer;
  line-height: 1;
}

/* Content */
.app-content {
  flex: 1 0 auto;
  padding: 1.5rem;
}

/* Footer */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.85rem 1.5rem;
  border-top: 1px solid var(--impirex-border);
  font-size: 0.8rem;
  color: var(--impirex-text-muted);
  background: var(--impirex-card);
}

.app-footer-right {
  display: flex;
  gap: 1rem;
}

.app-footer a {
  color: var(--impirex-text-muted);
  text-decoration: none;
}

.app-footer a:hover {
  color: var(--impirex-accent);
}

/* ───── Mobile / responsive ───── */

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1035;
}

@media (max-width: 991.98px) {
  .app-sidebar {
    transform: translateX(-100%);
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .app-sidebar.open ~ .sidebar-overlay {
    display: block;
  }

  .app-main {
    margin-left: 0;
  }
}

/* ===================================================================
   AUTH PAGES (login, access-denied, legal pages)
   =================================================================== */

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--impirex-navy) 0%, var(--impirex-navy-dark) 100%);
}

.auth-content {
  width: 100%;
  max-width: 440px;
  padding: 1.5rem;
}

.auth-card {
  background: #ffffff;
  border-radius: 0.75rem;
  padding: 2.5rem 2rem;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
}

.auth-brand {
  font-weight: 800;
  font-size: 1.4rem;
  margin-bottom: 1.5rem;
  color: var(--impirex-navy);
}

.auth-brand span {
  color: var(--impirex-accent);
}

/* ===================================================================
   COMPONENT STYLES
   =================================================================== */

/* Provider / integration cards */
.provider-card {
  border: 1px solid var(--impirex-border);
  border-radius: 0.75rem;
  background: var(--impirex-card);
  height: 100%;
  transition: box-shadow 0.15s ease;
}

.provider-card:hover {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.provider-card.is-coming-soon {
  opacity: 0.6;
}

/* Status badges */
.status-badge {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

/* Dashboard metric cards */
.card {
  border: 1px solid var(--impirex-border);
  border-radius: 0.6rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Form floating labels */
.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* Table styles in admin views */
.table {
  --bs-table-bg: transparent;
}

.table thead th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--impirex-text-muted);
  font-weight: 600;
  border-bottom-width: 2px;
}
