/* ============================================================
   SIDEBAR LAYOUT
   ============================================================ */

:root {
  --sidebar-width: 220px;
  --sidebar-collapsed-width: 60px;
  --sidebar-bg: #1e1e2e;
  --sidebar-hover-bg: #2a2a3e;
  --sidebar-text: #c8c8e0;
  --sidebar-text-active: #ffffff;
  --header-height: 56px;
  --content-bg: #f5f6fa;
}

html, body { height: 100%; }

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

/* ---- Sidebar ---- */

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 200;
  transition: width 0.2s ease;
}

.sidebar--collapsed { width: var(--sidebar-collapsed-width); }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 18px;
  color: #fff !important;
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none !important;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  white-space: nowrap;
  flex-shrink: 0;
}

.sidebar-brand-icon { font-size: 1.3rem; flex-shrink: 0; }

.sidebar-brand-text,
.sidebar-nav-label,
.sidebar-user-email {
  color: var(--sidebar-text) !important;
  transition: opacity 0.15s ease;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-brand .sidebar-brand-text { color: #fff !important; }

.sidebar--collapsed .sidebar-brand-text,
.sidebar--collapsed .sidebar-nav-label,
.sidebar--collapsed .sidebar-user-email { opacity: 0; width: 0; }

.sidebar-nav {
  flex: 1;
  list-style: none;
  padding: 10px 0;
  margin: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-nav-item a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 18px;
  color: var(--sidebar-text) !important;
  text-decoration: none !important;
  font-size: 0.9rem;
  white-space: nowrap;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav-item a:hover { background: var(--sidebar-hover-bg); color: var(--sidebar-text-active) !important; }

.sidebar-nav-item.active a {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text-active) !important;
  border-left-color: #6366f1;
}

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

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,0.07);
  padding: 10px 0;
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  color: var(--sidebar-text);
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-user-icon { font-size: 1.2rem; flex-shrink: 0; width: 20px; text-align: center; }

.sidebar-signout {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 18px;
  color: var(--sidebar-text);
  font-size: 0.9rem;
  white-space: nowrap;
  width: 100%;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.sidebar-signout:hover { background: var(--sidebar-hover-bg); color: var(--sidebar-text-active); }
.sidebar-signout i { font-size: 1.05rem; flex-shrink: 0; width: 20px; text-align: center; }

/* ---- Main ---- */

.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--content-bg);
}

.top-header {
  height: var(--header-height);
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.toggle-btn {
  background: none;
  border: none;
  color: #6b7280;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
  transition: background 0.15s;
}

.toggle-btn:hover { background: #f3f4f6; color: #111827; }

.content-area { flex: 1; padding: 28px 32px; }

/* ---- Compare banner ---- */

.compare-banner {
  position: fixed;
  bottom: 0;
  right: 0;
  left: var(--sidebar-width);
  z-index: 150;
  display: flex;
  align-items: center;
  padding: 10px 20px;
  background: #1e1e2e;
  color: #fff;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.2);
  transition: left 0.2s ease;
}

.sidebar-open .compare-banner  { left: var(--sidebar-width); }
.sidebar-closed .compare-banner { left: var(--sidebar-collapsed-width); }

/* ---- Mobile overlay ---- */

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

/* ---- Auth layout (unauthenticated pages) ---- */

.auth-wrapper {
  min-height: 100vh;
  background: var(--content-bg);
  padding: 5rem 0;
}

/* ---- Mobile ---- */

@media (max-width: 991px) {
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    width: var(--sidebar-width) !important;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar--collapsed {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
  }
  .sidebar:not(.sidebar--collapsed) { transform: translateX(0); }
  .sidebar-overlay { display: block; }
  .sidebar-open .compare-banner,
  .sidebar-closed .compare-banner { left: 0; }
}

@media (min-width: 992px) {
  .sidebar-overlay { display: none !important; }
}

/* ============================================================
   LEGACY / MISC
   ============================================================ */

[x-cloak] { display: none !important; }

.htmx-indicator{
    height: 40px;
    width: 40px;
    opacity:0;
    transition: opacity 1s ease-in;

}
.htmx-request .htmx-indicator{
    opacity:1;
}

.table-hover:hover{
    --bs-table-hover-color: white;
    --bs-table-hover-bg: black;
}

a {
    color: inherit !important;
}

.red {
    background-color: #f8d7da!important;
    color: #842029!important;
}

.orange {
    background-color: #fff3cd!important;
    color: #664d03!important;
}

.accordion-button:not(.collapsed) {
    background-color: transparent!important;
    color: black!important;
}

.accordion-button:focus {
    border-color: transparent!important;
}

th {
    cursor: pointer;
}