/* ============================================
   LINVESTHER GLOBAL DESIGN SYSTEM
   Shared styles for index, community, wallet
   ============================================ */

/* === CSS Variables === */
:root {
  /* Background Colors - High Fidelity Calibration */
  --bg-primary: #0a0c12;
  /* Refined Middle - Darker than before, but lighter than sides */
  --bg-secondary: #06080b;
  /* Floor - Lighter sidebar but still the darkest element */
  --bg-tertiary: #0c0f16;
  /* Elevation depth */
  --bg-card: #080a0e;
  /* Sunken cards for subtle definition */

  /* Border Colors - Micro-subtle */
  --border-subtle: rgba(255, 255, 255, 0.02);
  --border-medium: rgba(255, 255, 255, 0.04);
  --border-strong: rgba(255, 255, 255, 0.06);

  /* Text Colors - High comfort/professional */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #4b5563;

  /* Accent Colors - Signature Emerald */
  --accent-green: #10b981;
  --accent-green-hover: #059669;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-orange: #f59e0b;
  --accent-red: #ef4444;

  /* Spacing */
  --sidebar-width: 260px;
  --right-sidebar-width: 300px;
  --header-height: 64px;
}

/* === Unified Header === */
.unified-header {
  grid-area: header;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
  height: var(--header-height);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(8, 10, 14, 0.8);
  backdrop-filter: blur(16px) saturate(108%);
  -webkit-backdrop-filter: blur(16px) saturate(108%);
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

/* Global Search & Command Palette */
.header-search-container {
  position: absolute;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 1001;
  width: 260px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.header-mobile-nav {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin-left: 2px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: #cbd5e1;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.header-mobile-nav:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.mobile-sidebar-toolbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.mobile-sidebar-toolbar.has-divider {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.mobile-sidebar-label {
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #7f8da0;
}

.mobile-sidebar-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: #cbd5e1;
  transition: all 0.2s ease;
}

.mobile-sidebar-close:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.mobile-sidebar-close i,
.mobile-sidebar-close svg {
  width: 15px;
  height: 15px;
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.022);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 0 10px 0 12px;
  height: 38px;
  width: 100%;
  cursor: text;
  transition: all 0.25s ease;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.08);
}

.search-input-wrapper:hover {
  background: rgba(255, 255, 255, 0.032);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.search-tag {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(16, 185, 129, 0.03));
  color: #10b981;
  font-size: 9px;
  font-weight: 800;
  padding: 4px 9px;
  border-radius: 999px;
  margin-right: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(16, 185, 129, 0.12);
}

.search-shortcut {
  color: #5a6a7e;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 999px;
  margin-left: auto;
}

.search-placeholder {
  font-size: 12px;
  color: #5a6a7e;
  font-weight: 500;
}

/* === Base Styles === */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background:
    radial-gradient(circle at 14% 12%, rgba(16, 185, 129, 0.08), transparent 22%),
    radial-gradient(circle at 86% 10%, rgba(255, 255, 255, 0.03), transparent 16%),
    radial-gradient(circle at 78% 84%, rgba(59, 130, 246, 0.05), transparent 18%),
    var(--bg-primary);
  color: var(--text-primary);
  margin: 0;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(circle at center, black 22%, transparent 82%);
  opacity: 0.22;
  z-index: 0;
}

.font-mono {
  font-family: 'IBM Plex Mono', 'Menlo', monospace;
}

/* === Scrollbar === */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #334155;
}

/* === Card Component === */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  transition: border-color 0.2s;
}

.card:hover {
  border-color: var(--border-medium);
}

.card-hover:hover {
  border-color: rgba(16, 185, 129, 0.3);
}

/* Straight left indicators (independent of border-radius) */
.indicator-left-green {
  position: relative;
}

.indicator-left-green::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent-green);
}

.indicator-left-purple {
  position: relative;
}

.indicator-left-purple::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent-purple);
}

/* === Button Components === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  text-decoration: none;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.btn-primary:hover {
  background: var(--accent-green);
  color: white;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* === Badge Components === */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
}

.badge-green {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
}

.badge-blue {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-blue);
}

.badge-purple {
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-purple);
}

.badge-orange {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-orange);
}

.badge-red {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
}

/* === Sidebar Navigation === */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--text-secondary);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.sidebar-link.active {
  background: rgba(16, 185, 129, 0.08);
  color: var(--accent-green);
  position: relative;
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent-green);
}

/* === Section Title === */
.section-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.section-title-bordered {
  padding-left: 10px;
  border-left: 2px solid var(--accent-green);
}

/* === Avatar Component === */
.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 12px;
}

.avatar-md {
  width: 40px;
  height: 40px;
  font-size: 14px;
}

.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: 20px;
}

.avatar-gradient {
  background: linear-gradient(135deg, var(--accent-green) 0%, #059669 100%);
}

.avatar-square {
  border-radius: 12px;
}

/* === Input Component === */
.input {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 13px;
  transition: all 0.2s;
  outline: none;
}

.input:focus {
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.1);
}

.input::placeholder {
  color: var(--text-muted);
}

/* === Live Indicator === */
.live-indicator {
  position: relative;
  display: flex;
  height: 8px;
  width: 8px;
}

.live-indicator::before {
  content: '';
  animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
  position: absolute;
  display: inline-flex;
  height: 100%;
  width: 100%;
  border-radius: 50%;
  background-color: var(--accent-green);
  opacity: 0.75;
}

.live-indicator::after {
  content: '';
  position: relative;
  display: inline-flex;
  border-radius: 50%;
  height: 8px;
  width: 8px;
  background-color: var(--accent-green);
}

@keyframes ping {

  75%,
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

/* === Feed Tab Component === */
.feed-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 4px;
  width: fit-content;
}

.feed-tab {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: 6px;
  border: none;
  background: none;
  cursor: pointer;
  transition: all 0.2s;
}

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

.feed-tab.active {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-green);
}

/* === Composer Tool Component === */
.composer-tool {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--text-muted);
  transition: all 0.2s;
  border: none;
  background: none;
  cursor: pointer;
}

.composer-tool:hover {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-green);
}

.composer-tool.active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
}

/* === Modal Component === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.80);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-medium);
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  margin: 16px;
  overflow: hidden;
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-body {
  padding: 20px;
}

/* === Stats Grid === */
.stats-grid {
  display: grid;
  gap: 8px;
}

.stats-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.stats-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.stat-card {
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  text-align: center;
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
}

.stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

/* === Animations === */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fadeIn {
  animation: fadeIn 0.3s ease-out;
}

/* === Utilities === */
.text-green {
  color: var(--accent-green);
}

.text-red {
  color: var(--accent-red);
}

.text-blue {
  color: var(--accent-blue);
}

.text-purple {
  color: var(--accent-purple);
}

.text-orange {
  color: var(--accent-orange);
}

.text-muted {
  color: var(--text-muted);
}

.text-secondary {
  color: var(--text-secondary);
}

.bg-green-subtle {
  background: rgba(16, 185, 129, 0.1);
}

.bg-red-subtle {
  background: rgba(239, 68, 68, 0.1);
}

.bg-blue-subtle {
  background: rgba(59, 130, 246, 0.1);
}

.border-green {
  border-color: rgba(16, 185, 129, 0.3);
}

/* === Layout Grid === */
.dashboard-layout {
  display: grid;
  grid-template-areas:
    "header header"
    "sidebar main";
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--header-height) 1fr;
  min-height: 100vh;
  width: 100%;
}

.dashboard-layout-3-cols {
  display: grid;
  grid-template-areas:
    "header header header"
    "sidebar main right";
  grid-template-columns: var(--sidebar-width) 1fr var(--right-sidebar-width);
  grid-template-rows: var(--header-height) 1fr;
  min-height: 100vh;
  width: 100%;
}

.dashboard-layout-2-cols {
  display: grid;
  grid-template-areas:
    "header header"
    "sidebar main";
  grid-template-columns: 260px 1fr;
  grid-template-rows: 64px 1fr;
  min-height: 100vh;
}

/* === Responsive === */

@media (max-width: 1024px) {
  .dashboard-layout .mobile-sidebar-toolbar,
  .site-shell .mobile-sidebar-toolbar {
    display: flex;
  }

  .dashboard-layout,
  .dashboard-layout-2-cols {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "main";
  }

  .app-sidebar,
  .left-sidebar {
    display: none;
  }

  .right-sidebar {
    display: none;
  }
}

@media (max-width: 900px) {
  .unified-layout .mobile-sidebar-toolbar {
    display: flex;
  }

  .unified-header {
    height: 56px;
    padding: 0 12px;
  }

  .unified-header > div {
    padding-left: 8px;
    padding-right: 8px;
    gap: 10px;
  }

  .unified-header > div > a {
    font-size: 16px !important;
    line-height: 1;
  }

  .header-mobile-nav {
    display: inline-flex;
  }

  .header-search-container {
    right: 12px;
    width: 42px;
  }

  .search-input-wrapper {
    width: 42px;
    min-width: 42px;
    height: 38px;
    padding: 0;
    justify-content: center;
  }

  .search-tag,
  .search-placeholder,
  .search-shortcut {
    display: none;
  }

  .search-input-wrapper > i {
    margin-right: 0;
  }
}
