/* ============================================
   layout.css - App Shell Layout for CoffeeTalkTalk
   Fixed header + bottom tab bar mobile app style
   ============================================ */

/* =====================
   Header
   ===================== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  z-index: 100;
  background: var(--color-white);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 16px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--color-primary);
  font-weight: 700;
  font-size: 1.15rem;
}

.header-logo-icon {
  font-size: 1.5rem;
  color: var(--color-primary);
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.header-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  text-decoration: none;
}

.header-icon-btn:hover {
  color: var(--color-primary);
  background: var(--color-cream);
}

.header-bell {
  position: relative;
}

.bell-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--color-danger);
  color: var(--color-white);
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
  border: 2px solid var(--color-white);
}

/* ----- Desktop Nav Links (hidden on mobile) ----- */
.nav-links {
  display: none;
  gap: 20px;
  align-items: center;
}

.nav-link {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  text-decoration: none;
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--color-primary);
}

.nav-link.active {
  color: var(--color-primary);
  font-weight: 600;
}

/* ----- Profile Dropdown ----- */
.profile-dropdown {
  position: relative;
}

.profile-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  background: none;
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--color-white);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-md);
  min-width: 200px;
  display: none;
  z-index: 110;
  overflow: hidden;
}

.dropdown-menu.show {
  display: block;
}

.dropdown-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
}

.dropdown-username {
  font-weight: 600;
  font-size: 0.9rem;
  display: block;
}

.dropdown-points {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
}

.dropdown-item {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.2s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.dropdown-item:hover {
  background: var(--color-cream);
}

.dropdown-item .material-icons {
  font-size: 1.1rem;
  color: var(--color-text-secondary);
}

/* =====================
   Bottom Tab Bar
   ===================== */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  z-index: 100;
  background: var(--color-white);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
  display: flex;
  max-width: 640px;
  margin: 0 auto;
}

.tabbar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: var(--color-text-muted);
  font-size: 0.65rem;
  padding: 6px 0;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
  border: none;
  background: none;
  cursor: pointer;
}

.tabbar-item.active {
  color: var(--color-primary);
}

.tabbar-item.active .tabbar-icon {
  color: var(--color-primary);
  transform: scale(1.05);
}

.tabbar-icon {
  font-size: 24px;
  line-height: 1;
  transition: transform 0.2s, color 0.2s;
}

.tabbar-label {
  font-weight: 500;
}

.tabbar-create {
  /* special center tab - inherits tabbar-item */
}

.tabbar-create .tabbar-icon {
  color: var(--color-primary);
  font-size: 36px;
}

/* =====================
   Main Content Area
   ===================== */
.main-content {
  padding-top: 72px;
  padding-bottom: 16px;
  min-height: calc(100vh - 132px);
}

/* =====================
   Content Tab Bar (in-page tabs, NOT the bottom tabbar)
   ===================== */
.tab-bar {
  display: flex;
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 56px;
  z-index: 90;
}

.tab {
  flex: 1;
  text-align: center;
  padding: 12px;
  color: var(--color-text-secondary);
  border-bottom: 2px solid transparent;
  font-size: 0.9rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  background: none;
  text-decoration: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab:hover {
  color: var(--color-primary);
}

.tab.active,
.tab-active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 600;
}

/* =====================
   Container Variants
   ===================== */
.container-narrow {
  max-width: 540px;
  margin: 0 auto;
  padding: 0 16px;
}

/* =====================
   Footer (minimal, shown on specific pages)
   ===================== */
.site-footer {
  padding: 24px 16px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.footer-links {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 8px;
}

.footer-link {
  color: var(--color-text-secondary);
  font-size: 0.75rem;
  text-decoration: none;
  transition: color 0.2s;
}

.footer-link:hover {
  color: var(--color-primary);
}

/* =====================
   Responsive - Desktop (768px+)
   ===================== */
@media (min-width: 768px) {
  .header-inner {
    max-width: 720px;
    padding: 0 24px;
  }

  .main-content {
    padding-bottom: 16px;
  }
}
