/* ==========================================================================
   Space Weather Dashboard Master - Visual Layer Override (Fixed)
   ========================================================================== */

:root {
    --bg-space-core: #060913;
    --bg-card-glass: rgba(13, 20, 38, 0.65);
    --border-glow: rgba(76, 198, 255, 0.12);
    --text-primary: #f3f4f6;
    --text-muted: #a0aec0;
    --accent-cyan: #4cc6ff;
    --accent-solar: #f97316;
    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Global Foundations */
body {
    font-family: var(--font-sans);
    background-color: var(--bg-space-core);
    
    /* Kept the clean ambient space lighting gradients across the core body */
    background-image: 
        radial-gradient(circle at 50% 0%, rgba(76, 198, 255, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 100% 60%, rgba(249, 115, 22, 0.04) 0%, transparent 40%);
    background-attachment: fixed;
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Base Formats Override */
p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
    text-align: left !important;
}

/* Structural Grid & Layout Wrappers */
.container_12, #container {
    max-width: 1300px !important;
    width: 95% !important;
    margin: 0 auto !important;
    padding: 2rem 0;
}

/* Dynamic Core Splitter */
#content {
    display: grid !important;
    grid-template-columns: 280px 1fr !important;
    gap: 2rem !important;
    align-items: start;
    margin-top: 1.5rem;
}

/* ==========================================================================
   Page Header & Logo Layout Override (Banner Image Anchored to Header Only)
   ========================================================================== */

#pageheader {
    position: relative !important;  /* Establishes a positioning anchor for the logo */
    min-height: 130px !important;   /* Provides extra clearance for text and banner visuals */
    padding: 3rem 2rem !important;  /* Horizontal padding creates safe breathing room away from outer edges */
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    display: block !important;      /* Safeguards against floating glitches */
    
    /* 1. Anchored the clean scientific banner directly inside the header block */
    background-image: url('/assets/img/bg_body.jpg') !important;
    
    /* 2. Prevents repeating artifacts inside the bounding box */
    background-repeat: no-repeat !important;
    
    /* 3. Keeps the visual aligned flat against the center-top boundary */
    background-position: top center !important;
    
    /* 4. Ensures the banner scales gracefully, covering the container area tightly */
    background-size: cover !important;
}

#pageheader h1 {
    font-family: Georgia, serif !important;
    font-size: 2.5rem !important;   /* Slightly increased for high-contrast legibility over the banner */
    font-weight: normal !important;
    color: #fff !important;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8) !important; /* Adds a shadow shroud to ensure textual crispness over flares */
    margin: 0 !important;
    float: left !important;
    line-height: 1.2 !important;
}

#pageheader h1 a {
    color: #fff !important;
    text-decoration: none !important;
}

#pageheader h1 span {
    display: inline !important;       /* Keeps it on the same line */
    font-size: 2.5rem !important;    
    color: #ffffff;         
    margin-left: 10px !important;     /* Horizontal space */
    font-family: inherit !important;  /* Inherits Georgia from the parent h1 */
    text-transform: none !important;  /* Removes ALL CAPS formatting */
    letter-spacing: normal !important;
}

/* Force the logo wrapper firmly into the top-right corner */
#pageheader .topnav {
    position: absolute !important;
    top: 50% !important;
    right: 2rem !important; /* Matches padding offsets cleanly */
    transform: translateY(-50%) !important; /* Centers logo vertically against the text */
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    height: auto !important;
}

/* Strip layout constraints from legacy framework list containers */
#pageheader .topnav ul {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 20px !important;
    list-style: none !important;
    list-style-type: none !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
}

#pageheader .topnav ul li {
    display: block !important;
    list-style-type: none !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    width: auto !important;
    height: auto !important;
}

/* Force standard display properties for all link logos in topnav */
#pageheader .topnav ul li a {
    display: block !important;
    text-indent: -9999px !important; /* Safely hides text fallback */
    overflow: hidden !important;
    opacity: 0.9;
    transition: opacity 0.2s ease !important;
}

#pageheader .topnav ul li a:hover {
    opacity: 1 !important;
}

/* University of Bradford Logo-Specific Dimensions & Source Asset */
#pageheader .topnav ul li .uob,
#pageheader .topnav .uob {
    width: 222px !important;
    height: 56px !important;
    /* Using the full production domain path ensures it loads both locally and live */
    background-image: url('https://spaceweather.bradford.ac.uk/assets/img/logo_uob.gif') !important;
    background-repeat: no-repeat !important;
    background-size: contain !important;
    background-position: center right !important;
}

/* Left Sidebar Navigation Container */
#content .mainmenu {
    border-top: none !important;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Main Navigation Menu Rules */
#content .mainmenu h2 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #fff;
    margin-bottom: 1rem;
    font-family: var(--font-sans);
    font-weight: 700;
    opacity: 0.8;
}

/* Clean Sidebar Bullet Reset (FIXED) */
.sf-menu, 
.mainmenu ul,
.sf-menu li, 
.mainmenu ul li {
    list-style: none !important;
    list-style-type: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.sf-menu, .mainmenu ul {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sf-menu a, .mainmenu ul li a {
    display: block !important;
    padding: 0.75rem 1rem !important;
    color: var(--text-muted) !important;
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    border-radius: 8px !important;
    font-size: 0.9rem !important;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    text-decoration: none !important;
}

.sf-menu a:hover, .mainmenu ul li a:hover,
.sf-menu li.selected a, .mainmenu ul li.selected a {
    background: rgba(76, 198, 255, 0.08) !important; /* Strips old legacy orange arrows */
    color: #fff !important;
    border-color: var(--accent-cyan) !important;
    padding-left: 1.25rem !important;
}

/* Latest News Module Integration */
#news {
    background: rgba(249, 115, 22, 0.03) !important;
    border: 1px solid rgba(249, 115, 22, 0.15) !important;
    border-radius: 12px;
    padding: 1.25rem !important;
    margin-top: 1.5rem;
}

#news h2 {
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    color: var(--accent-solar) !important;
    border-bottom: none !important;
    padding: 0 !important;
    margin-bottom: 1rem !important;
    letter-spacing: 1px;
}

#news .scroller {
    width: 100% !important;
}

#news .scroller ul {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

#news .scroller ul li {
    height: auto !important;
    padding: 0 !important;
    font-size: 0.85rem !important;
    line-height: 1.5;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    padding-bottom: 1rem !important;
}

#news .scroller ul li:last-child {
    border-bottom: none;
    padding-bottom: 0 !important;
}

#news .scroller ul li a {
    color: var(--accent-cyan);
    text-decoration: none;
    font-weight: 600;
}

/* Main Core Layout Panels Container */
#content .mainarticle {
    border-top: none !important;
    padding: 0 !important;
}

#content .mainarticle .article {
    padding: 0 !important;
}

/* Main Welcome Heading */
#content .mainarticle h2 {
    font-family: Georgia, serif;
    font-size: 2rem;
    color: #fff;
    margin-bottom: 1rem;
    font-weight: normal;
}

/* Scientific Components Dashboard View */
.tblsplit, .article table {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)) !important;
    gap: 1.5rem !important;
    width: 100% !important;
    margin-top: 2rem;
}

.tblsplit tbody, .tblsplit tr,
.article table tbody, .article table tr {
    display: contents !important;
}

/* Individual Interactive Data Cards */
.tblsplit tr td, .article table tr td {
    background: var(--bg-card-glass) !important;
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-glow) !important;
    border-radius: 14px !important;
    padding: 1.5rem !important;
    width: auto !important;
    height: auto !important;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

/* Hides legacy empty table placeholder cards dynamically (FIXED) */
.tblsplit tr td:not(:has(h2)):not(:has(img)),
.article table tr td:not(:has(h2)):not(:has(img)) {
    display: none !important;
}

.tblsplit tr td:hover, .article table tr td:hover {
    border-color: rgba(76, 198, 255, 0.3) !important;
    transform: translateY(-2px);
}

/* Card Titles */
.tblsplit tr td h2, .article table tr td h2 {
    font-family: var(--font-sans) !important;
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    color: #fff !important;
    margin-bottom: 1rem !important;
    text-align: left;
    line-height: 1.4;
}

/* Responsive Image Formats inside Data Modules */
.tblsplit tr td img, .article table tr td img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    border-radius: 8px;
    margin-top: auto;
    border: 1px solid rgba(0, 0, 0, 0.5);
    background: #000;
}

/* Footer Element Configuration */
#pagefooter {
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    padding: 2.5rem 0 !important;
    margin-top: 5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

#pagefooter a {
    color: var(--text-muted);
    text-decoration: none;
    margin: 0 0.5rem;
}

#pagefooter a:hover {
    color: #fff;
}

/* Breakpoint Adaptation for Smaller Displays */
@media (max-width: 960px) {
    #content {
        grid-template-columns: 1fr !important;
    }
    .tblsplit, .article table {
        grid-template-columns: 1fr !important;
    }
}

/* ==========================================================================
   PHP Team Page Layout Grid Extension (Targeted 3-Column Fix)
   ========================================================================== */

section.clearfix {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 1.75rem !important;
    margin: 2rem 0 4rem 0 !important;
    clear: both !important;
}

/* Ensures layout titles span completely across the 3-column rows */
section.clearfix h2 {
    grid-column: 1 / -1 !important;
    font-family: Georgia, serif !important;
    font-size: 1.75rem !important;
    color: #fff !important;
    margin: 1.5rem 0 0.5rem 0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    padding-bottom: 0.75rem !important;
}

/* Individual Team Member Cards */
.col190 {
    float: none !important;        /* Suppress legacy markup positioning floats */
    width: auto !important;        /* Relies on Grid system parameters */
    margin: 0 !important;          /* Strips original fixed horizontal margin sets */
    background: var(--bg-card-glass) !important;
    backdrop-filter: blur(12px) !important;
    border: 1px solid var(--border-glow) !important;
    border-radius: 14px !important;
    padding: 1.5rem !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    text-align: center !important;
    transition: transform 0.2s ease, border-color 0.2s ease !important;
}

.col190:hover {
    border-color: rgba(76, 198, 255, 0.4) !important;
    transform: translateY(-4px) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3) !important;
}

/* Image wrappers on PHP output links */
.col190 a {
    display: block !important;
    margin-bottom: 1.25rem !important;
    border-radius: 8px !important;
    overflow: hidden !important;
}

.col190 img {
    display: block !important;
    width: 120px !important;
    height: auto !important;
    max-width: 100% !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 8px !important;
    transition: transform 0.2s ease !important;
}

.col190:hover img {
    transform: scale(1.03);
}

/* Formats internal names inside paragraph objects */
.col190 p {
    color: #fff !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    margin: 0 !important;
    text-align: center !important; /* Centered layout override */
}

/* Responsive breakdowns for compact device layouts */
@media (max-width: 900px) {
    section.clearfix {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 520px) {
    section.clearfix {
        grid-template-columns: 1fr !important;
    }
}