:root {
    --primary: #c41e3a;
    --primary-dark: #9a1830;
    --secondary: #1a1a2e;
    --bg: #f5f5f5;
    --text: #212529;
    --card-bg: #ffffff;
    --navbar-bg: #212529;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main, .main-content {
    flex: 1;
}

/* Breaking news bar */
.breaking-bar {
    background: var(--primary);
    color: #fff;
    font-size: 0.9rem;
    padding: 0.4rem 0;
    overflow: hidden;
}
.breaking-label {
    background: #000;
    color: #fff;
    font-weight: 700;
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    margin-right: 1rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.breaking-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-tagline {
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.7;
    letter-spacing: 0;
}

.navbar-brand {
    letter-spacing: 0.5px;
}

.btn-primary, .bg-primary {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
}

.btn-primary:hover {
    background-color: var(--primary-dark) !important;
    border-color: var(--primary-dark) !important;
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.text-primary {
    color: var(--primary) !important;
}

/* Featured / Hero */
.featured-card {
    position: relative;
    overflow: hidden;
    border-radius: 0.5rem;
    height: 320px;
}

.featured-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.featured-card:hover img {
    transform: scale(1.05);
}

.featured-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
    padding: 1.5rem;
    color: #fff;
}

.featured-overlay .badge {
    font-size: 0.7rem;
}

/* Large hero for "hero" layout */
.hero-main {
    position: relative;
    overflow: hidden;
    border-radius: 0.5rem;
    height: 420px;
}
.hero-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.hero-side {
    height: 200px;
}

/* Article cards */
.article-card {
    transition: transform 0.2s, box-shadow 0.2s;
    height: 100%;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    background: var(--card-bg);
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.article-card .card-img-top {
    height: 180px;
    object-fit: cover;
}

.article-card .card-title {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.3;
}

.article-meta {
    font-size: 0.8rem;
    color: #6c757d;
}

/* Magazine layout mixed sizes */
.layout-magazine .featured-card:first-child {
    height: 400px;
}
.layout-magazine .col-md-6 .featured-card {
    height: 240px;
}

/* Single article */
.article-header h1 {
    font-weight: 700;
    line-height: 1.25;
}

.article-content {
    font-size: 1.1rem;
    line-height: 1.8;
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 1.5rem 0;
}

.article-featured-image {
    max-height: 450px;
    width: 100%;
    object-fit: cover;
    border-radius: 0.5rem;
}

.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 0.5rem;
    margin: 1.5rem 0;
}

.video-container iframe,
.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Comments */
.comment-box {
    background: var(--card-bg);
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.comment-author {
    font-weight: 600;
}

/* Admin */
.admin-sidebar {
    min-height: calc(100vh - 56px);
    background: #212529;
}

.admin-sidebar .nav-link {
    color: rgba(255,255,255,0.75);
    border-radius: 0.375rem;
    margin-bottom: 0.25rem;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.stat-card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.stat-card .stat-icon {
    font-size: 2rem;
    opacity: 0.8;
}

/* Forms */
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(196, 30, 58, 0.25);
}

/* Thumbnail preview */
.preview-img {
    max-height: 150px;
    border-radius: 0.375rem;
    margin-top: 0.5rem;
}

/* Pagination */
.page-link {
    color: var(--primary);
}

.page-item.active .page-link {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* Colour swatches in admin */
.colour-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-block;
    border: 2px solid #ddd;
    vertical-align: middle;
}
.theme-card {
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}
.theme-card:hover, .theme-card.selected {
    border-color: var(--primary);
}
.theme-card.selected {
    box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.25);
}

/* Dark theme adjustments */
.theme-dark .article-card,
.theme-dark .card {
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.theme-dark .dropdown-menu {
    background-color: #1e1e1e;
    border-color: #333;
}
.theme-dark .dropdown-item {
    color: #e8e8e8;
}
.theme-dark .dropdown-item:hover {
    background-color: #333;
    color: #fff;
}

/* Responsive */
@media (max-width: 768px) {
    .featured-card, .hero-main {
        height: 240px;
    }
    .hero-side {
        height: 160px;
    }
    .breaking-text {
        font-size: 0.8rem;
    }
}

/* Layout structure extras */
.container-narrow { max-width: 860px; }
.card-style-border { box-shadow: none !important; border: 1px solid rgba(0,0,0,.12) !important; }
.card-style-flat { box-shadow: none !important; border: none !important; }
.card-style-shadow { /* default */ }
.object-fit-cover { object-fit: cover; }
.layout-list .list-group-item { background: var(--card-bg); color: var(--text); }

/* Site logo */
.site-logo {
    max-height: 48px;
    width: auto;
    object-fit: contain;
}
.site-logo-preview {
    max-height: 64px;
    width: auto;
    object-fit: contain;
}
.footer-logo {
    max-height: 40px;
    width: auto;
    object-fit: contain;
}
.page-content h2, .page-content h3 {
    margin-top: 1rem;
}
.page-content p {
    line-height: 1.7;
}
.footer-links a:hover {
    color: #fff !important;
}

/* Creative card styles */
.card-style-lift {
    transition: transform .2s ease, box-shadow .2s ease;
}
.card-style-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0,0,0,.12) !important;
}
.card-style-glass {
    background: rgba(255,255,255,.55) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,.35) !important;
    box-shadow: 0 8px 24px rgba(0,0,0,.06) !important;
}
.theme-dark .card-style-glass {
    background: rgba(30,30,30,.65) !important;
    border-color: rgba(255,255,255,.08) !important;
}

/* Mosaic layout */
.layout-mosaic .card-img-top {
    height: 180px;
    object-fit: cover;
}
.layout-mosaic .card-title {
    font-size: 1rem;
}

/* Header variants */
body.header-bold .navbar {
    padding-top: .9rem;
    padding-bottom: .9rem;
    box-shadow: 0 4px 18px rgba(0,0,0,.15);
}
body.header-boxed .navbar-brand {
    background: rgba(255,255,255,.12);
    padding: .35rem .75rem;
    border-radius: .5rem;
}
body.header-centered .navbar .container {
    flex-direction: column;
    gap: .5rem;
}
body.header-centered .navbar-brand {
    margin: 0 auto;
}
body.header-minimal .navbar {
    padding-top: .25rem;
    padding-bottom: .25rem;
}
body.header-minimal .site-tagline {
    display: none !important;
}

.site-logo {
    max-height: 52px;
    max-width: 220px;
    width: auto;
    height: auto;
    object-fit: contain;
}


/* Logo visibility fix */
.navbar-brand .site-logo {
    max-height: 48px !important;
    max-width: 200px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    display: inline-block !important;
    background: transparent !important;
    padding: 0 !important;
}
.footer-logo {
    max-height: 40px !important;
    background: #fff;
    padding: 2px 6px;
    border-radius: 4px;
}

/* Navbar + logo layout fix (prevent menu overlapping logo) */
.navbar .container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.navbar-brand {
    display: flex !important;
    align-items: center;
    max-width: min(240px, 55vw);
    margin-right: 1rem;
    flex: 0 0 auto;
    z-index: 2;
}
.navbar-brand .site-logo {
    display: block !important;
    max-height: 48px !important;
    max-width: 200px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    background: transparent;
    padding: 0;
    border-radius: 0;
}
.navbar-toggler {
    flex: 0 0 auto;
    z-index: 2;
}
.navbar-collapse {
    flex-basis: 100%;
    flex-grow: 1;
}
@media (min-width: 992px) {
    .navbar .container {
        flex-wrap: nowrap;
    }
    .navbar-collapse {
        flex-basis: auto;
        display: flex !important;
        flex-grow: 1;
        align-items: center;
        justify-content: space-between;
    }
    .navbar-nav {
        flex-wrap: wrap;
    }
}



/* Live nav badges */
.nav-msg-link, #navAlertsLink { overflow: visible !important; }
.navbar .nav-item { overflow: visible; }
.nav-live-badge {
  display: none;
  position: absolute;
  top: 2px;
  right: 0;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #22c55e;
  color: #fff !important;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px rgba(0,0,0,.2);
  z-index: 5;
}
.nav-live-badge-blue { background: #3b82f6; right: 14px; }
.nav-live-badge.is-on {
  display: inline-block;
  animation: msgPulse 1.3s ease-in-out infinite;
}
@keyframes msgPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}


/* ===== Site templates ===== */
.template-classic_news .article-card { border-radius: 0; }
.template-classic_news h1, .template-classic_news h2, .template-classic_news .navbar-brand { font-family: Georgia, "Times New Roman", serif; }
.template-classic_news .article-card .card-title { font-weight: 700; letter-spacing: -0.02em; }

.template-modern_digital .article-card { border-radius: 1rem; border: none; }
.template-modern_digital .navbar { border-radius: 0 0 1rem 1rem; }
.template-modern_digital .btn { border-radius: 2rem; }

.template-magazine .article-card .card-title { font-size: 1.35rem; font-weight: 800; line-height: 1.2; }
.template-magazine .layout-hero .featured-hero img { min-height: 320px; object-fit: cover; }

.template-broadcast .breaking-bar { letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700; }
.template-broadcast .article-card { border-left: 3px solid var(--primary); border-radius: 0; }
.template-broadcast .navbar { border-bottom: 3px solid var(--primary); }

.template-minimal body, body.template-minimal { letter-spacing: 0.01em; }
.template-minimal .article-card { box-shadow: none !important; border: 1px solid rgba(0,0,0,.08); }
.template-minimal .navbar { box-shadow: none !important; border-bottom: 1px solid rgba(0,0,0,.08); }

.template-tabloid .article-card .card-title { text-transform: uppercase; font-weight: 900; font-size: 1.1rem; }
.template-tabloid .breaking-bar { font-size: 0.95rem; }
.template-tabloid .article-card { border: 2px solid #111; }

/* Solid colour schemes must not inherit leftover gradients */
body.no-gradient .navbar,
body.no-gradient .breaking-bar,
body.no-gradient .btn-primary {
  background-image: none !important;
}
