/* ============================================================================
   SOCIOWIRE TOPBAR - Facebook-inspired modern design
   ============================================================================ */

.sw-topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, #0a1628 0%, #0d2847 50%, #1a4b8c 100%);
  border-bottom: 1px solid rgba(56, 189, 248, 0.2);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 40px rgba(56, 189, 248, 0.1);
}

/* ============================================================================
   LEFT SECTION - Logo & Brand
   ============================================================================ */

.sw-topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.sw-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1e40af, #3b82f6);
  padding: 4px;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.sw-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.sw-brand {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.sw-brand-name {
  font-size: 1.4rem;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 10px rgba(56, 189, 248, 0.5);
}

.sw-brand-tagline {
  font-size: 0.7rem;
  font-weight: 600;
  color: #93c5fd;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ============================================================================
   CENTER SECTION - Search Bar
   ============================================================================ */

.sw-topbar-center {
  flex: 1;
  max-width: 500px;
  margin: 0 1rem;
}

.sw-search-form {
  position: relative;
  display: flex;
  align-items: center;
}

.sw-search-icon {
  position: absolute;
  left: 14px;
  color: #64748b;
  font-size: 0.9rem;
  pointer-events: none;
  transition: color 0.2s;
}

.sw-search-input {
  width: 100%;
  padding: 0.65rem 2.5rem 0.65rem 2.5rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.6);
  color: #f1f5f9;
  font-size: 0.9rem;
  outline: none;
  transition: all 0.25s ease;
  backdrop-filter: blur(8px);
}

.sw-search-input::placeholder {
  color: #64748b;
}

.sw-search-input:focus {
  border-color: rgba(56, 189, 248, 0.6);
  background: rgba(15, 23, 42, 0.8);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15), 0 4px 15px rgba(0, 0, 0, 0.2);
}

.sw-topbar-center.is-focused .sw-search-icon {
  color: #38bdf8;
}

.sw-search-clear {
  position: absolute;
  right: 10px;
  width: 24px;
  height: 24px;
  border: none;
  background: rgba(100, 116, 139, 0.3);
  color: #94a3b8;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  transition: all 0.2s;
}

.sw-search-clear:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

/* ============================================================================
   RIGHT SECTION - Action Buttons
   ============================================================================ */

.sw-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.sw-topbar-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.5);
  color: #e2e8f0;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.sw-topbar-btn:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.25);
}

.sw-topbar-btn.is-active {
  background: rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.5);
  color: #38bdf8;
}

/* Button variants */
.sw-topbar-btn-location {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(16, 185, 129, 0.15));
  border-color: rgba(34, 197, 94, 0.3);
  color: #4ade80;
}

.sw-topbar-btn-location:hover {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.25), rgba(16, 185, 129, 0.25));
  border-color: rgba(34, 197, 94, 0.5);
  color: #86efac;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.sw-topbar-btn-islands {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(14, 165, 233, 0.15));
  border-color: rgba(6, 182, 212, 0.3);
  color: #22d3ee;
}

.sw-topbar-btn-islands:hover {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.25), rgba(14, 165, 233, 0.25));
  border-color: rgba(6, 182, 212, 0.5);
  color: #67e8f9;
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
}

.sw-topbar-btn-install {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(168, 85, 247, 0.15));
  border-color: rgba(139, 92, 246, 0.3);
  color: #a78bfa;
}

.sw-topbar-btn-install:hover {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(168, 85, 247, 0.25));
  border-color: rgba(139, 92, 246, 0.5);
  color: #c4b5fd;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.sw-topbar-btn-theme {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(129, 140, 248, 0.15));
  border-color: rgba(99, 102, 241, 0.3);
  color: #818cf8;
}

.sw-topbar-btn-theme:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(129, 140, 248, 0.25));
  border-color: rgba(99, 102, 241, 0.5);
  color: #a5b4fc;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.sw-topbar-btn-lang {
  background: rgba(15, 23, 42, 0.5);
  min-width: 40px;
}

.sw-lang-code {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.sw-topbar-btn-friends {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(251, 191, 36, 0.15));
  border-color: rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

.sw-topbar-btn-friends:hover,
.sw-topbar-btn-friends.is-active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(251, 191, 36, 0.25));
  border-color: rgba(245, 158, 11, 0.5);
  color: #fcd34d;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

/* Badge for notifications */
.sw-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #0a1628;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.5);
}

/* ============================================================================
   USER BUTTON
   ============================================================================ */

.sw-topbar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem 0.35rem 0.35rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.5);
  color: #e2e8f0;
  cursor: pointer;
  transition: all 0.25s ease;
}

.sw-topbar-user:hover {
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.3);
}

.sw-topbar-user.is-active {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
}

.sw-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  overflow: hidden;
  flex-shrink: 0;
}

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

.sw-user-avatar i {
  font-size: 0.9rem;
  opacity: 0.8;
}

.sw-user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}

.sw-user-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}

.sw-user-status {
  font-size: 0.65rem;
  font-weight: 500;
  color: #4ade80;
}

.sw-user-chevron {
  font-size: 0.65rem;
  color: #64748b;
  margin-left: 0.25rem;
  transition: transform 0.2s;
}

.sw-topbar-user.is-active .sw-user-chevron {
  transform: rotate(180deg);
}

/* ============================================================================
   DROPDOWN MENUS
   ============================================================================ */

.sw-topbar-dropdown {
  position: relative;
}

.sw-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 160px;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
  overflow: hidden;
  z-index: 1001;
  animation: dropdownSlide 0.2s ease-out;
}

@keyframes dropdownSlide {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.sw-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  background: transparent;
  color: #e2e8f0;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.sw-dropdown-item:hover {
  background: rgba(56, 189, 248, 0.1);
}

.sw-dropdown-item.is-active {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
}

.sw-dropdown-item i {
  width: 18px;
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.8;
}

.sw-dropdown-logout {
  border-top: 1px solid rgba(148, 163, 184, 0.1);
  color: #f87171;
}

.sw-dropdown-logout:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* ============================================================================
   FRIENDS PANEL
   ============================================================================ */

.friends-dropdown-wrap {
  position: fixed;
  top: 70px;
  right: 16px;
  z-index: 1000;
  animation: dropdownSlide 0.2s ease-out;
}

/* ============================================================================
   TOAST
   ============================================================================ */

.sw-toast-wrap {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100;
  animation: toastSlide 0.3s ease-out;
}

@keyframes toastSlide {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ============================================================================
   AUTH MODAL (keep existing styles)
   ============================================================================ */

.auth-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.auth-modal {
  width: 100%;
  max-width: 400px;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.auth-modal-header {
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.auth-tab {
  flex: 1;
  padding: 1rem;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-tab:hover {
  color: #e2e8f0;
  background: rgba(56, 189, 248, 0.05);
}

.auth-tab-active {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  box-shadow: inset 0 -2px 0 #38bdf8;
}

.auth-close {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 1.2rem;
  cursor: pointer;
  transition: color 0.2s;
}

.auth-close:hover {
  color: #f87171;
}

.auth-notice {
  margin: 0.75rem 1rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 500;
}

.auth-notice-success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86efac;
}

.auth-notice-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.auth-notice-warn {
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.3);
  color: #fde68a;
}

.auth-notice-info {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #7dd3fc;
}

.auth-form {
  padding: 1.25rem;
}

.auth-form label {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: #94a3b8;
}

.auth-form input {
  display: block;
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.6);
  color: #f1f5f9;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s;
}

.auth-form input:focus {
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

.auth-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.auth-link {
  display: block;
  margin-bottom: 1rem;
  border: none;
  background: none;
  color: #38bdf8;
  font-size: 0.85rem;
  cursor: pointer;
  text-align: left;
}

.auth-link:hover {
  text-decoration: underline;
}

.btn-primary {
  width: 100%;
  padding: 0.85rem 1.5rem;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #60a5fa, #3b82f6);
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-full {
  width: 100%;
}

.auth-divider {
  text-align: center;
  margin: 1.25rem 0;
  color: #64748b;
  font-size: 0.8rem;
  position: relative;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 30%;
  height: 1px;
  background: rgba(148, 163, 184, 0.2);
}

.auth-divider::before {
  left: 0;
}

.auth-divider::after {
  right: 0;
}

.auth-oauth {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn-oauth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-oauth-google {
  background: white;
  color: #1f2937;
}

.btn-oauth-google:hover {
  background: #f3f4f6;
  border-color: rgba(148, 163, 184, 0.4);
}

.btn-oauth-facebook {
  background: #1877f2;
  color: white;
  border-color: #1877f2;
}

.btn-oauth-facebook:hover {
  background: #166fe5;
}

/* ============================================================================
   LIGHT THEME
   ============================================================================ */

body[data-theme="light"] .sw-topbar {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #cbd5e1 100%);
  border-bottom-color: rgba(148, 163, 184, 0.3);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

body[data-theme="light"] .sw-brand-name {
  color: #0f172a;
  text-shadow: none;
}

body[data-theme="light"] .sw-brand-tagline {
  color: #475569;
}

body[data-theme="light"] .sw-search-input {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(148, 163, 184, 0.3);
  color: #0f172a;
}

body[data-theme="light"] .sw-search-input:focus {
  background: white;
  border-color: rgba(59, 130, 246, 0.5);
}

body[data-theme="light"] .sw-topbar-btn {
  background: rgba(255, 255, 255, 0.6);
  border-color: rgba(148, 163, 184, 0.3);
  color: #475569;
}

body[data-theme="light"] .sw-topbar-btn:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.4);
  color: #2563eb;
}

body[data-theme="light"] .sw-topbar-user {
  background: rgba(255, 255, 255, 0.6);
  border-color: rgba(148, 163, 184, 0.3);
}

body[data-theme="light"] .sw-user-name {
  color: #0f172a;
}

body[data-theme="light"] .sw-dropdown-menu {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(148, 163, 184, 0.3);
}

body[data-theme="light"] .sw-dropdown-item {
  color: #0f172a;
}

body[data-theme="light"] .sw-dropdown-item:hover {
  background: rgba(59, 130, 246, 0.1);
}

body[data-theme="light"] .auth-modal {
  background: rgba(255, 255, 255, 0.98);
}

body[data-theme="light"] .auth-form input {
  background: rgba(241, 245, 249, 0.8);
  color: #0f172a;
}

/* ============================================================================
   RESPONSIVE - Tablet
   ============================================================================ */

@media (max-width: 900px) {
  .sw-topbar-center {
    max-width: 300px;
    margin: 0 0.5rem;
  }

  .sw-user-info {
    display: none;
  }

  .sw-topbar-user {
    padding: 0.25rem;
  }
}

/* ============================================================================
   RESPONSIVE - Mobile
   ============================================================================ */

@media (max-width: 640px) {
  .sw-topbar {
    padding: 0.4rem 0.6rem;
    gap: 0.5rem;
  }

  .sw-logo {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }

  .sw-brand-name {
    font-size: 1.1rem;
  }

  .sw-brand-tagline {
    display: none;
  }

  .sw-topbar-center {
    flex: 1;
    max-width: none;
    margin: 0 0.4rem;
  }

  .sw-search-input {
    padding: 0.5rem 2rem 0.5rem 2.2rem;
    font-size: 0.85rem;
  }

  .sw-topbar-right {
    gap: 0.35rem;
  }

  .sw-topbar-btn {
    width: 34px;
    height: 34px;
    font-size: 0.9rem;
  }

  .sw-user-avatar {
    width: 28px;
    height: 28px;
  }

  .sw-badge {
    min-width: 16px;
    height: 16px;
    font-size: 0.6rem;
    top: -3px;
    right: -3px;
  }

  .friends-dropdown-wrap {
    top: auto;
    bottom: 80px;
    right: 10px;
    left: 10px;
  }
}

@media (max-width: 480px) {
  .sw-brand {
    display: none;
  }

  .sw-topbar-btn-location,
  .sw-topbar-btn-islands {
    display: none;
  }
}
