/* ═══════════════════════════════════════════════════════
   monitor.css — Monitor tab, News/RSS tab
   ═══════════════════════════════════════════════════════ */

/* ── Monitor Tab ── */
.monitor-container { padding: 24px; max-width: 1600px; margin: 0 auto; }
.monitor-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; align-items: start; }
.monitor-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); transition: box-shadow 0.2s; }
.monitor-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.monitor-card .card-header { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }

/* Balance Card */
.balance-card { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; border: none; }
.balance-card .card-header { color: white; opacity: 0.95; }
#balance-content { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.balance-display { display: flex; align-items: center; gap: 12px; font-size: 48px; font-weight: 700; color: white; }
.balance-icon { font-size: 36px; }
.balance-amount { font-family: var(--mono); }
.balance-high { color: #10b981; }
.balance-medium { color: #f59e0b; }
.balance-low { color: #ef4444; }
.balance-card .balance-high, .balance-card .balance-medium, .balance-card .balance-low { color: white; }

.btn-refresh { background: rgba(255,255,255,0.2); color: white; border: 1px solid rgba(255,255,255,0.3); padding: 8px 16px; border-radius: var(--radius); cursor: pointer; font-size: 14px; font-weight: 500; transition: background 0.2s; }
.btn-refresh:hover:not(:disabled) { background: rgba(255,255,255,0.3); }
.btn-refresh:disabled { opacity: 0.6; cursor: not-allowed; }

/* Functions/Tools Lists */
.compact-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin: 0; padding: 0; }
.compact-list li { font-size: 13px; color: var(--text-dim); padding: 6px 10px; background: var(--bg); border-radius: 4px; border: 1px solid var(--border); transition: background 0.15s, border-color 0.15s; }
.compact-list li:hover { background: var(--bg-hover); border-color: var(--accent); }
.compact-list li code { font-family: var(--mono); font-size: 12px; color: var(--accent); }
.more-info { margin-top: 12px; font-size: 13px; color: var(--text-muted); font-style: italic; }
.btn-show-all { margin-top: 12px; background: var(--bg); border: 1px solid var(--border); padding: 8px 16px; border-radius: var(--radius); cursor: pointer; font-size: 13px; color: var(--text-dim); transition: background 0.2s, border-color 0.2s; }
.btn-show-all:hover { background: var(--bg-hover); border-color: var(--accent); color: var(--accent); }

/* Cron Jobs */
.cron-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.cron-job { padding: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); transition: background 0.15s; }
.cron-job:hover { background: var(--bg-hover); }
.cron-name { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--accent); margin-bottom: 4px; }
.cron-schedule { font-family: var(--mono); font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }
.cron-desc { font-size: 12px; color: var(--text-dim); line-height: 1.4; }

/* Stat Rows */
.stat-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--bg); }
.stat-row:last-child { border-bottom: none; }
.stat-row.total { border-top: 2px solid var(--border); padding-top: 12px; margin-top: 8px; font-weight: 600; }
.stat-label { font-size: 14px; color: var(--text-dim); }
.stat-value { font-size: 18px; font-weight: 700; font-family: var(--mono); color: var(--accent); }
.stat-row.total .stat-value { font-size: 20px; }

/* ── News/RSS Tab ── */
.news-container { width: 100%; max-width: 800px; margin: 0 auto; padding: 24px; }
.news-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.btn-add-feed, .btn-refresh-feeds { padding: 8px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-card); color: var(--text); font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s; }
.btn-add-feed:hover, .btn-refresh-feeds:hover { background: var(--bg-hover); border-color: var(--accent); }
.btn-add-feed { background: var(--accent); color: white; border-color: var(--accent); }
.btn-add-feed:hover { background: var(--accent-dim); }

/* Feed Filters */
.feed-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.feed-filter { padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border); background: var(--bg-card); font-size: 13px; font-weight: 500; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: all 0.2s; color: var(--text-dim); }
.feed-filter:hover { background: var(--bg-hover); border-color: var(--accent); }
.feed-filter.active { background: var(--accent); color: white; border-color: var(--accent); }
.feed-filter.disabled { opacity: 0.5; cursor: not-allowed; text-decoration: line-through; }
.feed-name { flex: 1; }
.feed-menu-trigger { margin-left: 4px; padding: 0 4px; font-size: 16px; font-weight: bold; opacity: 0.6; transition: opacity 0.2s; }
.feed-menu-trigger:hover { opacity: 1; }

/* Feed Context Menu */
.feed-context-menu { position: fixed; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 4px 12px rgba(0,0,0,0.15); padding: 6px; z-index: 10003; min-width: 140px; }
.feed-context-menu button { display: block; width: 100%; padding: 8px 12px; border: none; background: none; color: var(--text); font-size: 13px; text-align: left; cursor: pointer; border-radius: 4px; transition: background 0.2s; }
.feed-context-menu button:hover { background: var(--bg-hover); }
.feed-context-menu button.danger { color: var(--red); }
.feed-context-menu button.danger:hover { background: #FEE; }
.source-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* Add Feed Dialog */
.add-feed-dialog { background: var(--bg-card); border-radius: var(--radius); padding: 20px; border: 1px solid var(--border); box-shadow: 0 2px 8px rgba(0,0,0,0.1); margin-bottom: 20px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.add-feed-dialog input[type="text"], .add-feed-dialog input[type="url"] { padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; flex: 1; min-width: 180px; background: var(--bg-input); color: var(--text); }
.add-feed-dialog input[type="color"] { width: 42px; height: 38px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; background: none; }

/* Article List */
.news-date-group { margin-bottom: 32px; }
.news-date-label { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 16px; padding-bottom: 8px; border-bottom: 2px solid var(--bg); }
.news-article { display: flex; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--bg); cursor: pointer; transition: all 0.15s; }
.news-article:hover { background: var(--bg-hover); margin: 0 -16px; padding: 16px; border-radius: var(--radius); }
.news-article:last-child { border-bottom: none; }
.article-thumbnail { flex-shrink: 0; width: 80px; height: 80px; border-radius: var(--radius); overflow: hidden; background: var(--bg); }
.article-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.article-content { flex: 1; min-width: 0; }
.article-source { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.source-name { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.article-time { font-size: 12px; color: var(--text-muted); margin-left: auto; opacity: 0.7; }
.article-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 6px; line-height: 1.4; }
.article-preview { font-size: 14px; color: var(--text-dim); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Translate Button */
.btn-translate-reader { padding: 10px 18px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-card); color: var(--text-dim); font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn-translate-reader:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--accent); color: var(--accent); }
.btn-translate-reader.translated { background: #E3F2FD; border-color: #2196F3; color: #1976D2; }
.btn-translate-reader.loading { opacity: 0.6; cursor: wait; }
.btn-translate-reader:disabled { cursor: not-allowed; opacity: 0.5; }
.translate-icon { font-size: 16px; line-height: 1; }
.translate-text { font-size: 13px; }

/* Loading/Error/Empty */
.news-loading { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.news-loading .spinner { width: 40px; height: 40px; margin: 0 auto 16px; border: 3px solid var(--bg); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.news-loading p { font-size: 14px; }
.news-error { background: #FEE; border: 1px solid #ECC; border-radius: var(--radius); padding: 16px; margin-bottom: 20px; color: var(--red); font-size: 14px; }
.news-empty { text-align: center; padding: 80px 20px; color: var(--text-muted); }
.news-empty h3 { font-size: 18px; margin-bottom: 8px; color: var(--text-dim); }
.news-empty p { font-size: 14px; }

/* Article Reader Modal */
.article-reader-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0); backdrop-filter: blur(0px); z-index: 10001; opacity: 0; pointer-events: none; transition: all 0.3s cubic-bezier(0.4,0,0.2,1); }
.article-reader-backdrop.active { background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); opacity: 1; pointer-events: all; cursor: pointer; }
.article-reader { position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%) scale(0.9); width: 700px; max-width: 92vw; height: 90vh; background: var(--bg-card); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0,0,0,0.3); z-index: 10002; display: flex; flex-direction: column; opacity: 0; transition: transform 0.3s cubic-bezier(0.4,0,0.2,1), opacity 0.3s ease; pointer-events: none; }
.article-reader.active { transform: translate(-50%,-50%) scale(1); opacity: 1; pointer-events: all; }
.reader-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.reader-close { background: none; border: none; font-size: 32px; line-height: 1; color: var(--text-muted); cursor: pointer; padding: 0; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: all 0.2s; }
.reader-close:hover { background: var(--bg-hover); color: var(--text); }
.reader-body { flex: 1; overflow-y: auto; padding: 24px 20px; }
.reader-title { font-size: 28px; font-weight: 700; line-height: 1.3; margin-bottom: 12px; color: var(--text); }
.reader-author { font-size: 14px; color: var(--text-muted); margin-bottom: 16px; }
.reader-image { margin: 20px 0; border-radius: var(--radius); overflow: hidden; }
.reader-image img { width: 100%; height: auto; display: block; }
.reader-content { font-size: 16px; line-height: 1.8; color: var(--text-dim); }
.reader-content p { margin-bottom: 16px; }
.reader-content img { max-width: 100%; height: auto; border-radius: var(--radius); margin: 16px 0; }
.reader-loading-more { display: flex; align-items: center; gap: 12px; padding: 20px 0; color: var(--text-muted); font-size: 14px; }
.reader-loading-more .spinner { width: 20px; height: 20px; border: 2px solid var(--bg); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; flex-shrink: 0; }
.reader-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: center; gap: 12px; }

/* Responsive */
@media (max-width: 1024px) { .monitor-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); } .compact-list { grid-template-columns: 1fr; } }
@media (max-width: 767px) {
  .monitor-container { padding: 16px; }
  .monitor-grid { grid-template-columns: 1fr; gap: 16px; }
  .balance-display { font-size: 36px; }
  .balance-icon { font-size: 28px; }
  .news-container { padding: 16px; }
  .news-toolbar { flex-direction: column; align-items: flex-start; }
  .feed-filters { margin-left: 0; width: 100%; }
  .add-feed-dialog { flex-direction: column; align-items: stretch; }
  .add-feed-dialog input { min-width: 100%; }
  .article-title { font-size: 15px; }
  .article-preview { font-size: 13px; }
}
