/*
 * ============================================================
 *  HEADER STYLES
 *  Smart Shiksha ERP – Top Navigation Bar
 * ============================================================
 */

/* ── Header Sizing Tokens ── */
:root {
  --erp-header-height: 64px;
  --erp-header-bg: rgba(255,255,255,0.82);
  --erp-header-blur: blur(16px);
  --erp-header-border: rgba(0,0,0,0.06);
}

/* ── Header Positioning ── */
.header {
  position: fixed;
  top: 0;
  left: var(--erp-sidebar-width);
  right: 0;
  height: var(--erp-header-height);
  z-index: 1020;
  display: flex;
  align-items: center;
  padding: 0 20px;
  background: var(--erp-header-bg);
  -webkit-backdrop-filter: var(--erp-header-blur);
  backdrop-filter: var(--erp-header-blur);
  border-bottom: 1px solid var(--erp-header-border);
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin: 0;
  width: auto;
}

body.mini-sidebar .header {
  left: var(--erp-sidebar-collapsed-width) !important;
}

/* ── Header Inner Layout ── */
.main-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ── Left Group (Toggle + Breadcrumb) ── */
.header-left-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.header-breadcrumb {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.header-breadcrumb .page-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--erp-text);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.header-breadcrumb .breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  font-size: 0.78rem;
  color: var(--erp-text-muted);
  background: transparent;
}

.header-breadcrumb .breadcrumb a {
  color: var(--erp-primary);
  text-decoration: none;
  font-weight: 500;
}

.header-breadcrumb .breadcrumb a:hover {
  color: var(--erp-magenta);
}

.header-breadcrumb .breadcrumb .separator::before {
  content: "/";
  color: var(--erp-text-light);
  margin: 0 2px;
}

/* ── Toggle Button (Hamburger) ── */
.btn-menubar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: none;
  background: var(--erp-magenta-light);
  color: var(--erp-primary);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  text-decoration: none;
}

.btn-menubar:hover {
  background: var(--erp-primary);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(124,58,237,0.3);
}

/* ── Mobile Menu Button ── */
.mobile_btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  text-decoration: none;
}

.bar-icon {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.bar-icon span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--erp-text);
  border-radius: 2px;
  transition: all 0.2s;
}

/* ── Search Bar ── */
.top-nav-search {
  position: relative;
  flex: 1;
  max-width: 320px;
}

.top-nav-search .form-control {
  width: 100%;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--erp-border);
  background: var(--erp-bg-light);
  padding: 0 80px 0 40px;
  font-size: 0.875rem;
  color: var(--erp-text);
  transition: all 0.2s ease;
}

.top-nav-search .form-control:focus {
  outline: none;
  border-color: var(--erp-primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(124,58,237,0.1);
}

.top-nav-search .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--erp-text-muted);
  font-size: 16px;
  pointer-events: none;
}

.search-clear {
  position: absolute;
  right: 44px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--erp-text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
  display: none;
  border-radius: 4px;
  transition: color 0.15s;
}

.search-clear:hover {
  color: var(--erp-text);
}

.search-shortcut {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--erp-surface);
  border: 1px solid var(--erp-border);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--erp-text-light);
  pointer-events: none;
  white-space: nowrap;
}

/* ── Header Right Group ── */
.header-right-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* ── Header Actions ── */
.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Header Badges ── */
.academic-badge,
.date-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
}

.academic-badge {
  background: linear-gradient(135deg, rgba(124,58,237,0.1), rgba(236,72,153,0.1));
  color: var(--erp-primary);
}

.date-badge {
  background: var(--erp-bg-light);
  color: var(--erp-text-muted);
  border: 1px solid var(--erp-border);
}

/* ── Notification Badge ── */
.notification-status-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 10px;
  height: 10px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid #fff;
  animation: pulse-notification 2s ease-in-out infinite;
}

@keyframes pulse-notification {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.2); }
}

/* ── User Profile Widget (Toggle) ── */
.erp-user-widget {
  position: relative;
  margin-left: 4px;
}

.erp-user-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
  border-radius: 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background 0.2s;
}

.erp-user-toggle:hover {
  background: var(--erp-magenta-light);
}

.erp-user-avatar {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--erp-primary), var(--erp-magenta));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.erp-online-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  background: #10b981;
  border-radius: 50%;
  border: 2px solid #fff;
}

.erp-user-info {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.erp-user-name {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--erp-text);
  white-space: nowrap;
  line-height: 1.3;
}

.erp-user-role {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--erp-text-muted);
  white-space: nowrap;
  line-height: 1.3;
}

.erp-status-indicator {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
}

.erp-chevron {
  font-size: 14px;
  color: var(--erp-text-light);
  transition: transform 0.2s;
}

/* ── User Profile Dropdown Menu ── */
.erp-user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  background: var(--erp-surface);
  border: 1px solid var(--erp-border);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.12);
  padding: 0;
  z-index: 1050;
}

/* ── Dropdown Header ── */
.erp-user-menu-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--erp-border-light);
}

.erp-menu-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--erp-primary), var(--erp-magenta));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  flex-shrink: 0;
}

.erp-menu-user-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.erp-menu-user-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--erp-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.erp-menu-user-role {
  font-size: 0.75rem;
  color: var(--erp-text-muted);
}

.erp-menu-user-status {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: #10b981;
  margin-top: 2px;
}

.erp-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
}

/* ── Dropdown Body ── */
.erp-user-menu-body {
  padding: 8px;
}

/* ── Dropdown Items ── */
.erp-user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--erp-text);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.erp-user-menu-item:hover {
  background: var(--erp-magenta-light);
  color: var(--erp-primary);
}

.erp-menu-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.erp-menu-label {
  flex: 1;
  text-align: left;
}

.erp-menu-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--erp-bg-light);
  color: var(--erp-text-muted);
}

.erp-user-menu-divider {
  height: 1px;
  background: var(--erp-border-light);
  margin: 4px 12px;
}

.erp-menu-logout {
  color: #ef4444;
}

.erp-menu-logout:hover {
  background: rgba(239,68,68,0.08);
  color: #ef4444;
}

/* ── Dark Mode: Header ── */
[data-theme="dark"] .header {
  background: rgba(17,24,39,0.85);
  border-bottom-color: rgba(255,255,255,0.06);
}

[data-theme="dark"] .btn-menubar {
  background: rgba(124,58,237,0.15);
}

[data-theme="dark"] .top-nav-search .form-control {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
  color: #e2e8f0;
}

[data-theme="dark"] .top-nav-search .form-control:focus {
  background: rgba(255,255,255,0.08);
}

[data-theme="dark"] .search-shortcut {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
  color: #94a3b8;
}

[data-theme="dark"] .academic-badge {
  background: linear-gradient(135deg, rgba(124,58,237,0.2), rgba(236,72,153,0.2));
}

[data-theme="dark"] .date-badge {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
  color: #94a3b8;
}

[data-theme="dark"] .erp-user-toggle:hover {
  background: rgba(124,58,237,0.15);
}

[data-theme="dark"] .erp-user-menu {
  background: #1e293b;
  border-color: rgba(255,255,255,0.1);
}

[data-theme="dark"] .erp-user-menu-item {
  color: #e2e8f0;
}

[data-theme="dark"] .erp-user-menu-item:hover {
  background: rgba(124,58,237,0.15);
}

[data-theme="dark"] .erp-user-menu-divider {
  background: rgba(255,255,255,0.08);
}

/* ── Header Responsive ── */
@media (max-width: 991.98px) {
  .header {
    left: 0 !important;
    padding: 0 12px;
  }

  body.mini-sidebar .header {
    left: 0 !important;
  }

  .mobile_btn {
    display: flex;
  }

  .top-nav-search {
    max-width: 180px;
  }

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

  .academic-badge,
  .date-badge {
    display: none;
  }

  .header-breadcrumb .page-title {
    font-size: 0.95rem;
  }
}

@media (max-width: 575.98px) {
  .header {
    padding: 0 8px;
    height: 56px;
  }

  .top-nav-search {
    max-width: 120px;
  }

  .btn-menubar {
    width: 36px;
    height: 36px;
  }

  .header-breadcrumb {
    display: none;
  }

  .erp-user-menu {
    width: 260px;
  }
}
