/* ============================================
   AI Daily - Newspaper Edition Stylesheet
   ============================================ */

/* ── Root Variables (Light Newspaper Theme) ── */
:root {
  --primary: #8b1a1a;
  --primary-dark: #5c1010;
  --secondary: #1a3a5c;
  --accent: #c4a35a;
  --bg: #faf7f0;
  --bg-card: #fefcf9;
  --bg-card-hover: #fdfaf5;
  --bg-input: #fefcf9;
  --text: #111111;
  --text-muted: #666666;
  --border: #d8d0c5;
  --border-glow: rgba(139, 26, 26, 0.15);
  --success: #2d6a4f;
  --warning: #b8860b;
  --danger: #8b1a1a;
  --glow-pink: rgba(139, 26, 26, 0.1);
  --glow-purple: rgba(26, 58, 92, 0.1);
  --glow-blue: rgba(26, 58, 92, 0.1);
}

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

body {
  font-family: Georgia, 'Times New Roman', Times, 'Noto Serif SC', serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.8;
  overflow-x: hidden;
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  font-family: Georgia, 'Times New Roman', Times, 'Noto Serif SC', serif;
  font-weight: 700;
  line-height: 1.3;
}

/* No animated backgrounds or fake elements */
body::before, body::after { display: none; }

/* ── Layout Container ── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }

/* ── Header / Top Navigation ── */
header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-family: Georgia, 'Times New Roman', Times, serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo span {
  background: var(--primary);
  color: white;
  padding: 0.15rem 0.4rem;
  font-size: 0.7rem;
  font-family: -apple-system, sans-serif;
}

nav a {
  color: var(--text-muted);
  text-decoration: none;
  margin-left: 1.5rem;
  font-size: 0.85rem;
  font-family: -apple-system, sans-serif;
  letter-spacing: 0.5px;
  transition: color 0.2s;
}

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

/* ── Masthead (Newspaper Nameplate) ── */
.masthead {
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
  border-bottom: 3px double #333;
  margin-bottom: 1.5rem;
  position: relative;
}

.masthead::before {
  content: '';
  display: block;
  width: 60px;
  height: 3px;
  background: var(--primary);
  margin: 0 auto 1.2rem;
}

.masthead h1 {
  font-size: 3.2rem;
  font-weight: 900;
  letter-spacing: 4px;
  color: #111;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
  font-family: Georgia, 'Times New Roman', Times, serif;
  background: none;
  -webkit-text-fill-color: #111;
}

.masthead .tagline {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  letter-spacing: 2px;
  font-family: Georgia, serif;
}

.masthead .date-bar {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: -apple-system, sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.masthead .date-bar span { color: var(--text); font-weight: 700; }

/* ── English Version Notice ── */
.lang-notice {
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
}

.lang-notice a {
  color: var(--secondary);
  text-decoration: none;
  font-weight: 700;
}

.lang-notice a:hover { text-decoration: underline; }

/* ── Category Filter ── */
.category-nav {
  display: flex;
  justify-content: center;
  gap: 0.25rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
}

.category-nav button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.3rem 0.8rem;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: -apple-system, sans-serif;
  transition: all 0.2s;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.category-nav button:hover { color: var(--text); }

.category-nav button.active {
  color: var(--primary);
  font-weight: 700;
  position: relative;
}

.category-nav button.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0.8rem;
  right: 0.8rem;
  height: 2px;
  background: var(--primary);
}

/* ── Post Count ── */
.post-count {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 1rem;
  font-family: -apple-system, sans-serif;
  letter-spacing: 0.5px;
}

/* ── Article Grid (2-column newspaper layout) ── */
.post-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 0 0 2rem;
}

/* Full-width featured first article */
.post-list .post-item:first-child {
  grid-column: 1 / -1;
  border-bottom: 2px solid #333;
  padding: 1.5rem 0;
  margin-bottom: 0;
}

.post-item {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}

.post-item:nth-child(odd) {
  border-right: 1px solid var(--border);
}

/* Remove right border from last column */
.post-item:nth-child(even):last-child,
.post-item:nth-child(odd):last-child {
  border-right: none;
}

.post-item:hover {
  background: var(--bg-card-hover);
}

/* First article (featured) special styling */
.post-item:first-child h2 {
  font-size: 1.6rem;
  margin-bottom: 0.75rem;
}

.post-item:first-child .summary {
  font-size: 1rem;
  line-height: 1.7;
}

.post-item:first-child .tags { margin-top: 1rem; }

.post-item .date {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: -apple-system, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.3rem;
}

.post-item h2 {
  font-size: 1.1rem;
  margin: 0.2rem 0 0.4rem;
  color: #111;
  font-weight: 700;
  line-height: 1.35;
}

.post-item h2:hover { color: var(--primary); }

.post-item .summary {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.6;
  margin-top: 0.3rem;
}

.post-item .tags {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.post-item .tag {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: -apple-system, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.post-item .tag::before { content: '#'; }

.post-item .read-more {
  font-size: 0.8rem;
  color: var(--primary);
  margin-top: 0.5rem;
  display: inline-block;
  font-family: Georgia, serif;
  font-style: italic;
  transition: color 0.2s;
}

.post-item:hover .read-more { color: var(--secondary); }

/* ── Loading State ── */
.loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  font-style: italic;
}

.loading .spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 0.5rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Pagination ── */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.25rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.pagination button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  font-family: -apple-system, sans-serif;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.pagination button:hover {
  background: var(--bg-card);
  border-color: var(--text-muted);
}

.pagination button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.pagination button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ── Footer ── */
footer {
  border-top: 2px solid #333;
  padding: 2rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: -apple-system, sans-serif;
}

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

footer a:hover { text-decoration: underline; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

::selection { background: rgba(139, 26, 26, 0.15); color: var(--text); }

/* ── Hero ── */
.hero { display: none; }

/* ── Tool Grid (Free AI Tools compatibility) ── */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 2rem 0 4rem;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 1.5rem;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: box-shadow 0.2s;
}

.tool-card:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.tool-card .icon { font-size: 2rem; margin-bottom: 1rem; }
.tool-card h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.tool-card p { color: var(--text-muted); font-size: 0.85rem; line-height: 1.5; flex: 1; }
.tool-card .tag {
  display: inline-block;
  background: transparent;
  color: var(--primary);
  font-size: 0.75rem;
  padding: 0.25rem 0;
  margin-top: 1rem;
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  font-family: -apple-system, sans-serif;
}

/* ── Tool Page ── */
.tool-page { padding: 2rem 0 4rem; }
.tool-header { margin-bottom: 2rem; }
.tool-header h1 { font-size: 1.8rem; margin-bottom: 0.5rem; }
.tool-header p { color: var(--text-muted); }

.tool-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 2rem;
}

.tool-container textarea,
.tool-container input[type="text"],
.tool-container input[type="number"],
.tool-container select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.tool-container textarea:focus,
.tool-container input:focus,
.tool-container select:focus {
  outline: none;
  border-color: var(--primary);
}

.tool-container textarea { resize: vertical; min-height: 150px; }
.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: 0.5rem; font-size: 0.9rem; }
.form-group .help-text { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 2rem;
  border: 1px solid var(--border);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  background: var(--bg-card);
  color: var(--text);
}

.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg-card); color: var(--text); }
.btn-secondary:hover { border-color: var(--primary); }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.result-box {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 1rem;
  margin-top: 1rem;
  min-height: 100px;
  white-space: pre-wrap;
  word-wrap: break-word;
  position: relative;
}

.result-box .empty-state { color: var(--text-muted); text-align: center; padding: 2rem; font-style: italic; }

.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.25rem 0.75rem;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
}

.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1rem; margin: 1rem 0; }
.stat-box { background: var(--bg); border: 1px solid var(--border); padding: 1rem; text-align: center; }
.stat-box .value { font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.stat-box .label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }

.pw-display {
  background: var(--bg);
  border: 2px solid var(--border);
  padding: 1rem 1.5rem;
  font-family: 'Courier New', monospace;
  font-size: 1.4rem;
  text-align: center;
  word-break: break-all;
  margin-bottom: 1rem;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.strength-bar { height: 6px; margin: 0.5rem 0 1rem; transition: all 0.3s; }
.strength-weak { background: var(--danger); width: 25%; }
.strength-medium { background: var(--warning); width: 50%; }
.strength-strong { background: var(--success); width: 75%; }
.strength-very-strong { background: var(--success); width: 100%; }

.checkbox-group { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.checkbox-group label { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; font-size: 0.9rem; cursor: pointer; }
.checkbox-group input[type="checkbox"] { width: 18px; height: 18px; }

.ad-placeholder {
  background: var(--bg-card);
  border: 1px dashed var(--border);
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 2rem 0;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 2rem; right: 2rem;
  background: var(--primary);
  color: white;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
  z-index: 1000;
}
.toast.show { transform: translateY(0); opacity: 1; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ── Bookmark FAB & Modal ── */
.bookmark-fab {
  position: fixed;
  bottom: 1.5rem; right: 1.5rem;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 1.3rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}
.bookmark-fab:hover { transform: scale(1.05); }
.bookmark-fab .tooltip {
  position: absolute;
  right: 60px;
  background: var(--bg-card);
  color: var(--text);
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  white-space: nowrap;
  border: 1px solid var(--border);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.bookmark-fab:hover .tooltip { opacity: 1; }

.bookmark-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}
.bookmark-overlay.show { display: flex; }

@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.bookmark-modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 2rem;
  max-width: 420px;
  width: 90%;
  text-align: center;
  animation: slideUp 0.3s;
  position: relative;
}
.bookmark-modal .close-btn {
  position: absolute; top: 0.75rem; right: 0.75rem;
  background: none; border: none; color: var(--text-muted);
  font-size: 1.2rem; cursor: pointer; padding: 0.25rem; line-height: 1;
}
.bookmark-modal .icon-big { font-size: 3rem; margin-bottom: 0.75rem; }
.bookmark-modal h2 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.bookmark-modal p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }
.bookmark-modal .shortcut {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--bg); border: 1px solid var(--border);
  padding: 0.6rem 1.2rem;
  font-size: 0.95rem; font-weight: 700; color: var(--primary); margin-bottom: 1rem;
}
.bookmark-modal .shortcut kbd {
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 0.15rem 0.5rem;
  font-size: 0.8rem; font-family: inherit;
}
.bookmark-modal .value-list { display: flex; flex-direction: column; gap: 0.5rem; text-align: left; margin-top: 1rem; }
.bookmark-modal .value-list .item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--text-muted); }
.bookmark-modal .value-list .item .dot { width: 6px; height: 6px; background: var(--primary); flex-shrink: 0; }

/* ── Notification Banner ── */
.notif-banner {
  border: 1px solid var(--border);
  background: var(--bg-card);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  display: none;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}
.notif-banner.show { display: flex; }
.notif-banner .notif-icon { font-size: 1.3rem; flex-shrink: 0; }
.notif-banner .notif-text { flex: 1; color: var(--text); }
.notif-banner .notif-text a { color: var(--secondary); text-decoration: none; font-weight: 700; }
.notif-banner .notif-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1rem; }

/* ── PWA Install Banner ── */
.pwa-install-banner {
  position: fixed;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 0.75rem 1.25rem;
  display: none;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  z-index: 998;
  white-space: nowrap;
}
.pwa-install-banner.show { display: flex; }
.pwa-install-banner .pwa-install-btn { background: var(--primary); border: none; color: white; padding: 0.4rem 1rem; cursor: pointer; font-size: 0.8rem; font-family: inherit; font-weight: 600; }
.pwa-install-banner .pwa-close-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1rem; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .masthead h1 { font-size: 1.8rem; letter-spacing: 2px; }
  .masthead { padding: 1.5rem 1rem 1rem; }
  .masthead .date-bar { flex-direction: column; gap: 0.25rem; }

  .post-list { grid-template-columns: 1fr; }
  .post-item { border-right: none !important; }
  .post-item:first-child h2 { font-size: 1.2rem; }
  .post-item h2 { font-size: 1rem; }
  .post-item:nth-child(odd) { border-right: none; }

  .form-row { grid-template-columns: 1fr; }
  .tool-grid { grid-template-columns: 1fr; }
  .checkbox-group { grid-template-columns: 1fr; }
  .bookmark-fab { width: 44px; height: 44px; font-size: 1.1rem; bottom: 1rem; right: 1rem; }
  .bookmark-modal { padding: 1.5rem; }
  .pwa-install-banner { bottom: 4rem; width: 90%; white-space: normal; }
}

@media (max-width: 480px) {
  .masthead h1 { font-size: 1.4rem; }
  header .logo { font-size: 0.9rem; }
  nav a { margin-left: 0.75rem; font-size: 0.75rem; }
}
