/* =============================================
   NOVA PWA — style.css
   Dark premium news app
   ============================================= */

/* ---- Reset & Base ---- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg:        #0a0a0f;
  --surface:   #14141c;
  --surface2:  #1c1c28;
  --surface3:  #242434;
  --border:    rgba(255,255,255,0.08);
  --border2:   rgba(255,255,255,0.14);
  --text:      #f0eeea;
  --muted:     #7a7890;
  --muted2:    #5a5870;
  --accent:    #e8c96d;
  --accent-bg: rgba(232,201,109,0.12);
  --violet:    #7b6ef6;
  --violet-bg: rgba(123,110,246,0.12);
  --red:       #e25454;
  --red-bg:    rgba(226,84,84,0.12);
  --green:     #5ec97a;
  --green-bg:  rgba(94,201,122,0.12);
  --font-serif:'Playfair Display', Georgia, serif;
  --font-sans: 'DM Sans', system-ui, sans-serif;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --nav-h:     72px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  overflow-x: hidden;
  position: relative;
}

button {
  font-family: var(--font-sans);
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

/* ---- Status Bar ---- */
.statusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 22px 6px;
  color: var(--text);
}

.time {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.statusbar-icons {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

/* ---- Header ---- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 20px 0;
}

.logo {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -1.5px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--violet) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  color: var(--text);
  transition: background 0.2s, transform 0.15s;
}

.icon-btn:hover { background: var(--surface2); }
.icon-btn:active { transform: scale(0.93); }

.badge {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid var(--bg);
  transition: opacity 0.2s;
}

.badge.hidden { opacity: 0; }

.avatar-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--violet), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  transition: transform 0.15s;
}

.avatar-btn:active { transform: scale(0.93); }

/* ---- Greeting ---- */
.greeting {
  padding: 8px 22px 0;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.3px;
}

/* ---- Search Bar ---- */
.search-bar {
  margin: 12px 16px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 11px 16px;
  transition: border-color 0.2s;
}

.search-bar:focus-within {
  border-color: var(--violet);
  background: var(--surface2);
}

.search-bar svg { color: var(--muted); flex-shrink: 0; }

.search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  caret-color: var(--accent);
}

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

.clear-btn {
  font-size: 13px;
  color: var(--muted);
  padding: 2px 4px;
  transition: color 0.2s;
}

.clear-btn:hover { color: var(--text); }

/* ---- Categories ---- */
.cats {
  display: flex;
  gap: 8px;
  padding: 14px 16px 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.cats::-webkit-scrollbar { display: none; }

.cat {
  padding: 8px 18px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  transition: all 0.2s;
  flex-shrink: 0;
}

.cat:hover:not(.active) {
  border-color: var(--border2);
  color: var(--text);
  background: var(--surface2);
}

.cat.active {
  background: var(--accent);
  color: #0a0a0f;
  border-color: var(--accent);
  font-weight: 700;
}

/* ---- Hero Article ---- */
.hero {
  margin: 14px 16px 0;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.25s, border-color 0.2s;
  animation: fadeUp 0.45s ease both;
}

.hero:hover { transform: scale(1.015); border-color: var(--border2); }
.hero:focus { outline: 2px solid var(--violet); outline-offset: 3px; }

.hero-img {
  width: 100%;
  height: 210px;
  background: linear-gradient(135deg, #1a1030 0%, #0d1a2e 50%, #1a1210 100%);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-emoji {
  font-size: 64px;
  opacity: 0.7;
  z-index: 1;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 40%, rgba(20,20,28,0.9) 100%);
}

.hero-body { padding: 16px 20px 20px; }

.hero-tags {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.hero-cat-tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--accent-bg);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.live-badge {
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--red-bg);
  color: var(--red);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

.hero-title {
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 14px;
  color: var(--text);
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}

.source {
  display: flex;
  align-items: center;
  gap: 7px;
}

.source-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--violet), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

/* ---- Section Header ---- */
.section-header {
  padding: 20px 20px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-header h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.see-all {
  font-size: 13px;
  color: var(--violet);
  font-weight: 500;
  transition: color 0.2s;
}

.see-all:hover { color: var(--accent); }

/* ---- Trending Horizontal Scroll ---- */
.trending {
  display: flex;
  gap: 10px;
  padding: 0 16px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.trending::-webkit-scrollbar { display: none; }

.trend-card {
  min-width: 145px;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 15px;
  cursor: pointer;
  transition: all 0.2s;
  animation: fadeUp 0.5s ease both;
}

.trend-card:nth-child(1) { animation-delay: 0.1s; }
.trend-card:nth-child(2) { animation-delay: 0.18s; }
.trend-card:nth-child(3) { animation-delay: 0.26s; }
.trend-card:nth-child(4) { animation-delay: 0.34s; }

.trend-card:hover {
  border-color: var(--violet);
  background: var(--surface2);
  transform: translateY(-3px);
}

.trend-card:focus { outline: 2px solid var(--violet); }

.trend-num {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--violet);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  margin-bottom: 7px;
}

.trend-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--text);
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.trend-views {
  font-size: 11px;
  color: var(--muted);
}

/* ---- News List ---- */
.news-list {
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.news-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
  transition: all 0.2s;
  animation: fadeUp 0.5s ease both;
}

.news-card:nth-child(1) { animation-delay: 0.2s; }
.news-card:nth-child(2) { animation-delay: 0.28s; }
.news-card:nth-child(3) { animation-delay: 0.36s; }
.news-card:nth-child(4) { animation-delay: 0.44s; }
.news-card:nth-child(5) { animation-delay: 0.52s; }
.news-card:nth-child(6) { animation-delay: 0.60s; }

.news-card:hover {
  border-color: var(--violet);
  background: var(--surface2);
  transform: translateX(4px);
}

.news-card:focus { outline: 2px solid var(--violet); }

.news-card.hidden { display: none; }

/* Thumbnails */
.news-thumb {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.thumb-tech  { background: linear-gradient(135deg, #1e1432, #0d1a2e); }
.thumb-tech2 { background: linear-gradient(135deg, #101428, #1e1040); }
.thumb-eco   { background: linear-gradient(135deg, #0d2010, #1a2e0d); }
.thumb-geo   { background: linear-gradient(135deg, #2e1212, #1a0d0d); }
.thumb-sci   { background: linear-gradient(135deg, #0d1a2e, #141428); }
.thumb-sport { background: linear-gradient(135deg, #1a1210, #2e1a0d); }

.news-content {
  flex: 1;
  min-width: 0;
}

/* Tags */
.news-tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.tag-tech  { background: var(--violet-bg); color: var(--violet); }
.tag-eco   { background: var(--green-bg);  color: var(--green); }
.tag-geo   { background: var(--red-bg);    color: var(--red); }
.tag-sci   { background: var(--accent-bg); color: var(--accent); }
.tag-sport { background: rgba(232,201,109,0.1); color: #e8a84d; }

.news-title-small {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  margin-bottom: 6px;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-meta-small {
  font-size: 11px;
  color: var(--muted);
}

/* Bookmark */
.bookmark-btn {
  font-size: 16px;
  flex-shrink: 0;
  opacity: 0.4;
  transition: opacity 0.2s, transform 0.15s;
  padding: 4px;
  align-self: center;
}

.bookmark-btn:hover  { opacity: 1; }
.bookmark-btn.saved  { opacity: 1; }
.bookmark-btn:active { transform: scale(1.3); }

/* ---- Bottom Nav ---- */
.bottomnav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: rgba(20,20,28,0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  display: flex;
  padding: 10px 6px calc(10px + var(--safe-bottom));
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  transition: all 0.2s;
}

.nav-item:hover { color: var(--text); background: var(--surface2); }
.nav-item:active { transform: scale(0.92); }

.nav-item.active { color: var(--accent); }

.nav-icon {
  width: 22px;
  height: 22px;
}

.nav-label {
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
}

/* ---- Animations ---- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Toast Notification ---- */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-80px);
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  z-index: 200;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}

.toast.show { transform: translateX(-50%) translateY(0); }

/* ---- Scrollbar (desktop) ---- */
::-webkit-scrollbar       { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 4px; }

/* ---- Responsive ---- */
@media (max-width: 360px) {
  .hero-title { font-size: 18px; }
  .cat { padding: 7px 14px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
