/**
 * FEM Design System - Layout
 * Header, topnav, mobile drawer, bottom nav, main content area
 *
 * Version: 1.0.0
 * Date: April 2026
 */

/* ============================================
   1. HEADER
   ============================================ */

.fem-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--fem-header-height);
  background: var(--fem-primary);
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(87, 21, 18, 0.15);
}

.fem-header-inner {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 20px;
  gap: 16px;
}

/* Header left: hamburger + logo */
.fem-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.fem-mobile-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px;
}

.fem-mobile-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: white;
  border-radius: 1px;
  transition: all 0.2s;
}

.fem-mobile-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(4px, 4px);
}

.fem-mobile-toggle.active span:nth-child(2) {
  opacity: 0;
}

.fem-mobile-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(4px, -4px);
}

.fem-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  color: white;
  text-decoration: none;
}

.fem-logo:hover {
  color: white;
}

.fem-logo-img {
  height: 28px;
  width: auto;
  display: block;
}

/* ============================================
   2. TOP NAVIGATION
   ============================================ */

.fem-topnav {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  flex: 1;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.fem-topnav::-webkit-scrollbar { display: none; }

.fem-nav-items {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 0;
}

.fem-topnav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 14px;
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  height: 100%;
  position: relative;
  transition: color 0.2s;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.fem-topnav-item i {
  font-size: 18px;
  line-height: 1;
}

.fem-topnav-item:hover {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
}

.fem-topnav-item.active {
  color: white;
  border-bottom-color: var(--fem-accent);
}

.fem-topnav-item.active span {
  font-weight: 600;
}

/* Notification badge on nav items */
.fem-topnav-badge {
  position: absolute;
  top: 8px;
  right: 6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #dc2626;
  color: white;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Dropdown navigation (admin) */
.fem-topnav-dropdown {
  position: relative;
  display: inline-flex;
  height: 100%;
}

.fem-topnav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  border-radius: var(--fem-radius-sm);
  box-shadow: var(--fem-shadow-lg);
  min-width: 210px;
  padding: 8px 0;
  z-index: 1000;
}

.fem-topnav-dropdown.open .fem-topnav-dropdown-menu {
  display: block;
}

.fem-topnav-dropdown-menu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  font-size: 13px;
  color: #333;
}

.fem-topnav-dropdown-menu a:hover {
  background: var(--fem-accent-light);
  color: var(--fem-primary);
}

.fem-topnav-dropdown-menu a i {
  margin-right: 8px;
  width: 16px;
  text-align: center;
}

.fem-topnav-dropdown-menu hr {
  margin: 4px 12px;
  border: none;
  border-top: 1px solid var(--fem-warm-border);
}

/* Nav mode toggle (admin/member switch) */
.fem-nav-mode-toggle {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 2px;
  margin-right: 8px;
  flex-shrink: 0;
}

.fem-nav-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border: none;
  border-radius: 18px;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.fem-nav-mode-btn i {
  font-size: 13px;
}

.fem-nav-mode-btn:hover {
  color: white;
}

.fem-nav-mode-btn.active {
  background: var(--fem-accent);
  color: white;
  font-weight: 600;
}

/* ============================================
   3. HEADER RIGHT (notifications, user menu)
   ============================================ */

.fem-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  margin-left: auto;
}

.fem-notification-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: all 0.2s;
  position: relative;
}

.fem-notification-btn:hover {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

.fem-notification-btn i {
  font-size: 18px;
}

.fem-notification-btn .fem-topnav-badge {
  top: 2px;
  right: 0;
}

/* User menu */
.fem-user-menu {
  position: relative;
}

.fem-user-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 24px;
  transition: background 0.2s;
}

.fem-user-trigger:hover {
  background: rgba(255, 255, 255, 0.1);
}

.fem-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--fem-accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  flex-shrink: 0;
}

.fem-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fem-avatar-sm {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

.fem-avatar-lg {
  width: 48px;
  height: 48px;
  font-size: 16px;
}

.fem-user-name {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
}

.fem-user-trigger .bi-chevron-down {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
}

.fem-user-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: white;
  border-radius: var(--fem-radius-sm);
  box-shadow: var(--fem-shadow-lg);
  min-width: 220px;
  padding: 8px 0;
  z-index: 1000;
}

.fem-user-menu.open .fem-user-dropdown {
  display: block;
}

.fem-user-dropdown a {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  font-size: 13px;
  color: #555;
}

.fem-user-dropdown a:hover {
  background: var(--fem-accent-light);
  color: var(--fem-primary);
}

.fem-user-dropdown a i {
  margin-right: 10px;
  width: 16px;
  text-align: center;
}

.fem-user-dropdown hr {
  margin: 4px 12px;
  border: none;
  border-top: 1px solid var(--fem-warm-border);
}

/* ============================================
   4. MOBILE DRAWER
   ============================================ */

.fem-drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1099;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.fem-drawer-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.fem-mobile-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  background: var(--fem-primary);
  z-index: 1100;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.fem-mobile-drawer.open {
  transform: translateX(0);
}

.fem-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.fem-drawer-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
}

.fem-drawer-close:hover { color: white; }

.fem-drawer-nav {
  flex: 1;
  padding: 8px 0;
}

.fem-drawer-section-title {
  display: block;
  padding: 12px 20px 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.35);
}

.fem-drawer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.fem-drawer-item:hover {
  color: white;
  background: rgba(255, 255, 255, 0.08);
}

.fem-drawer-item.active {
  color: white;
  background: rgba(255, 255, 255, 0.12);
  border-left-color: var(--fem-accent);
}

.fem-drawer-item i {
  font-size: 17px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.fem-drawer-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #dc2626;
  color: white;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fem-drawer-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 8px 20px;
}

/* ============================================
   5. MAIN CONTENT AREA
   ============================================ */

.fem-main {
  margin-top: var(--fem-header-height);
  min-height: calc(100vh - var(--fem-header-height));
  display: flex;
  flex-direction: column;
}

.fem-content {
  flex: 1;
  padding: 28px 32px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* ============================================
   6. MOBILE BOTTOM NAV
   ============================================ */

.fem-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid var(--fem-warm-border);
  z-index: 1000;
  padding: 4px 0;
  padding-bottom: calc(4px + env(safe-area-inset-bottom));
}

.fem-bottom-nav-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.fem-bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  color: #999;
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  min-width: 52px;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.fem-bottom-nav-item i {
  font-size: 20px;
}

.fem-bottom-nav-item.active {
  color: var(--fem-accent);
}

.fem-bottom-nav-item:active {
  color: var(--fem-primary);
}

/* ============================================
   7. RESPONSIVE
   ============================================ */

@media (max-width: 1023px) {
  .fem-topnav {
    display: none;
  }

  .fem-mobile-toggle {
    display: flex;
  }

  .fem-content {
    padding: 20px 16px;
    padding-bottom: 80px;
  }

  .fem-bottom-nav {
    display: block;
  }
}

@media (max-width: 600px) {
  .fem-user-name {
    display: none;
  }

  .fem-header-inner {
    padding: 0 12px;
  }

  .fem-content {
    padding: 16px 12px;
    padding-bottom: 76px;
  }

  .fem-page-header {
    margin-bottom: 16px;
  }

  .fem-flex-between {
    flex-wrap: wrap;
    gap: 8px;
  }
}
