/* ============================================
   KELIBATMU V2 - MOBILE CINEMATIC NAVIGATION
   Phase 3A: Mobile Topbar User Avatar
   Spotify shell + Gmail utility identity + Dark cinematic atmosphere
   Personalized app-shell identity with subtle avatar shortcut
   ============================================ */

/* ============================================
   MOBILE TOP BAR - NEW COMPONENT
   Left hamburger | Center logo | Right avatar
   FIXED HEIGHT: 58px (stable navbar rhythm)
   ============================================ */

.mobile-top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 58px;
  z-index: var(--z-navbar);
  background: color-mix(in srgb, var(--theme-page-bg-deep) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--theme-border);
  display: flex;
  align-items: center;
  padding: 0 10px;
}

.mobile-top-bar-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 100%;
  margin: 0 auto;
}

/* LEFT: Hamburger Trigger */
.mobile-hamburger-trigger {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.hamburger-icon {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 22px;
}

.hamburger-icon span {
  display: block;
  height: 2px;
  background: var(--color-text-secondary);
  border-radius: 2px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-hamburger-trigger:hover {
  opacity: 0.7;
}

.mobile-hamburger-trigger:hover .hamburger-icon span {
  background: rgba(141, 245, 143, 0.8);
}

/* CENTER: Logo / Branding */
.mobile-top-logo {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: auto;
  z-index: 5;
  text-decoration: none;
}

.mobile-top-logo-text {
  position: relative;
  display: inline-block;

  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  font-style: normal;
  font-size: 1.05rem;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;

  background: linear-gradient(
    180deg,
    #fffef9 0%,
    #f9f0da 38%,
    #dfbf79 72%,
    #b8893f 100%
  );

  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;

  text-shadow:
    0 0 4px rgba(255, 239, 204, 0.08),
    0 0 12px rgba(223, 191, 121, 0.08);

  transition:
    filter 0.25s ease,
    transform 0.25s ease;
}

.mobile-top-logo:hover .mobile-top-logo-text {
  filter: brightness(1.08);
}

/* RIGHT: Avatar Slot */
.mobile-top-avatar-slot {
  min-width: 36px;
  display: flex;
  justify-content: flex-end;
}

.mobile-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255,255,255,.035);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.mobile-user-avatar .avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.mobile-user-avatar .avatar-initial {
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(141, 245, 143, 0.7);
  text-transform: uppercase;
}

.mobile-user-avatar:hover {
  background: rgba(141, 245, 143, 0.06);
  border-color: rgba(141, 245, 143, 0.1);
  transform: scale(1.02);
}

.mobile-top-spacer {
  width: 30px;
  height: 30px;
  opacity: 0;
  pointer-events: none;
}

/* ============================================
   SIDEBAR OVERLAY - EXISTING (PRESERVED)
   ============================================ */

.mobile-nav-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: flex-start;
  align-items: stretch;
  margin: 0;
  padding: 0;
  background-color: rgba(4, 4, 6, 0.82);
  backdrop-filter: blur(8px);
  z-index: var(--z-mobile-menu);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-nav-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Sidebar container - left anchored, slides from left */
.mobile-nav-container {
  position: relative;
  left: 0;
  top: 0;
  width: 82vw;
  max-width: none;
  min-width: unset;
  height: 100vh;
  margin: 0;
  padding: 0;
  border-radius: 0;
  background: linear-gradient(
    135deg,
    rgba(10, 10, 14, 0.98),
    rgba(6, 6, 10, 0.99)
  );
  backdrop-filter: blur(14px);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
  border-right: 1px solid rgba(141, 245, 143, 0.04);
  overflow: hidden;
}

.mobile-nav-overlay.active .mobile-nav-container {
  transform: translateX(0);
}

/* Header - Compact Branding, Left Aligned */
.mobile-nav-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  padding: 14px 18px 8px;
  margin: 0;
  border-bottom: none;
  flex-shrink: 0;
  background: transparent;
}

.mobile-nav-brand {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(
    135deg,
    var(--color-text-primary) 0%,
    var(--color-text-secondary) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: block;
  margin-bottom: 6px;
}

.mobile-nav-tagline {
  font-size: 0.6rem;
  font-style: italic;
  color: var(--color-text-muted);
  opacity: 0.6;
  letter-spacing: normal;
  display: block;
}

/* Scrollable Content */
.mobile-nav-scrollable {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding-bottom: 20px;
}

/* Profile Section - Identity Header Style, Left Aligned */
.mobile-profile-section {
  padding: 6px 14px 9px;
  margin: 0 0 4px 0;
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  flex-shrink: 0;
}

.mobile-profile-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.mobile-profile-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    rgba(141, 245, 143, 0.08),
    rgba(141, 245, 143, 0.02)
  );
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
  flex-shrink: 0;
}

.mobile-profile-avatar svg {
  width: 24px;
  height: 24px;
  stroke: #8df58f;
  stroke-width: 1.5;
}

.mobile-profile-avatar .avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.mobile-profile-info {
  flex: 1;
  text-align: left;
}

.mobile-profile-username {
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.82);
  display: block;
  margin-bottom: 2px;
}

.mobile-profile-email {
  font-size: 0.55rem;
  color: var(--color-text-muted);
  opacity: 0.5;
  display: block;
  word-break: break-all;
}

.mobile-profile-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.mobile-profile-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 9px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 500;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.012);
  color: rgba(141, 245, 143, 0.7);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex: unset;
}

.mobile-profile-action svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
}

.mobile-profile-action:hover {
  background: rgba(141, 245, 143, 0.06);
  color: rgba(141, 245, 143, 0.9);
  transform: translateY(-1px);
}

/* Guest Section - Mini Navigation Group, Left Aligned */
.mobile-guest-section {
  padding: 12px 16px 16px;
  margin: 0 0 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  flex-shrink: 0;
}

.mobile-guest-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 12px;
  padding-left: 4px;
}

.mobile-guest-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  text-decoration: none;
  color: var(--color-text-secondary);
  background: rgba(255, 255, 255, 0.015);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  margin-bottom: 6px;
}

.mobile-guest-link:last-child {
  margin-bottom: 0;
}

.mobile-guest-link:hover {
  background: rgba(141, 245, 143, 0.04);
  color: var(--color-text-primary);
}

.mobile-guest-icon {
  width: 18px;
  height: 18px;
  stroke-width: 1.5;
  opacity: 0.65;
  stroke: currentColor;
}

.mobile-guest-link.register {
  opacity: 0.82;
}

.mobile-guest-link span {
  font-size: 0.85rem;
  font-weight: 500;
}

.mobile-language-section {
  padding: 10px 16px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  flex-shrink: 0;
}

.mobile-nav-overlay .kv2-language-select--mobile {
  width: auto;
}

.mobile-nav-overlay .kv2-language-select--mobile select {
  width: auto;
  min-width: 11.5rem;
  max-width: 100%;
  min-height: 30px;
  border-width: 0 0 1px;
  border-style: solid;
  border-color: transparent;
  border-bottom-color: rgba(255, 255, 255, 0.06);
  border-radius: 0;
  background-color: transparent;
  color: var(--color-text-muted);
  font-weight: 600;
  padding-left: 0;
}

.mobile-nav-overlay .kv2-language-select--mobile select:hover,
.mobile-nav-overlay .kv2-language-select--mobile select:focus-visible {
  border-width: 0 0 1px;
  border-color: transparent;
  border-bottom-color: rgba(255, 255, 255, 0.14);
  background-color: transparent;
  color: var(--color-text-secondary);
}

/* Main Navigation - Left Aligned, App Style */
.mobile-nav-items {
  list-style: none;
  padding: 0;
  margin: 0;
  flex-shrink: 0;
}

.mobile-nav-item {
  border-bottom: none;
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px;
  margin: 2px 12px;
  border-radius: 12px;
  color: var(--color-text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  text-align: left;
  justify-content: flex-start;
}

.mobile-nav-icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.5;
  opacity: 0.6;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.mobile-nav-link:hover {
  color: var(--color-text-primary);
  background: rgba(141, 245, 143, 0.032);
}

.mobile-nav-link:hover .mobile-nav-icon {
  opacity: 0.9;
  stroke: #8df58f;
}

/* Active State - Subtle Gmail-like, Less Cinematic */
.mobile-nav-link.active {
  color: var(--color-text-primary);
  background: rgba(141, 245, 143, 0.04);
  border-radius: 12px;
}

.mobile-nav-link.active .mobile-nav-icon {
  opacity: 0.9;
  stroke: #8df58f;
}

/* Divider - Minimal Separation */
.mobile-nav-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.035);
  margin: 8px 20px;
  list-style: none;
}

/* Logout - Elegant Action */
.logout-link {
  color: rgba(255, 120, 120, 0.5);
  margin-top: 4px;
}

.logout-link:hover {
  background: rgba(139, 44, 44, 0.08);
  color: rgba(255, 120, 120, 0.72);
}

.logout-link:hover .mobile-nav-icon {
  stroke: rgba(255, 100, 100, 0.85);
  opacity: 1;
}

/* Social Section - Moved Up, Icon Only */
.mobile-social-section {
  margin-top: 8px;
  padding: 10px 18px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.02);
  flex-shrink: 0;
}

.mobile-social-title {
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  opacity: 0.4;
  text-align: left;
  margin-bottom: 10px;
}

.mobile-social-links {
  display: flex;
  justify-content: flex-start;
  gap: 16px;
}

.mobile-social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.035);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-social-link svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.5;
  opacity: 0.6;
}

.mobile-social-link:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.04);
}

.mobile-social-link:hover svg {
  opacity: 0.9;
}

/* Platform Accent Colors - Subtle */
.mobile-social-link.tiktok:hover svg {
  stroke: #00f2ea;
  opacity: 1;
}

.mobile-social-link.spotify:hover svg {
  stroke: #1db954;
  opacity: 1;
}

.mobile-social-link.youtube:hover svg {
  stroke: #ff0000;
  opacity: 1;
}

/* Responsive - Extra Small Devices */
@media (max-width: 480px) {
  .mobile-top-bar {
    height: 54px;
    padding: 0 10px;
  }
  
  .mobile-top-logo-text {
    font-size: 0.9rem;
  }
  
  .mobile-user-avatar {
    width: 28px;
    height: 28px;
  }
  
  .mobile-top-spacer {
    width: 28px;
    height: 28px;
  }
  
  .mobile-nav-container {
    width: 86vw;
  }

  .mobile-nav-brand {
    font-size: 1rem;
  }

  .mobile-nav-tagline {
    font-size: 0.52rem;
  }

  .mobile-nav-header {
    padding: 16px 16px 12px;
  }

  .mobile-profile-avatar {
    width: 44px;
    height: 44px;
  }

  .mobile-profile-avatar svg {
    width: 22px;
    height: 22px;
  }

  .mobile-profile-username {
    font-size: 0.7rem;
  }

  .mobile-profile-email {
    font-size: 0.5rem;
  }

  .mobile-profile-action {
    padding: 6px 10px;
    font-size: 0.65rem;
  }

  .mobile-profile-action svg {
    width: 12px;
    height: 12px;
  }

  .mobile-nav-link {
    padding: 10px 16px;
    font-size: 0.8rem;
    margin: 2px 10px;
  }

  .mobile-nav-icon {
    width: 18px;
    height: 18px;
  }

  .mobile-guest-title {
    font-size: 0.8rem;
  }

  .mobile-guest-link {
    padding: 8px 12px;
  }

  .mobile-guest-icon {
    width: 16px;
    height: 16px;
  }

  .mobile-guest-link span {
    font-size: 0.8rem;
  }

  .mobile-social-section {
    margin-top: 12px;
    padding: 10px 16px 14px;
  }

  .mobile-social-links {
    gap: 20px;
  }

  .mobile-social-link {
    width: 28px;
    height: 28px;
  }

  .mobile-social-link svg {
    width: 14px;
    height: 14px;
  }
}

/* ============================================
   REDUCED MOTION PREFERENCE
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  .mobile-top-bar,
  .mobile-nav-overlay,
  .mobile-nav-container,
  .mobile-nav-link,
  .mobile-profile-action,
  .mobile-guest-link,
  .mobile-social-link,
  .mobile-user-avatar,
  .mobile-hamburger-trigger {
    transition: none !important;
  }
}

/* ============================================
   DESKTOP SAFETY LOCK
   Prevent mobile navigation from leaking into desktop
   ============================================ */

@media (min-width: 769px) {
  .mobile-top-bar {
    display: none !important;
  }

  .mobile-nav-overlay {
    display: none !important;
  }
}

/* ============================================
   MOBILE DRAWER REFINEMENT
   Quiet, row-based navigation aligned with the mobile settings hierarchy.
   ============================================ */

.mobile-hamburger-trigger {
  min-width: 44px;
  min-height: 44px;
}

.mobile-nav-overlay {
  background: rgba(3, 5, 5, 0.68);
  backdrop-filter: blur(4px);
}

.mobile-nav-container {
  width: min(88vw, 360px);
  height: 100vh;
  height: 100dvh;
  background: #0a0d0c;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 12px 0 40px rgba(0, 0, 0, 0.34);
  backdrop-filter: none;
}

.mobile-nav-header {
  padding: calc(20px + env(safe-area-inset-top, 0px)) 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}

.mobile-nav-brand {
  min-height: 24px;
  margin: 0;
  color: rgba(247, 238, 218, 0.94);
  background: none;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.08rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-decoration: none;
}

.mobile-nav-scrollable {
  padding: 0 0 calc(18px + env(safe-area-inset-bottom, 0px));
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.mobile-language-section {
  padding: 14px 20px 12px;
  border-bottom-color: rgba(255, 255, 255, 0.055);
}

.mobile-language-section .mobile-social-title {
  margin-bottom: 4px;
  color: rgba(255, 255, 255, 0.42);
  font-size: 0.67rem;
  letter-spacing: 0.08em;
  opacity: 1;
}

.mobile-nav-overlay .kv2-language-select--mobile,
.mobile-nav-overlay .kv2-language-select--mobile select {
  width: 100%;
}

.mobile-nav-overlay .kv2-language-select--mobile select {
  min-width: 0;
  min-height: 44px;
  border: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0 28px 0 0;
}

.mobile-nav-overlay .kv2-language-select--mobile select:hover,
.mobile-nav-overlay .kv2-language-select--mobile select:focus-visible {
  border: 0;
  color: rgba(255, 255, 255, 0.96);
  outline: 2px solid rgba(141, 245, 143, 0.18);
  outline-offset: 2px;
}

.mobile-profile-section {
  padding: 16px 20px 10px;
  margin: 0;
  border-bottom: 0;
}

.mobile-profile-row {
  gap: 12px;
  margin: 0;
}

.mobile-profile-avatar {
  width: 44px;
  height: 44px;
  background: rgba(141, 245, 143, 0.055);
  border-color: rgba(255, 255, 255, 0.08);
}

.mobile-profile-info {
  min-width: 0;
}

.mobile-profile-username {
  margin-bottom: 3px;
  color: rgba(255, 255, 255, 0.91);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.25;
}

.mobile-profile-email {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.44);
  font-size: 0.72rem;
  line-height: 1.35;
  opacity: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: normal;
}

.mobile-profile-view.mobile-nav-link {
  min-height: 44px;
  margin: 4px 0 0 56px;
  padding: 0;
  justify-content: space-between;
  color: rgba(141, 245, 143, 0.72);
  font-size: 0.78rem;
  background: transparent;
}

.mobile-account-nav,
.mobile-guest-section {
  display: grid;
  gap: 0;
  padding: 6px 10px 10px;
  margin: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}

.mobile-nav-items {
  padding: 10px;
}

.mobile-nav-link,
.mobile-guest-link {
  min-height: 44px;
  margin: 0;
  padding: 10px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.88rem;
  line-height: 1.25;
  background: transparent;
}

.mobile-guest-link {
  justify-content: space-between;
}

.mobile-nav-icon {
  width: 19px;
  height: 19px;
  opacity: 0.62;
  stroke-width: 1.55;
}

.mobile-nav-chevron {
  margin-left: auto;
  color: rgba(255, 255, 255, 0.28);
  font-size: 1.15rem;
  font-weight: 400;
}

.mobile-nav-link:hover,
.mobile-nav-link:focus-visible {
  color: rgba(255, 255, 255, 0.94);
  background: rgba(255, 255, 255, 0.035);
  outline: none;
}

.mobile-nav-link.active {
  color: rgba(255, 255, 255, 0.94);
  background: rgba(141, 245, 143, 0.055);
  box-shadow: inset 2px 0 0 rgba(141, 245, 143, 0.48);
}

.mobile-nav-link.active .mobile-nav-icon {
  stroke: rgba(141, 245, 143, 0.82);
}

.mobile-social-section {
  margin: 0;
  padding: 10px 20px 12px;
  border-top-color: rgba(255, 255, 255, 0.055);
}

.mobile-social-title {
  margin-bottom: 5px;
  font-size: 0.67rem;
  letter-spacing: 0.08em;
  opacity: 0.72;
}

.mobile-social-links {
  gap: 4px;
}

.mobile-social-link {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: transparent;
}

.mobile-social-link:hover,
.mobile-social-link:focus-visible {
  transform: none;
  background: rgba(255, 255, 255, 0.035);
  outline: none;
}

.mobile-logout-section {
  padding: 8px 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.055);
}

.logout-link {
  color: rgba(255, 158, 158, 0.62);
}

@media (max-width: 480px) {
  .mobile-nav-header {
    padding: calc(18px + env(safe-area-inset-top, 0px)) 18px 14px;
  }

  .mobile-language-section,
  .mobile-profile-section {
    padding-left: 18px;
    padding-right: 18px;
  }

  .mobile-nav-link,
  .mobile-guest-link {
    padding: 10px;
    font-size: 0.86rem;
  }
}
