/* =============================================
   NewsPortal AI - Main Stylesheet
   ============================================= */

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

:root {
  --primary: #e63946;
  --primary-dark: #c1121f;
  --bg: #f8f9fa;
  --bg-card: #ffffff;
  --text: #212529;
  --text-muted: #6c757d;
  --border: #dee2e6;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --header-h: 64px;
}

body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.7; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ---- HEADER ---- */
.site-header { background: #1a1a2e; color: #fff; height: var(--header-h); position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 10px rgba(0,0,0,.3); }
.header-inner { display: flex; align-items: center; height: 100%; gap: 24px; }
.logo { font-size: 1.3rem; font-weight: 700; color: #fff; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.main-nav { display: flex; gap: 4px; flex: 1; }
.main-nav a { padding: 6px 12px; border-radius: 6px; color: rgba(255,255,255,.8); font-size: 0.88rem; transition: all .2s; }
.main-nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.search-form { display: flex; align-items: center; border: 1px solid rgba(255,255,255,.2); border-radius: 24px; overflow: hidden; }
.search-form input { background: transparent; border: none; outline: none; padding: 7px 14px; color: #fff; font-size: 0.88rem; width: 180px; }
.search-form input::placeholder { color: rgba(255,255,255,.5); }
.search-form button { background: var(--primary); border: none; padding: 7px 14px; color: #fff; cursor: pointer; font-size: 0.9rem; }

/* ---- TICKER ---- */
.ticker-wrap { background: var(--primary); color: #fff; font-size: 0.85rem; padding: 7px 0; overflow: hidden; }
.ticker-wrap .container { display: flex; align-items: center; gap: 16px; }
.ticker-label { background: #fff; color: var(--primary); font-weight: 700; padding: 2px 10px; border-radius: 4px; white-space: nowrap; font-size: 0.78rem; }
.ticker-content { overflow: hidden; white-space: nowrap; }
.ticker-content a { color: #fff; margin-right: 4px; }
.ticker-content a:hover { text-decoration: underline; }
.ticker-content .sep { opacity: .5; }

/* ---- MAIN ---- */
.main-content { padding: 28px 20px 40px; }

.page-heading { margin-bottom: 24px; }
.page-heading h1 { font-size: 1.6rem; }
.page-heading p { color: var(--text-muted); }

/* ---- FEATURED ---- */
.featured-section { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 36px; }
.featured-card { display: block; position: relative; border-radius: var(--radius); overflow: hidden; }
.featured-card img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.featured-card:hover img { transform: scale(1.03); }
.featured-large { height: 420px; }
.featured-side { display: flex; flex-direction: column; gap: 16px; }
.featured-small { height: 200px; }
.featured-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.85) 0%, transparent 55%); padding: 20px; display: flex; flex-direction: column; justify-content: flex-end; }
.featured-overlay h2, .featured-overlay h3 { color: #fff; font-size: 1.15rem; line-height: 1.35; margin-top: 6px; }
.featured-small .featured-overlay h3 { font-size: 0.92rem; }
.featured-overlay .excerpt { color: rgba(255,255,255,.8); font-size: 0.88rem; margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.badge, .featured-overlay .badge { background: var(--primary); color: #fff; font-size: 0.75rem; padding: 3px 9px; border-radius: 20px; width: fit-content; font-weight: 600; }
.meta { color: rgba(255,255,255,.7); font-size: 0.8rem; margin-top: 8px; }

/* ---- CONTENT GRID ---- */
.content-grid { display: grid; grid-template-columns: 1fr 300px; gap: 32px; }
.articles-col { min-width: 0; }

/* ---- ARTICLE CARDS ---- */
.articles-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.article-card { display: flex; flex-direction: column; background: var(--bg-card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .25s, box-shadow .25s; }
.article-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,.13); }
.card-img-wrap { position: relative; aspect-ratio: 16/9; overflow: hidden; }
.card-img-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.article-card:hover .card-img-wrap img { transform: scale(1.05); }
.card-badge { position: absolute; top: 10px; left: 10px; background: var(--primary); color: #fff; font-size: 0.72rem; padding: 3px 8px; border-radius: 4px; font-weight: 600; }
.card-body { padding: 14px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.card-body h3 { font-size: 0.92rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-excerpt { font-size: 0.82rem; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { font-size: 0.78rem; color: var(--text-muted); display: flex; justify-content: space-between; margin-top: auto; }

/* ---- PAGINATION ---- */
.pagination { display: flex; gap: 8px; margin-top: 32px; justify-content: center; }
.pagination a { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; background: var(--bg-card); border: 1px solid var(--border); font-size: 0.9rem; transition: all .2s; }
.pagination a:hover, .pagination a.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---- SIDEBAR ---- */
.sidebar { display: flex; flex-direction: column; gap: 20px; }
.sidebar-widget { background: var(--bg-card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.sidebar-widget h4 { font-size: 0.95rem; font-weight: 700; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 2px solid var(--primary); }
.cat-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.cat-list a { display: flex; justify-content: space-between; padding: 7px 10px; border-radius: 6px; font-size: 0.88rem; transition: background .2s; }
.cat-list a:hover { background: var(--bg); }
.cat-list span { color: var(--text-muted); font-size: 0.82rem; }
.popular-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--border); }
.popular-item:last-child { border-bottom: none; }
.popular-item img { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.popular-item span { font-size: 0.83rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---- ARTICLE PAGE ---- */
.article-layout { display: grid; grid-template-columns: 1fr 300px; gap: 32px; }
.article-main { min-width: 0; }
.breadcrumb { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 14px; }
.breadcrumb a { color: var(--primary); }
.article-badge { display: inline-block; background: var(--primary); color: #fff; font-size: 0.78rem; padding: 3px 10px; border-radius: 4px; font-weight: 600; margin-bottom: 12px; }
.article-title { font-size: 1.9rem; line-height: 1.3; margin-bottom: 14px; }
.article-meta { display: flex; gap: 10px; font-size: 0.83rem; color: var(--text-muted); margin-bottom: 20px; flex-wrap: wrap; }
.article-hero { margin-bottom: 24px; border-radius: var(--radius); overflow: hidden; }
.article-hero-img { width: 100%; max-height: 480px; object-fit: cover; }
.img-caption { font-size: 0.78rem; color: var(--text-muted); text-align: center; padding: 8px 0; font-style: italic; }
.article-body { font-size: 1rem; line-height: 1.8; }
.article-body p { margin-bottom: 1.2em; }
.source-box { background: var(--bg); border-left: 4px solid var(--primary); padding: 12px 16px; border-radius: 0 8px 8px 0; font-size: 0.88rem; margin: 28px 0; }
.source-box a { color: var(--primary); }
.share-buttons { display: flex; align-items: center; gap: 10px; margin-top: 28px; font-size: 0.88rem; }
.share-buttons span { font-weight: 600; }
.share-wa  { background: #25d366; color: #fff; padding: 7px 14px; border-radius: 6px; }
.share-tw  { background: #1da1f2; color: #fff; padding: 7px 14px; border-radius: 6px; }
.share-fb  { background: #1877f2; color: #fff; padding: 7px 14px; border-radius: 6px; }

/* ---- EMPTY STATE ---- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }

/* ---- FOOTER ---- */
.site-footer { background: #1a1a2e; color: rgba(255,255,255,.6); text-align: center; padding: 24px 0; font-size: 0.88rem; margin-top: 48px; }

/* ---- ADMIN ---- */
.admin-wrap { display: flex; min-height: 100vh; }
.admin-sidebar { width: 240px; background: #1a1a2e; color: #fff; padding: 24px 0; flex-shrink: 0; }
.admin-sidebar .brand { padding: 0 20px 20px; font-size: 1.1rem; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 12px; }
.admin-sidebar a { display: block; padding: 10px 20px; color: rgba(255,255,255,.75); font-size: 0.9rem; transition: all .2s; }
.admin-sidebar a:hover, .admin-sidebar a.active { background: rgba(255,255,255,.1); color: #fff; border-left: 3px solid var(--primary); }
.admin-main { flex: 1; padding: 28px; background: var(--bg); overflow-y: auto; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.admin-topbar h1 { font-size: 1.4rem; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; border: none; cursor: pointer; font-size: 0.9rem; font-weight: 500; transition: all .2s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: #2d9d5f; color: #fff; }
.btn-danger  { background: #dc3545; color: #fff; font-size: 0.82rem; padding: 5px 11px; }
.btn-sm { padding: 5px 11px; font-size: 0.82rem; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--bg-card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); text-align: center; }
.stat-card .num { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-card .lbl { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }
.data-table { width: 100%; border-collapse: collapse; background: var(--bg-card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.data-table th { background: #1a1a2e; color: #fff; padding: 12px 16px; font-size: 0.88rem; text-align: left; }
.data-table td { padding: 11px 16px; border-bottom: 1px solid var(--border); font-size: 0.88rem; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8f9fa; }
.status-pill { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.status-published { background: #d1fae5; color: #065f46; }
.status-draft      { background: #fef3c7; color: #92400e; }
.status-rejected   { background: #fee2e2; color: #991b1b; }
.thumb-sm { width: 64px; height: 40px; object-fit: cover; border-radius: 5px; }
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; font-size: 0.9rem; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 0.88rem; font-weight: 600; margin-bottom: 6px; }
.form-control { width: 100%; padding: 9px 13px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.9rem; outline: none; transition: border-color .2s; }
.form-control:focus { border-color: var(--primary); }
.card-box { background: var(--bg-card); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .featured-section { grid-template-columns: 1fr; }
  .featured-large { height: 280px; }
  .featured-side { display: none; }
  .content-grid, .article-layout { grid-template-columns: 1fr; }
  .articles-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .main-nav { display: none; }
}
@media (max-width: 560px) {
  .articles-grid { grid-template-columns: 1fr; }
  .article-title { font-size: 1.4rem; }
}
