/* ============================================
   Trace2Com Mobile PWA - Dark theme mobile-first
   ============================================ */
:root {
  --bg: #111113;
  --bg-card: #18181b;
  --bg-elevated: #1f1f23;
  --border: #2a2a2d;
  --border-light: #3a3a3d;
  --primary: #facc15;
  --primary-dark: #ca9a0d;
  --text: #f4f4f5;
  --text-muted: #a1a1aa;
  --text-dim: #71717a;
  --green: #10b981;
  --blue: #3b82f6;
  --red: #ef4444;
  --orange: #f97316;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 4px 12px rgba(0,0,0,0.4);
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

a { color: var(--primary); text-decoration: none; }

/* ===== APP SHELL ===== */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(70px + var(--safe-bottom));
}

/* ===== HEADER ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: calc(12px + var(--safe-top)) 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.header-title {
  font-size: 1.15rem;
  font-weight: 700;
  flex: 1;
}
.header-title span { color: var(--primary); }
.header-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text);
  cursor: pointer;
}
.icon-btn:active { transform: scale(0.95); background: var(--bg-elevated); }

/* ===== MAIN CONTENT ===== */
.main {
  flex: 1;
  padding: 16px;
}

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
}
.card-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 8px;
}
.card-meta {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 12px;
}

/* ===== POST CARD ===== */
.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.post-image {
  width: 100%;
  aspect-ratio: 1;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 0.85rem;
}
.post-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.post-body { padding: 16px; }
.post-client {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.post-client-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.post-client-info { flex: 1; min-width: 0; }
.post-client-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.post-client-date {
  font-size: 0.75rem;
  color: var(--text-dim);
}
.post-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 8px;
}
.post-content {
  font-size: 0.9rem;
  color: var(--text-muted);
  white-space: pre-wrap;
  line-height: 1.5;
  margin-bottom: 12px;
}
.post-platforms {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.platform-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.platform-badge.facebook { background: rgba(24,119,242,0.15); color: #1877f2; }
.platform-badge.instagram { background: rgba(228,64,95,0.15); color: #e4405f; }
.platform-badge.linkedin { background: rgba(10,102,194,0.15); color: #0a66c2; }
.platform-badge.tiktok { background: rgba(255,255,255,0.1); color: #fff; }
.platform-badge.twitter { background: rgba(29,161,242,0.15); color: #1da1f2; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.1s;
  min-height: 44px;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--primary);
  color: #000;
  width: 100%;
}
.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-block { width: 100%; }
.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}
.btn-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.share-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 14px 8px;
  border-radius: var(--radius);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  min-height: 70px;
}
.share-btn:active { transform: scale(0.96); }
.share-btn svg { width: 24px; height: 24px; }
.share-btn.facebook { color: #1877f2; }
.share-btn.instagram { color: #e4405f; }
.share-btn.linkedin { color: #0a66c2; }
.share-btn.twitter { color: #1da1f2; }
.share-btn.whatsapp { color: #25d366; }
.share-btn.native { background: var(--primary); color: #000; border-color: var(--primary); }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  -webkit-appearance: none;
}
.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
}
.form-textarea { min-height: 100px; resize: vertical; }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 8px 0 calc(8px + var(--safe-bottom));
  z-index: 100;
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 4px;
  color: var(--text-dim);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.bottom-nav a.active { color: var(--primary); }
.bottom-nav svg { width: 22px; height: 22px; }

/* ===== LOGIN ===== */
.login-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  background: var(--bg);
}
.login-logo {
  width: 80px;
  height: 80px;
  margin-bottom: 24px;
}
.login-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0 0 4px;
}
.login-title span { color: var(--primary); }
.login-subtitle {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin: 0 0 32px;
}
.login-form {
  width: 100%;
  max-width: 360px;
}

/* ===== PAGE HEADER ===== */
.page-header {
  margin-bottom: 16px;
}
.page-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0 0 4px;
}
.page-header h1 span { color: var(--primary); }
.page-header .subtitle {
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* ===== EMPTY STATE ===== */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}
.empty svg { width: 48px; height: 48px; opacity: 0.4; margin-bottom: 16px; }
.empty p { margin: 0; font-size: 0.95rem; }

/* ===== FLASH ===== */
.flash {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
}
.flash-success { background: rgba(16,185,129,0.15); color: #10b981; border: 1px solid rgba(16,185,129,0.3); }
.flash-error { background: rgba(239,68,68,0.15); color: #ef4444; border: 1px solid rgba(239,68,68,0.3); }

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}
.stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.stat-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}
.stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
}
.stat-value.primary { color: var(--primary); }
.stat-value.green { color: var(--green); }
.stat-value.blue { color: var(--blue); }

/* ===== STATUS BADGES ===== */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
}
.status-draft { background: rgba(113,113,122,0.15); color: var(--text-dim); }
.status-scheduled { background: rgba(59,130,246,0.15); color: var(--blue); }
.status-published { background: rgba(16,185,129,0.15); color: var(--green); }
