/* ==========================================================================
   My Guardian — Styles matching Screenshot 2026-09-21 at 09.17.48.png
   ========================================================================== */

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

body {
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-x: hidden;
  user-select: none;
}

/* App Viewport Container (Centered phone container on desktop, full screen on mobile) */
.app-viewport {
  width: 100%;
  max-width: var(--max-app-width);
  min-height: 100vh;
  background-color: var(--bg-app-container);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
  padding-bottom: 120px; /* Space for floating bar and bottom nav */
}

/* ==========================================================================
   1. Status Bar Emulation
   ========================================================================== */
.status-bar {
  height: 44px;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.status-bar-icons {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.battery-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 4px;
  padding: 1px 4px;
  font-size: 11px;
  font-weight: 700;
}

/* ==========================================================================
   2. App Header
   ========================================================================== */
.app-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px 14px;
}

.app-title {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.btn-reset-feed {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text-secondary);
  padding: 5px 10px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
}

.btn-reset-feed:hover {
  background: rgba(255, 255, 255, 0.16);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.35);
}

.btn-reset-feed:active {
  transform: translateY(-50%) scale(0.94);
}

.btn-reset-feed.rotating .reset-icon {
  animation: spin 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   3. Horizontal Topic Pill Bar
   ========================================================================== */
.topic-pills-bar {
  display: flex;
  gap: 10px;
  padding: 4px 16px 14px;
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.topic-pills-bar::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.pill-item {
  flex-shrink: 0;
  height: 38px;
  padding: 0 16px;
  border-radius: 19px;
  background-color: var(--bg-pill-inactive);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pill-item.active {
  background-color: var(--bg-pill-active);
  color: var(--text-pill-active);
}

.pill-item .badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-blue-badge);
}

/* ==========================================================================
   4. Subheader Controls ("Topic view" and "Edit topics")
   ========================================================================== */
.controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px 16px;
}

.dropdown-topic-view {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  background: none;
  border: none;
  cursor: pointer;
}

.circle-arrow-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #2c2c2e;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.btn-edit-topics {
  padding: 6px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-edit-topics:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   5. Topic Sections
   ========================================================================== */
.feed-container {
  display: flex;
  flex-direction: column;
}

.topic-section {
  position: relative;
}

.topic-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px 10px;
}

.topic-section-title {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.8px;
  color: var(--text-primary);
}

/* "Get latest" button shown when 3 stories are triaged */
.btn-get-latest {
  display: none;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #00b2d6, #007799);
  color: #ffffff;
  border: none;
  border-radius: 16px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 178, 214, 0.4);
  transition: transform 0.15s, background 0.2s;
}

.btn-get-latest.visible {
  display: inline-flex;
}

.btn-get-latest:hover {
  transform: scale(1.03);
}

.btn-get-latest:active {
  transform: scale(0.97);
}

.section-divider-bar {
  height: 12px;
  background-color: var(--section-divider-bg);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  margin-top: 10px;
}

/* ==========================================================================
   6. Article Card & Swipe Backing Layers
   ========================================================================== */
.story-card-wrapper {
  position: relative;
  overflow: hidden;
  background-color: var(--bg-app-container);
  border-bottom: 1px solid var(--border-subtle);
  touch-action: pan-y; /* Allow vertical page scroll while capturing horizontal swipe */
}

/* Swipe action backing layer */
.swipe-action-backing {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  z-index: 1;
  pointer-events: none;
}

.action-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.action-indicator.save {
  color: var(--swipe-save-accent);
}

.action-indicator.dismiss {
  color: var(--swipe-dismiss-accent);
}

/* Front card that is physically dragged */
.story-card {
  position: relative;
  z-index: 2;
  background-color: var(--bg-app-container);
  padding: 14px 16px;
  display: flex;
  gap: 14px;
  cursor: grab;
  will-change: transform;
}

.story-card:active {
  cursor: grabbing;
}

/* Thumbnail */
.story-thumb-box {
  width: var(--card-thumb-size);
  height: var(--card-thumb-size);
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  background-color: #1a1a1a;
}

.story-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Content Details */
.story-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.story-kicker {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-cyan);
  margin-bottom: 2px;
  line-height: 1.2;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #1e262c;
  color: var(--accent-cyan);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  margin-bottom: 4px;
}

.live-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent-cyan);
}

.story-headline {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.story-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-secondary);
}

.story-time {
  font-size: 12px;
}

.story-dots-menu {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  letter-spacing: 1px;
  cursor: pointer;
  padding: 2px 6px;
}

/* ==========================================================================
   7. Floating Segmented Navigation (Following, Saved, History)
   ========================================================================== */
.floating-nav-wrapper {
  position: fixed;
  bottom: var(--floating-bar-bottom);
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  z-index: 90;
  pointer-events: none;
}

.floating-nav {
  pointer-events: auto;
  display: flex;
  align-items: center;
  background: rgba(28, 28, 30, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 28px;
  padding: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.floating-tab-btn {
  padding: 8px 20px;
  border-radius: 24px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.floating-tab-btn.active {
  background-color: var(--accent-cyan-bright);
  color: #000000;
  font-weight: 700;
}

/* ==========================================================================
   8. Bottom App Tab Bar
   ========================================================================== */
.bottom-app-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-bar-height);
  background: rgba(18, 18, 18, 0.98);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 95;
  max-width: var(--max-app-width);
  margin: 0 auto;
}

.bottom-tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  flex: 1;
}

.bottom-tab-item.active {
  color: var(--accent-cyan);
}

.tab-icon {
  font-size: 18px;
  line-height: 1;
}

/* ==========================================================================
   9. Full Article Reader Modal
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
}

.modal-sheet {
  width: 100%;
  max-width: var(--max-app-width);
  max-height: 90vh;
  background: #121212;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  overflow-y: auto;
  transform: translateY(100%);
  display: flex;
  flex-direction: column;
}

.modal-header {
  position: sticky;
  top: 0;
  background: rgba(18, 18, 18, 0.95);
  backdrop-filter: blur(10px);
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  z-index: 10;
}

.modal-close-btn {
  background: #222224;
  border: none;
  color: #ffffff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-action-btn {
  background: #222224;
  border: none;
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.modal-body {
  padding: 20px 18px 60px;
}

.article-reader-kicker {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-cyan);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.article-reader-headline {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 14px;
}

.article-reader-meta {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.article-reader-hero {
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 18px;
}

.article-reader-hero img {
  width: 100%;
  height: auto;
  display: block;
}

.article-reader-content {
  font-size: 16px;
  line-height: 1.6;
  color: #e0e0e0;
}

.article-reader-content p {
  margin-bottom: 16px;
}

.article-reader-content a {
  color: var(--accent-cyan);
  text-decoration: underline;
}

.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 15px;
}

.empty-state-icon {
  font-size: 36px;
  margin-bottom: 12px;
}
