/* ============================================
   Al Jazeera Clone v3 — World Class CSS
   ============================================ */

/* ── Sticky Breaking News Bar ── */
.breaking-bar {
    position: sticky;
    top: 0;
    z-index: 1100;
    box-shadow: 0 2px 8px rgba(232,0,28,0.3);
}
.breaking-ticker span {
    transition: opacity 0.4s;
}

/* ── Weather Widget ── */
.weather-widget {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #bbb;
    font-size: 0.82rem;
    border-left: 1px solid #333;
    padding-left: 12px;
    margin-left: 8px;
}
.weather-widget .weather-temp {
    font-weight: 700;
    color: #fff;
    font-size: 0.88rem;
}
.weather-widget .weather-icon { font-size: 1rem; }
.weather-widget .wi-hot       { color: #f97316; }
.weather-widget .wi-rain      { color: #60a5fa; }
.weather-widget .wi-cloud     { color: #94a3b8; }
.weather-widget .wi-clear     { color: #fbbf24; }
.weather-widget .wi-snow      { color: #e0f2fe; }

/* ── PWA Install Banner ── */
#pwa-install-btn {
    display: none;
    align-items: center;
    gap: 8px;
    background: rgba(232,0,28,0.12);
    border: 1px solid rgba(232,0,28,0.3);
    color: #fff;
    padding: 5px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.2s;
}
#pwa-install-btn:hover { background: rgba(232,0,28,0.25); }

/* ── Push Notification Button ── */
#push-subscribe-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px solid #444;
    color: #ccc;
    font-size: 0.78rem;
    padding: 4px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}
#push-subscribe-btn:hover { border-color: var(--aj-red); color: var(--aj-red); }
#push-subscribe-btn.subscribed { border-color: #16a34a; color: #16a34a; }

/* ── Search Autocomplete ── */
.search-autocomplete {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1e1e1e;
    border: 1px solid #333;
    border-top: none;
    z-index: 9999;
    max-height: 360px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.autocomplete-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    color: #ccc;
    font-size: 0.85rem;
    text-decoration: none;
    border-bottom: 1px solid #2a2a2a;
    transition: background 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.autocomplete-item:hover { background: #2a2a2a; color: #fff; }
.autocomplete-item:last-child { border-bottom: none; }

/* ── Toast Notifications ── */
.aj-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1e1e1e;
    color: #fff;
    padding: 12px 20px;
    border-radius: 4px;
    font-size: 0.88rem;
    font-weight: 600;
    z-index: 99999;
    transform: translateY(80px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    border-left: 4px solid var(--aj-red);
    max-width: 320px;
}
.aj-toast.show { transform: translateY(0); opacity: 1; }
.aj-toast-success i { color: #4ade80; }
.aj-toast-error { border-left-color: #ef4444; }
.aj-toast-error i { color: #ef4444; }

/* ── Bookmarks ── */
.bookmark-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px solid var(--aj-border);
    color: #888;
    font-size: 0.8rem;
    padding: 6px 14px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
}
.bookmark-btn:hover { border-color: var(--aj-red); color: var(--aj-red); }
.bookmark-btn.bookmarked { background: var(--aj-red); color: #fff; border-color: var(--aj-red); }
.bookmark-btn.bookmarked i::before { content: "\f02e"; }

/* ── Reading Time ── */
.reading-time {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    color: #888;
    background: var(--aj-light-gray);
    padding: 3px 10px;
    border-radius: 20px;
}
body.dark-mode .reading-time { background: #2a2a2a; color: #aaa; }

/* ── Infinite Scroll ── */
#infinite-spinner {
    display: none;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 32px;
    color: #888;
    font-size: 0.88rem;
}
.aj-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e0e0e0;
    border-top-color: var(--aj-red);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Live Blog ── */
.live-blog-header {
    background: var(--aj-red);
    color: #fff;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0;
}
.live-blog-badge {
    background: #fff;
    color: var(--aj-red);
    padding: 2px 10px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 2px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.live-blog-badge .live-dot {
    width: 7px;
    height: 7px;
    background: var(--aj-red);
    border-radius: 50%;
    animation: blink 1s infinite;
}
@keyframes blink { 0%,100% { opacity:1; } 50% { opacity:0; } }
.live-blog-badge.flash { animation: flash-anim 0.5s; }
@keyframes flash-anim { 0%,100% { background:#fff; } 50% { background:#ffd700; } }

.live-entry {
    padding: 16px;
    border-bottom: 1px solid var(--aj-border);
    position: relative;
}
body.dark-mode .live-entry { border-color: #2a2a2a; }
.live-entry-new { animation: slideIn 0.4s ease; background: rgba(232,0,28,0.04); }
@keyframes slideIn { from { opacity:0; transform:translateY(-12px); } to { opacity:1; transform:translateY(0); } }
.live-entry-time {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--aj-red);
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.live-pinned {
    display: inline-block;
    background: #fef9c3;
    color: #a16207;
    font-size: 0.68rem;
    padding: 1px 8px;
    border-radius: 2px;
    font-weight: 700;
    margin-bottom: 6px;
}
.live-entry-content { font-size: 0.95rem; line-height: 1.65; color: var(--aj-text); }
body.dark-mode .live-entry-content { color: #ddd; }
.live-entry-author { font-size: 0.78rem; color: #888; margin-top: 6px; font-style: italic; }
.live-blog-update-count {
    font-size: 0.78rem;
    color: #888;
    padding: 8px 16px;
    background: #f7f7f7;
    border-bottom: 1px solid var(--aj-border);
}
body.dark-mode .live-blog-update-count { background: #1a1a1a; border-color: #2a2a2a; }

/* ── Analytics Charts (admin) ── */
.analytics-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    padding: 20px;
}
body.dark-mode .analytics-card { background: #1e1e1e; border-color: #2a2a2a; }
.analytics-chart-wrap { position: relative; height: 240px; }
.analytics-stat-big {
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--aj-dark);
    line-height: 1;
}
body.dark-mode .analytics-stat-big { color: #f0f0f0; }
.analytics-stat-label { font-size: 0.8rem; color: #888; margin-top: 4px; }
.analytics-stat-change { font-size: 0.78rem; font-weight: 600; margin-top: 6px; }
.analytics-stat-change.up { color: #16a34a; }
.analytics-stat-change.down { color: #dc2626; }

/* ── Workflow Review ── */
.workflow-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.workflow-draft     { background: #f1f5f9; color: #64748b; }
.workflow-pending   { background: #fef3c7; color: #b45309; }
.workflow-approved  { background: #dcfce7; color: #16a34a; }
.workflow-rejected  { background: #fee2e2; color: #dc2626; }
.workflow-published { background: #dbeafe; color: #1d4ed8; }

.review-panel {
    background: #fffbeb;
    border: 1px solid #fde68a;
    padding: 16px;
    border-radius: 4px;
    margin-bottom: 16px;
}
body.dark-mode .review-panel { background: #1c1a0f; border-color: #3d3200; }

/* ── AMP Link ── */
.amp-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    color: #888;
    text-decoration: none;
    border: 1px solid #e0e0e0;
    padding: 2px 8px;
    border-radius: 3px;
    transition: all 0.2s;
}
.amp-link:hover { color: var(--aj-red); border-color: var(--aj-red); }
.amp-link .amp-icon { font-weight: 800; font-size: 0.7rem; color: #0057e7; }

/* ── Bookmarks Page ── */
.bookmarks-empty {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}
.bookmarks-empty i { font-size: 3rem; color: #e0e0e0; margin-bottom: 16px; }

/* ── Dark mode for new elements ── */
body.dark-mode .search-autocomplete { background: #1e1e1e; border-color: #333; }
body.dark-mode .autocomplete-item { color: #ccc; border-color: #2a2a2a; }
body.dark-mode .autocomplete-item:hover { background: #2a2a2a; }
body.dark-mode .aj-toast { background: #2a2a2a; }
body.dark-mode .live-blog-update-count { background: #1a1a1a; }
body.dark-mode .live-pinned { background: #2a2200; color: #fbbf24; }
body.dark-mode .bookmark-btn { border-color: #333; color: #888; }
body.dark-mode .reading-time { background: #2a2a2a; }
body.dark-mode .review-panel { background: #1c1a0f; border-color: #3d3200; }
