/* ═══════════════════════════════════════════════════════════════
   HIGH 5 CONNECT CRM — V2 Sidebar + Bottom Nav + Auth Screen
   2026 Glassmorphism — Frosted glass sidebar, translucent nav
   ═══════════════════════════════════════════════════════════════ */

/* ─── Auth Screen — Glassmorphic Login ─────────────────────── */
.auth-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #0a1628 0%, #0f2040 40%, #1a3155 70%, #068bc3 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: var(--s4);
}

.auth-screen.hidden {
  display: none;
}

.auth-card {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: var(--blur-lg);
  -webkit-backdrop-filter: var(--blur-lg);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--r-xl);
  padding: var(--s10) var(--s8);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-glass);
  text-align: center;
}

.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: var(--s6);
}

.auth-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: #ffffff;
  margin-bottom: var(--s1);
  letter-spacing: var(--tracking-tight);
}

.auth-subtitle {
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: var(--s8);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--s5);
  text-align: left;
}

.auth-form .input-label {
  color: rgba(255, 255, 255, 0.7);
}

.auth-form .input {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border-radius: var(--r-md);
  padding: var(--s3) var(--s4);
  min-height: 44px;
  font-size: var(--text-base);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}

.auth-form .input:focus {
  outline: none;
  border-color: rgba(6, 139, 195, 0.6);
  box-shadow: 0 0 0 3px rgba(6, 139, 195, 0.15);
  background: rgba(255, 255, 255, 0.1);
}

.auth-form .input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.auth-error {
  font-size: var(--text-sm);
  color: #f87171;
  min-height: 20px;
  text-align: center;
}

.auth-submit {
  width: 100%;
  margin-top: var(--s2);
  background: linear-gradient(135deg, var(--navy-base) 0%, var(--navy-darkest) 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--r-md);
  padding: var(--s3) var(--s6);
  font-size: var(--text-base);
  font-weight: 600;
  min-height: 48px;
  cursor: pointer;
  transition: all var(--t-fast);
  box-shadow: 0 2px 8px rgba(10, 22, 40, 0.3);
}

.auth-submit:hover:not(:disabled) {
  box-shadow: 0 4px 16px rgba(10, 22, 40, 0.4);
  transform: translateY(-1px);
  background: linear-gradient(135deg, var(--navy-medium) 0%, var(--navy-base) 100%);
}

.auth-submit:active:not(:disabled) {
  transform: translateY(0);
}

.auth-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.auth-footer {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.35);
  margin-top: var(--s8);
}

/* ─── Desktop Sidebar — Frosted Dark Glass ─────────────────── */
.app-sidebar {
  display: none;
}

@media (min-width: 1025px) {
  .app-sidebar {
    display: flex;
    flex-direction: column;
    background: rgba(10, 22, 40, 0.92);
    backdrop-filter: var(--blur-lg);
    -webkit-backdrop-filter: var(--blur-lg);
    color: var(--text-inverse);
    width: var(--sidebar-width);
    height: 100dvh;
    position: sticky;
    top: 0;
    flex-shrink: 0;
    transition: width var(--t-slow);
    z-index: var(--z-sticky);
    overflow: hidden;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
  }

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

  .app-sidebar.collapsed .sidebar-label,
  .app-sidebar.collapsed .sidebar-brand,
  .app-sidebar.collapsed .sidebar-user-info {
    display: none;
  }

  .app-sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: var(--s3);
  }

  .app-sidebar.collapsed .sidebar-item {
    justify-content: center;
    padding: var(--s3);
  }

  .app-sidebar.collapsed .sidebar-user {
    justify-content: center;
    gap: 0;
  }
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s5) var(--s4) var(--s3);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--s3);
}

/* ─── Sync Status Dot ────────────────────────────────── */
.sync-dot {
  position: absolute;
  top: var(--s2);
  right: var(--s2);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
  transition: background 0.3s ease, box-shadow 0.3s ease;
  z-index: 1;
}

.sidebar-header {
  position: relative;
}

.sync-dot.synced {
  background: #16a34a;
  box-shadow: 0 0 6px rgba(22, 163, 74, 0.5);
}

.sync-dot.syncing {
  background: #f59e0b;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.5);
  animation: sync-pulse 1s ease-in-out infinite;
}

.sync-dot.error {
  background: #dc2626;
  box-shadow: 0 0 6px rgba(220, 38, 38, 0.5);
}

@keyframes sync-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.sidebar-brand {
  font-size: var(--text-md);
  font-weight: 700;
  white-space: nowrap;
  color: #ffffff;
}

.sidebar-collapse-btn {
  color: var(--sidebar-text);
}

.sidebar-collapse-btn:hover {
  color: var(--text-inverse);
  background: var(--sidebar-hover-bg);
}

/* ─── Sidebar Navigation ───────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  padding: var(--s2);
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) var(--s3);
  border-radius: var(--r-md);
  color: var(--sidebar-text);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--t-fast);
  white-space: nowrap;
  width: 100%;
  text-align: left;
  position: relative;
}

.sidebar-item:hover {
  background: var(--sidebar-hover-bg);
  color: var(--text-inverse);
}

/* Active state — left accent bar + subtle gradient highlight */
.sidebar-item.active {
  background: linear-gradient(90deg, rgba(6, 139, 195, 0.25) 0%, rgba(6, 139, 195, 0.08) 100%);
  color: var(--accent-light);
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  border-radius: 0 var(--r-xs) var(--r-xs) 0;
  background: var(--accent-light);
}

.sidebar-item svg {
  flex-shrink: 0;
}

.sidebar-label {
  white-space: nowrap;
}

/* Sidebar badge (count) */
.sidebar-badge {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.8);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--r-full);
  min-width: 20px;
  text-align: center;
}

.sidebar-item.active .sidebar-badge {
  background: rgba(6, 139, 195, 0.3);
  color: var(--accent-light);
}

/* ─── Sidebar Footer ───────────────────────────────────────── */
.sidebar-footer {
  padding: var(--s2);
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) var(--s3);
  border-radius: var(--r-md);
}

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

.sidebar-user-name {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--sidebar-text-hover);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-role {
  display: block;
  font-size: var(--text-xs);
  color: var(--sidebar-text-muted);
  text-transform: capitalize;
}

/* ─── Mobile Top Bar — Translucent Navy with Blur ──────────── */
.app-topbar {
  display: flex;
}

.topbar-title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text-inverse);
}

.topbar-spacer {
  flex: 1;
}

.topbar-btn {
  color: rgba(255, 255, 255, 0.8);
}

.topbar-btn:hover {
  color: var(--text-inverse);
}

@media (min-width: 1025px) {
  .app-topbar {
    display: none;
  }
}

/* ─── Notification Badge ───────────────────────────────────── */
.notif-badge-wrap {
  position: relative;
}

.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--red);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ─── Desktop Top Bar (inside main) ─────────────────────────── */
.desktop-topbar {
  display: none;
}

@media (min-width: 1025px) {
  .desktop-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--s4) var(--s6);
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: var(--blur-sm);
    -webkit-backdrop-filter: var(--blur-sm);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
  }

  [data-theme="dark"] .desktop-topbar {
    background: rgba(15, 23, 42, 0.85);
  }

  .desktop-topbar-title {
    font-size: var(--text-xl);
    font-weight: 700;
    letter-spacing: var(--tracking-tight);
  }

  .desktop-topbar-right {
    display: flex;
    align-items: center;
    gap: var(--s3);
  }

  .desktop-search {
    width: 320px;
  }
}

/* ─── Mobile Bottom Nav ─────────────────────────────────────── */
.bottomnav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--s1) var(--s2);
  color: var(--text-label);
  font-size: 10px;
  font-weight: 500;
  transition: color var(--t-fast);
  border: none;
  background: none;
}

.bottomnav-item:hover {
  color: var(--text-primary);
}

.bottomnav-item.active {
  color: var(--accent);
}

.bottomnav-item.active svg {
  stroke: var(--accent);
}

.bottomnav-label {
  white-space: nowrap;
}

.bottomnav-fab-spacer {
  width: var(--fab-size);
}

@media (min-width: 641px) {
  .app-bottomnav {
    display: none;
  }
}

/* ─── Search Overlay (Mobile) ───────────────────────────────── */
.search-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-page);
  z-index: var(--z-panel);
  display: flex;
  flex-direction: column;
}

.search-overlay.hidden {
  display: none;
}

.search-overlay-header {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--border);
}

.search-results {
  flex: 1;
  overflow-y: auto;
  padding: var(--s4);
}

.search-result-group {
  margin-bottom: var(--s4);
}

.search-result-group-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-label);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  padding: var(--s1) 0;
  margin-bottom: var(--s2);
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--t-fast);
}

.search-result-item:hover {
  background: var(--bg-hover);
}

/* ─── FAB positioning adjustments ───────────────────────────── */
@media (min-width: 1025px) {
  .fab {
    display: none;
  }

  .fab-menu {
    display: none;
  }
}
