/* ==========================================================================
   Lohmio Software — Premium PropTech UI Styles
   ========================================================================== */

:root {
  --lte-sidebar-width: 270px !important;
  --loh-primary: #059669;
  --loh-primary-hover: #047857;
  --loh-sidebar-bg: #0f172a;
  --loh-sidebar-border: rgba(255, 255, 255, 0.08);
  --loh-card-bg: #ffffff;
  --loh-card-border: #e2e8f0;
  --loh-card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.03);
  --loh-card-radius: 16px;
  --loh-body-bg: #f8fafc;
  --loh-text-main: #0f172a;
  --loh-text-muted: #64748b;
  --loh-navbar-bg: #ffffff;
  --loh-navbar-border: #e2e8f0;
}

[data-bs-theme="dark"] {
  --lte-sidebar-width: 270px !important;
  --loh-card-bg: #1e293b;
  --loh-card-border: rgba(255, 255, 255, 0.08);
  --loh-card-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.35);
  --loh-body-bg: #0b0f19;
  --loh-text-main: #f8fafc;
  --loh-text-muted: #94a3b8;
  --loh-navbar-bg: #0f172a;
  --loh-navbar-border: rgba(255, 255, 255, 0.08);
}

body {
  background-color: var(--loh-body-bg) !important;
  color: var(--loh-text-main) !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   AdminLTE 4 Grid & Sidebar: 270px locked width, zero gap, zero layout flash
   ========================================================================== */
.app-wrapper {
  grid-template-columns: var(--lte-sidebar-width) 1fr !important;
}

.app-sidebar {
  width: var(--lte-sidebar-width) !important;
  min-width: var(--lte-sidebar-width) !important;
  max-width: var(--lte-sidebar-width) !important;
  background: var(--loh-sidebar-bg) !important;
  border-right: 1px solid var(--loh-sidebar-border) !important;
  box-shadow: none !important;
  transition: none !important;
}

/* AdminLTE 4 uses CSS Grid (grid-template-columns: var(--lte-sidebar-width) 1fr), so NO margin-left is needed */
.app-header, .app-main, .app-footer {
  margin-left: 0 !important;
  transition: none !important;
}

body.sidebar-transition .app-sidebar {
  transition: min-width 0.25s ease-in-out, max-width 0.25s ease-in-out, margin-left 0.25s ease-in-out !important;
}

.sidebar-wrapper {
  overflow-x: hidden !important;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.sidebar-wrapper::-webkit-scrollbar {
  width: 4px;
}

.sidebar-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

/* Sidebar Links */
.sidebar-menu .nav-link {
  border-radius: 10px !important;
  margin: 2px 8px !important;
  padding: 8px 12px !important;
  color: #94a3b8 !important;
  font-weight: 500 !important;
  font-size: 0.86rem !important;
  transition: all 0.2s ease !important;
  display: flex !important;
  align-items: center !important;
  white-space: nowrap !important;
}

.sidebar-menu .nav-link:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  color: #ffffff !important;
  transform: translateX(3px);
}

.sidebar-menu .nav-link.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.22), rgba(5, 150, 105, 0.38)) !important;
  color: #34d399 !important;
  font-weight: 700 !important;
  border-left: 3px solid #10b981 !important;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.15) !important;
}

.sidebar-menu .nav-link p {
  margin: 0 !important;
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: clip !important;
  font-size: 0.85rem !important;
  letter-spacing: -0.1px !important;
  flex: 1;
}

.sidebar-menu .nav-icon {
  width: 22px !important;
  font-size: 0.95rem !important;
  margin-right: 10px !important;
  text-align: center !important;
  flex-shrink: 0;
}

.sidebar-menu .nav-header {
  font-size: 0.65rem !important;
  font-weight: 800 !important;
  color: #64748b !important;
  text-transform: uppercase !important;
  letter-spacing: 0.8px !important;
  padding: 0.9rem 1.1rem 0.3rem !important;
}

/* User Card in Sidebar */
.sidebar-user-card {
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 12px !important;
  padding: 0.75rem 0.9rem !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  transition: all 0.2s ease !important;
}

.sidebar-user-card:hover {
  background: rgba(255, 255, 255, 0.07) !important;
}

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

.sidebar-user-info a {
  text-decoration: none !important;
  display: block !important;
}

.sidebar-user-info .trade-name-text {
  font-weight: 700 !important;
  font-size: 0.82rem !important;
  color: #ffffff !important;
  line-height: 1.25 !important;
  word-break: break-word !important;
  white-space: normal !important;
}

/* Navbar Polish */
.app-header.navbar {
  background: var(--loh-navbar-bg) !important;
  min-height: 60px !important;
  border-bottom: 1px solid var(--loh-navbar-border) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03) !important;
  transition: background-color 0.25s ease, border-color 0.25s ease !important;
}

/* ==========================================================================
   Lohmio Unified Cards
   ========================================================================== */
.loh-card {
  background: var(--loh-card-bg) !important;
  border: 1px solid var(--loh-card-border) !important;
  border-radius: var(--loh-card-radius) !important;
  box-shadow: var(--loh-card-shadow) !important;
  transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease !important;
}

.loh-card:hover {
  border-color: rgba(16, 185, 129, 0.35) !important;
}

/* Table Dark/Light Adaptability */
.table {
  --bs-table-bg: transparent !important;
}

[data-bs-theme="dark"] .table {
  color: #cbd5e1 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

[data-bs-theme="dark"] .table thead.bg-light,
[data-bs-theme="dark"] .table thead {
  background: rgba(255, 255, 255, 0.03) !important;
  color: #94a3b8 !important;
}

/* ==========================================================================
   Modern Kanban Styles
   ========================================================================== */
.kanban-board-wrapper {
  display: flex;
  gap: 1.25rem;
  overflow-x: auto;
  padding-bottom: 1.5rem;
  align-items: flex-start;
}

.kanban-col {
  flex: 0 0 310px;
  width: 310px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 240px);
}

[data-bs-theme="dark"] .kanban-col {
  background: #0f172a;
  border-color: rgba(255,255,255,0.08);
}

.kanban-col-head {
  padding: 1rem 1.1rem;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

[data-bs-theme="dark"] .kanban-col-head {
  border-bottom-color: rgba(255,255,255,0.06);
}

.kanban-items {
  padding: 0.85rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: 120px;
}

.lead-item-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 2px 5px rgba(0,0,0,0.03);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: grab;
  position: relative;
}

[data-bs-theme="dark"] .lead-item-card {
  background: #1e293b;
  border-color: rgba(255,255,255,0.08);
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}

.lead-item-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(0,0,0,0.09);
  border-color: #cbd5e1;
}

[data-bs-theme="dark"] .lead-item-card:hover {
  border-color: rgba(16,185,129,0.35);
  box-shadow: 0 10px 24px rgba(0,0,0,0.4);
}

.lead-initials {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-whatsapp-pill {
  background: #25d366;
  color: #ffffff !important;
  border-radius: 50px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  border: none;
  transition: all 0.15s;
}

.btn-whatsapp-pill:hover {
  background: #1eb954;
  transform: scale(1.03);
}

.score-bar-bg {
  height: 6px;
  border-radius: 50px;
  background: rgba(0,0,0,0.06);
  overflow: hidden;
}

[data-bs-theme="dark"] .score-bar-bg {
  background: rgba(255,255,255,0.1);
}

/* Temperature badges */
.badge-hot {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
  font-weight: 700;
  font-size: 0.68rem;
  padding: 3px 8px;
  border-radius: 6px;
}

.badge-warm {
  background: #fef3c7;
  color: #d97706;
  border: 1px solid #fcd34d;
  font-weight: 700;
  font-size: 0.68rem;
  padding: 3px 8px;
  border-radius: 6px;
}

.badge-cold {
  background: #e0f2fe;
  color: #0284c7;
  border: 1px solid #bae6fd;
  font-weight: 700;
  font-size: 0.68rem;
  padding: 3px 8px;
  border-radius: 6px;
}

/* Sidebar Collapse Handling */
.sidebar-collapse .sidebar-brand {
  padding: 0.75rem 0.5rem !important;
  justify-content: center !important;
}

.sidebar-collapse .sidebar-brand .brand-link {
  justify-content: center !important;
  gap: 0 !important;
}

.sidebar-collapse .sidebar-brand .brand-link > div:last-child {
  display: none !important;
}

.sidebar-collapse .sidebar-user-panel {
  padding: 0.75rem 0.5rem !important;
}

.sidebar-collapse .sidebar-user-card {
  padding: 0.4rem !important;
  justify-content: center !important;
}

.sidebar-collapse .sidebar-user-info,
.sidebar-collapse .sidebar-user-chevron {
  display: none !important;
}

.sidebar-collapse .sidebar-search-panel {
  display: none !important;
}

.sidebar-collapse .sidebar-menu .nav-header {
  display: none !important;
}
