/* =============================================================
   GoodNewsForThe.UK — Main Stylesheet
   Bright, cheerful, and unmistakably British
   ============================================================= */

/* -- Custom properties --------------------------------------- */
:root {
    --primary:     #FF6B35;   /* Warm orange — the sun coming out */
    --primary-dk:  #e05520;
    --secondary:   #2ECC71;   /* Cheerful green */
    --blue:        #3498DB;   /* Sky blue */
    --purple:      #9B59B6;
    --gold:        #F39C12;
    --teal:        #1ABC9C;
    --red:         #E74C3C;
    --slate:       #95A5A6;
    --dark:        #2C3E50;
    --mid:         #5D6D7E;
    --light:       #ECF0F1;
    --bg:          #FFF8F3;   /* Warm off-white */
    --card-bg:     #FFFFFF;
    --border:      #F0E8E0;
    --text:        #2C3E50;
    --text-light:  #7F8C8D;
    --radius:      12px;
    --radius-sm:   6px;
    --shadow:      0 2px 12px rgba(255,107,53,0.08);
    --shadow-hover:0 6px 24px rgba(255,107,53,0.16);
    --font:        'Nunito', 'Segoe UI', system-ui, sans-serif;
    --font-serif:  'Merriweather', Georgia, serif;
    --max-w:       1200px;
}

/* -- Reset & base -------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a   { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary-dk); }

/* -- Typography --------------------------------------------- */
h1, h2, h3, h4 {
    font-family: var(--font);
    font-weight: 800;
    line-height: 1.2;
    color: var(--dark);
}
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.4rem); }

p { margin-bottom: 1rem; }

/* -- Layout helpers ----------------------------------------- */
.container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 1.25rem;
}
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }

/* -- Header -------------------------------------------------- */
.site-header {
    background: var(--card-bg);
    border-bottom: 3px solid var(--primary);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.site-logo {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: 1.3rem;
    font-weight: 900;
    color: var(--dark);
}
.site-logo span.logo-accent { color: var(--primary); }
.site-logo .logo-icon {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: .25rem;
    flex-wrap: wrap;
}
.site-nav a {
    color: var(--mid);
    font-weight: 700;
    font-size: .9rem;
    padding: .35rem .75rem;
    border-radius: 20px;
    transition: all .2s;
}
.site-nav a:hover, .site-nav a.active {
    background: var(--primary);
    color: #fff;
}

.search-form {
    display: flex;
    gap: .4rem;
}
.search-form input {
    padding: .4rem .9rem;
    border: 2px solid var(--border);
    border-radius: 20px;
    font-family: var(--font);
    font-size: .9rem;
    width: 200px;
    transition: border-color .2s;
    background: var(--bg);
}
.search-form input:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
}
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem 1rem;
    border-radius: 20px;
    font-family: var(--font);
    font-weight: 700;
    font-size: .9rem;
    border: none;
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dk); color: #fff; transform: translateY(-1px); }
.btn-sm { padding: .3rem .75rem; font-size: .82rem; }

/* -- Hero banner -------------------------------------------- */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, #FF8C42 100%);
    color: #fff;
    padding: 3.5rem 0 2.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '☀️';
    position: absolute;
    font-size: 12rem;
    opacity: .08;
    top: -2rem;
    right: -2rem;
    pointer-events: none;
}
.hero h1 { color: #fff; margin-bottom: .5rem; }
.hero p   { color: rgba(255,255,255,.9); font-size: 1.1rem; max-width: 540px; margin: 0 auto 1.5rem; }
.hero-stats {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    margin-top: 1.5rem;
}
.hero-stat strong { display: block; font-size: 1.8rem; font-weight: 900; }
.hero-stat span   { font-size: .85rem; opacity: .85; }

/* -- Category pills ----------------------------------------- */
.category-bar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: .75rem 0;
    overflow-x: auto;
}
.category-bar-inner {
    display: flex;
    gap: .5rem;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    flex-wrap: wrap;
}
.category-pill {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .35rem .9rem;
    border-radius: 20px;
    font-size: .85rem;
    font-weight: 700;
    color: #fff;
    transition: all .2s;
    white-space: nowrap;
}
.category-pill:hover { transform: translateY(-2px); filter: brightness(1.1); color: #fff; }

/* -- Story cards -------------------------------------------- */
.stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    padding: 2rem 0;
}

/* First card spans full width (featured) */
.stories-grid .card:first-child {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
}
.stories-grid .card:first-child .card-image {
    height: 100%;
    min-height: 260px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all .25s;
    display: flex;
    flex-direction: column;
}
.card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-3px);
}
.card a.card-link {
    display: flex;
    flex-direction: column;
    flex: 1;
    color: inherit;
}
.stories-grid .card:first-child a.card-link {
    display: contents;
}
.card-image {
    position: relative;
    height: 200px;
    overflow: hidden;
    background: var(--light);
}
.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s;
}
.card:hover .card-image img { transform: scale(1.04); }
.card-cat {
    position: absolute;
    top: .7rem;
    left: .7rem;
    padding: .2rem .65rem;
    border-radius: 12px;
    font-size: .75rem;
    font-weight: 800;
    color: #fff;
    background: var(--primary);
}
.card-body {
    padding: 1.1rem 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.card-title {
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: .5rem;
    color: var(--dark);
}
.card-summary {
    font-size: .9rem;
    color: var(--mid);
    line-height: 1.5;
    flex: 1;
    margin-bottom: .75rem;
}
.card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: .78rem;
    color: var(--text-light);
    margin-top: auto;
}
.card-source {
    font-weight: 700;
    color: var(--text-light);
}
.read-more {
    font-size: .82rem;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: .2rem;
}
.read-more::after { content: ' →'; }

/* -- Article page ------------------------------------------- */
.article-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 2.5rem;
    padding: 2.5rem 0;
    align-items: start;
}
.article-hero-image {
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1.5rem;
    max-height: 460px;
}
.article-hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.article-header { margin-bottom: 1.5rem; }
.article-title {
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 900;
    line-height: 1.2;
    margin-bottom: .75rem;
    color: var(--dark);
}
.article-summary {
    font-size: 1.15rem;
    color: var(--mid);
    line-height: 1.7;
    border-left: 4px solid var(--primary);
    padding-left: 1rem;
    margin-bottom: 1.5rem;
}
.article-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    padding: 1.25rem;
    background: linear-gradient(135deg, #FFF3EC, #FFF9F5);
    border-radius: var(--radius);
    border: 2px solid var(--border);
}
.article-source-label {
    font-size: .9rem;
    color: var(--mid);
}
.article-source-label strong { color: var(--dark); }
.btn-read-full {
    background: var(--primary);
    color: #fff;
    padding: .6rem 1.4rem;
    border-radius: 24px;
    font-weight: 800;
    font-size: .95rem;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    transition: all .2s;
}
.btn-read-full:hover { background: var(--primary-dk); color: #fff; transform: translateY(-2px); }
.btn-read-full::after { content: ' ↗'; }

/* Sidebar */
.sidebar-widget {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}
.sidebar-widget h3 {
    font-size: 1rem;
    font-weight: 800;
    margin-bottom: 1rem;
    padding-bottom: .5rem;
    border-bottom: 2px solid var(--border);
}
.sidebar-story {
    display: flex;
    gap: .75rem;
    padding: .6rem 0;
    border-bottom: 1px solid var(--border);
}
.sidebar-story:last-child { border-bottom: none; }
.sidebar-story-img {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--light);
}
.sidebar-story-img img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-story-title {
    font-size: .85rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--dark);
}
.sidebar-story-time { font-size: .75rem; color: var(--text-light); margin-top: .2rem; }

/* -- Search results ----------------------------------------- */
.search-header { padding: 2rem 0 1rem; }
.search-header h1 { font-size: 1.6rem; }
.search-header h1 span { color: var(--primary); }
.no-results {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--mid);
}
.no-results .emoji { font-size: 4rem; display: block; margin-bottom: 1rem; }

/* -- Pagination --------------------------------------------- */
.pagination {
    display: flex;
    justify-content: center;
    gap: .4rem;
    padding: 2rem 0;
    flex-wrap: wrap;
}
.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 .75rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: .9rem;
    transition: all .2s;
}
.pagination a { color: var(--mid); border: 2px solid var(--border); background: var(--card-bg); }
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination span.current { background: var(--primary); color: #fff; border: 2px solid var(--primary); }

/* -- Footer ------------------------------------------------- */
.site-footer {
    background: var(--dark);
    color: rgba(255,255,255,.7);
    padding: 2.5rem 0 1.5rem;
    margin-top: 3rem;
}
.footer-inner {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}
.footer-brand .site-logo { color: #fff; margin-bottom: .75rem; }
.footer-brand p { font-size: .9rem; line-height: 1.6; }
.footer-col h4 {
    color: #fff;
    font-size: .9rem;
    font-weight: 800;
    margin-bottom: .75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.footer-col a {
    display: block;
    color: rgba(255,255,255,.6);
    font-size: .88rem;
    padding: .2rem 0;
    transition: color .2s;
}
.footer-col a:hover { color: var(--primary); }
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,.1);
    padding-top: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .82rem;
    flex-wrap: wrap;
    gap: .5rem;
}

/* -- Utility ------------------------------------------------ */
.badge {
    display: inline-block;
    padding: .15rem .55rem;
    border-radius: 10px;
    font-size: .75rem;
    font-weight: 800;
    background: var(--light);
    color: var(--mid);
}
.text-primary { color: var(--primary); }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* Section heading */
.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.section-heading h2 { font-size: 1.4rem; }
.section-heading a  { font-size: .88rem; font-weight: 700; color: var(--primary); }

/* -- Admin -------------------------------------------------- */
.admin-wrap {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
    background: #F4F6F8;
}
.admin-sidebar {
    background: var(--dark);
    padding: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.admin-sidebar .brand {
    padding: 1.25rem 1.5rem;
    font-weight: 900;
    font-size: 1rem;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.1);
    display: flex;
    align-items: center;
    gap: .5rem;
}
.admin-sidebar .brand span { color: var(--primary); }
.admin-nav a {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .7rem 1.5rem;
    color: rgba(255,255,255,.65);
    font-weight: 700;
    font-size: .9rem;
    transition: all .2s;
    border-left: 3px solid transparent;
}
.admin-nav a:hover, .admin-nav a.active {
    color: #fff;
    background: rgba(255,107,53,.12);
    border-left-color: var(--primary);
}
.admin-nav .nav-section {
    padding: .75rem 1.5rem .25rem;
    font-size: .72rem;
    font-weight: 800;
    color: rgba(255,255,255,.3);
    text-transform: uppercase;
    letter-spacing: .1em;
}
.admin-main { padding: 2rem; overflow-y: auto; }
.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
}
.admin-topbar h1 { font-size: 1.5rem; }
.admin-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    margin-bottom: 1.5rem;
}
.admin-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    border-top: 4px solid var(--primary);
}
.stat-card.green  { border-top-color: var(--secondary); }
.stat-card.blue   { border-top-color: var(--blue); }
.stat-card.orange { border-top-color: var(--gold); }
.stat-card .stat-val { font-size: 2rem; font-weight: 900; color: var(--dark); }
.stat-card .stat-lbl { font-size: .82rem; color: var(--mid); font-weight: 700; }

/* Admin table */
.admin-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.admin-table th {
    background: #F4F6F8;
    padding: .65rem 1rem;
    text-align: left;
    font-size: .8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--mid);
    border-bottom: 2px solid var(--border);
}
.admin-table td {
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #FAFBFC; }

/* Status badges */
.status-published { background: #D5F5E3; color: #1E8449; padding: .2rem .6rem; border-radius: 10px; font-size: .78rem; font-weight: 800; }
.status-pending   { background: #FEF9E7; color: #B7950B; padding: .2rem .6rem; border-radius: 10px; font-size: .78rem; font-weight: 800; }
.status-rejected  { background: #FDEDEC; color: #B03A2E; padding: .2rem .6rem; border-radius: 10px; font-size: .78rem; font-weight: 800; }

/* Form styles */
.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-weight: 700; font-size: .88rem; margin-bottom: .35rem; color: var(--dark); }
.form-control {
    width: 100%;
    padding: .55rem .9rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: .9rem;
    transition: border-color .2s;
    background: #FAFBFC;
}
.form-control:focus { outline: none; border-color: var(--primary); background: #fff; }
textarea.form-control { min-height: 100px; resize: vertical; }
.form-hint { font-size: .8rem; color: var(--text-light); margin-top: .25rem; }
.form-actions { display: flex; gap: .75rem; align-items: center; margin-top: 1.5rem; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #c0392b; color: #fff; }
.btn-secondary { background: var(--light); color: var(--dark); }
.btn-secondary:hover { background: #DFE3E6; color: var(--dark); }
.btn-success { background: var(--secondary); color: #fff; }
.btn-success:hover { background: #27ae60; color: #fff; }

/* Alert boxes */
.alert { padding: .85rem 1.1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-weight: 600; font-size: .9rem; }
.alert-success { background: #D5F5E3; color: #1E8449; }
.alert-error   { background: #FDEDEC; color: #B03A2E; }
.alert-warning { background: #FEF9E7; color: #B7950B; }

/* Login page */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 5vh 1rem 2rem;
    background: linear-gradient(135deg, var(--dark) 0%, #3D5168 100%);
    overflow-y: auto;
}
.login-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-card h1 { font-size: 1.4rem; margin-bottom: .25rem; }
.login-card p  { color: var(--mid); font-size: .9rem; margin-bottom: 1.5rem; }

/* -- Responsive --------------------------------------------- */
@media (max-width: 900px) {
    .stories-grid .card:first-child {
        grid-column: auto;
        display: flex;
        flex-direction: column;
    }
    .stories-grid .card:first-child .card-image { height: 220px; }
    .article-layout { grid-template-columns: 1fr; }
    .footer-inner { grid-template-columns: 1fr 1fr; }
    .admin-stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 680px) {
    .header-inner { flex-wrap: wrap; gap: .75rem; }
    .search-form input { width: 150px; }
    .site-nav { display: none; } /* TODO: hamburger menu */
    .stories-grid { grid-template-columns: 1fr; }
    .hero-stats { gap: 1.5rem; }
    .footer-inner { grid-template-columns: 1fr; }
    .admin-wrap { grid-template-columns: 1fr; }
    .admin-sidebar { position: static; height: auto; }
    .admin-stat-grid { grid-template-columns: repeat(2, 1fr); }
}
