/* ==========================================================
   SOCIAL MEDIA MARKETPLACE - INSTAGRAM INSPIRED MOBILE-FIRST CSS
   ========================================================== */

:root {
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --bg-body: #FAFAFA;
  --bg-card: #FFFFFF;
  --text-main: #1C1E21;
  --text-muted: #737373;
  --border-color: #EFEFEF;
  --border-subtle: #DBDBDB;
  --primary: #0095F6;
  --primary-hover: #1877F2;
  --accent-gradient: linear-gradient(45deg, #F58529, #DD2A7B, #8134AF, #515BD4);
  --accent-sell: linear-gradient(135deg, #FF512F 0%, #DD2476 100%);
  --success: #00BA88;
  --warning: #F5A623;
  --danger: #ED4956;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 50px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.08);
  --bottom-nav-height: 64px;
  --top-nav-height: 60px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-body);
  color: var(--text-main);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--bottom-nav-height) + 20px);
}

@media (min-width: 992px) {
  body {
    padding-bottom: 0;
  }
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: all 0.2s ease;
}

a:hover {
  color: var(--primary-hover);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-main);
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* Container */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header & Top Navigation */
.main-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: #FFFFFF;
  border-bottom: 1px solid var(--border-color);
  height: var(--top-nav-height);
  display: flex;
  align-items: center;
}

.header-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.brand-logo {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-logo i {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 1.5rem;
}

.header-search {
  display: none;
}

@media (min-width: 768px) {
  .header-search {
    display: block;
    width: 320px;
  }
}

.search-input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-group i {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.search-input-group input {
  width: 100%;
  padding: 8px 14px 8px 38px;
  background-color: #EFEFEF;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  outline: none;
  transition: background 0.2s, border-color 0.2s;
}

.search-input-group input:focus {
  background-color: #FFFFFF;
  border-color: var(--border-subtle);
}

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

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  font-size: 1.15rem;
  background: transparent;
  border: none;
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
}

.btn-icon:hover {
  background-color: #F0F0F0;
}

.badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background-color: var(--danger);
  border-radius: 50%;
  border: 2px solid #FFFFFF;
}

/* User Avatar */
.avatar-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--border-subtle);
}

.avatar-circle-sm {
  width: 26px;
  height: 26px;
}

.avatar-circle-lg {
  width: 72px;
  height: 72px;
}

.avatar-circle-xl {
  width: 110px;
  height: 110px;
}

/* Mobile Bottom Navigation (Instagram Style) */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background-color: #FFFFFF;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 1050;
  padding: 0 8px;
}

@media (min-width: 992px) {
  .mobile-bottom-nav {
    display: none;
  }
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  font-size: 0.72rem;
  font-weight: 500;
  text-decoration: none;
  flex: 1;
  height: 100%;
  gap: 3px;
}

.bottom-nav-item i {
  font-size: 1.25rem;
}

.bottom-nav-item.active {
  color: #000000;
  font-weight: 700;
}

.bottom-nav-sell {
  background: var(--accent-sell);
  color: #FFFFFF !important;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -16px;
  box-shadow: 0 4px 12px rgba(221, 36, 118, 0.4);
  transition: transform 0.2s;
}

.bottom-nav-sell:hover {
  transform: scale(1.05);
}

.bottom-nav-sell i {
  font-size: 1.3rem;
}

/* Buttons */
.btn-ig {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
  text-decoration: none;
  gap: 6px;
}

.btn-ig-primary {
  background-color: var(--primary);
  color: #FFFFFF;
}

.btn-ig-primary:hover {
  background-color: var(--primary-hover);
  color: #FFFFFF;
}

.btn-ig-gradient {
  background: var(--accent-sell);
  color: #FFFFFF;
  border: none;
  box-shadow: 0 4px 12px rgba(221, 36, 118, 0.25);
}

.btn-ig-gradient:hover {
  background: linear-gradient(135deg, #FF416C 0%, #FF4B2B 100%);
  color: #FFFFFF;
  transform: translateY(-1px);
}

.btn-ig-outline {
  background-color: transparent;
  border-color: var(--border-subtle);
  color: var(--text-main);
}

.btn-ig-outline:hover {
  background-color: #F8F9FA;
  color: var(--text-main);
}

.btn-ig-dark {
  background-color: #1A1A1A;
  color: #FFFFFF;
}

.btn-ig-dark:hover {
  background-color: #000000;
  color: #FFFFFF;
}

.btn-block {
  width: 100%;
}

/* Hero Section */
.hero-banner {
  background: linear-gradient(180deg, #FFFFFF 0%, #FAFAFA 100%);
  padding: 32px 0 24px;
  text-align: center;
}

.hero-title {
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 12px;
}

@media (min-width: 768px) {
  .hero-title {
    font-size: 2.6rem;
  }
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 600px;
  margin: 0 auto 24px;
}

.hero-search-box {
  max-width: 580px;
  margin: 0 auto;
}

.hero-search-wrapper {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 6px 6px 6px 20px;
  display: flex;
  align-items: center;
  box-shadow: var(--shadow-md);
}

.hero-search-wrapper input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 0.95rem;
}

/* Platform Filter Pills */
.platform-scroll-nav {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 12px 0;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.platform-scroll-nav::-webkit-scrollbar {
  display: none;
}

.platform-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.platform-pill:hover, .platform-pill.active {
  background-color: var(--text-main);
  color: #FFFFFF;
  border-color: var(--text-main);
}

.platform-pill i {
  font-size: 1.05rem;
}

/* Listing Grid & Cards */
.listings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin: 20px 0;
}

@media (min-width: 640px) {
  .listings-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .listings-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
  }
}

.listing-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.listing-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.listing-card-header {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #F5F5F5;
}

.seller-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.seller-info-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-main);
}

.badge-platform {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 700;
  color: #FFFFFF;
}

.listing-media-cover {
  position: relative;
  aspect-ratio: 16/9;
  background-color: #F0F0F0;
  overflow: hidden;
}

.listing-media-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.listing-card:hover .listing-media-cover img {
  transform: scale(1.03);
}

.badge-featured {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--accent-gradient);
  color: #FFFFFF;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.btn-favorite-float {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.btn-favorite-float.favorited i {
  color: var(--danger);
}

.listing-card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.listing-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.listing-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: #F9F9F9;
  border-radius: var(--radius-sm);
  padding: 8px;
  margin: 10px 0 14px;
  text-align: center;
}

.metric-item-num {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.metric-item-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.listing-card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid #F5F5F5;
}

.listing-price-tag {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
}

.price-subtext {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Escrow Timeline */
.timeline-card {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
}

.escrow-stepper {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin: 20px 0 10px;
}

.escrow-stepper::before {
  content: "";
  position: absolute;
  top: 18px;
  left: 30px;
  right: 30px;
  height: 3px;
  background: var(--border-color);
  z-index: 1;
}

.step-node {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 3px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.step-node.completed .step-circle {
  background: var(--success);
  border-color: var(--success);
  color: #FFFFFF;
}

.step-node.active .step-circle {
  background: #FFFFFF;
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 149, 246, 0.15);
}

.step-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

.step-node.completed .step-label,
.step-node.active .step-label {
  color: var(--text-main);
}

/* Chat & Messaging UI */
.chat-container {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  height: 580px;
  display: flex;
  overflow: hidden;
}

.chat-sidebar {
  width: 300px;
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  display: none;
}

@media (min-width: 768px) {
  .chat-sidebar {
    display: block;
  }
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #FAFAFA;
}

.chat-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 0.92rem;
  line-height: 1.4;
  word-break: break-word;
}

.chat-bubble.outgoing {
  align-self: flex-end;
  background-color: var(--primary);
  color: #FFFFFF;
  border-bottom-right-radius: 4px;
}

.chat-bubble.incoming {
  align-self: flex-start;
  background-color: #EFEFEF;
  color: var(--text-main);
  border-bottom-left-radius: 4px;
}

.chat-input-area {
  padding: 12px;
  border-top: 1px solid var(--border-color);
  background: #FFFFFF;
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Forms */
.form-card {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 6px;
  color: var(--text-main);
}

.form-control-ig {
  width: 100%;
  padding: 10px 14px;
  background: #FAFAFA;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  outline: none;
  font-family: inherit;
  transition: all 0.2s;
}

.form-control-ig:focus {
  background: #FFFFFF;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 149, 246, 0.1);
}

/* Flash alerts */
.alert-ig {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-ig-success {
  background-color: #E6F8F2;
  color: #007A58;
  border: 1px solid #B8EAD8;
}

.alert-ig-danger {
  background-color: #FDE8E9;
  color: #B81823;
  border: 1px solid #F8B4B8;
}

.alert-ig-info {
  background-color: #E8F4FD;
  color: #0B6FB8;
  border: 1px solid #B6DCF9;
}

/* Footer */
.main-footer {
  background: #FFFFFF;
  border-top: 1px solid var(--border-color);
  padding: 40px 0 24px;
  margin-top: 40px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  justify-content: center;
  margin-bottom: 20px;
}

.footer-links a {
  color: var(--text-muted);
  font-weight: 500;
}

.footer-links a:hover {
  color: var(--text-main);
}
