/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

/* Design Tokens & Theme Variables */
:root {
    --bg-dark: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-nav: rgba(255, 255, 255, 0.85);
    --accent-blue: #2563eb;
    --accent-blue-glow: rgba(37, 99, 235, 0.15);
    --accent-copper: #d97706;
    --accent-copper-glow: rgba(217, 119, 6, 0.15);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-color: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(37, 99, 235, 0.3);
    --font-sans: 'Inter', sans-serif;
    --font-heading: 'Space Grotesk', sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.6;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* Glassmorphism Utilities */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.025);
}

/* Layout Containers */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.section {
    padding: 8rem 0;
    border-bottom: 1px solid var(--border-color);
}

/* Navigation Header */
.header {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: var(--bg-nav);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition-smooth);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 80px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Logo Placeholder */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-copper));
    border-radius: 6px;
    position: relative;
    box-shadow: 0 0 15px var(--accent-blue-glow);
}

.logo-icon::after {
    content: '';
    position: absolute;
    top: 6px;
    left: 6px;
    right: 6px;
    bottom: 6px;
    background: var(--bg-dark);
    border-radius: 4px;
}

.logo-text {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: 0.05em;
    background: linear-gradient(to right, #0f172a, #475569);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Nav Links Centered */
.nav-menu {
    display: flex;
    flex-wrap: nowrap; /* Prevent wrapping to a second line */
    list-style: none;
    gap: 1.25rem; /* Slightly tighter default gap */
    align-items: center;
    margin: 0 auto; /* Justified in the middle */
}

.nav-item a {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.85rem; /* Slightly smaller default font */
    font-weight: 500;
    transition: var(--transition-smooth);
    padding: 0.4rem 0.65rem; /* Slightly tighter default padding */
    border-radius: 6px;
    white-space: nowrap; /* Prevent link text itself from wrapping */
}

.nav-item a:hover,
.nav-item.active a {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.04);
}

/* Hero / Purpose Section */
/* Universal Section Themes */
.section.theme-hero {
    background: radial-gradient(circle at top, rgba(59, 130, 246, 0.08) 0%, transparent 75%);
    border-bottom: 1px solid var(--border-color);
}
.section.theme-standard {
    background: var(--bg-dark);
}
.section.theme-accent {
    background: #f8fafc;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 4rem;
    align-items: stretch; /* Stretches columns to equal height! */
    width: 100%;
    padding-left: max(2rem, calc((100vw - 1400px) / 2 + 2rem)); /* Aligns with the 1400px max-width container */
    padding-right: 3rem; /* Slight buffer from the right side */
    box-sizing: border-box;
}

.hero-left {
    text-align: left;
    display: flex;
    flex-direction: column;
    justify-content: center; /* Centers text vertically next to image */
}

.hero-tag {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--accent-copper);
    margin-bottom: 1.5rem;
    padding: 0.5rem 1rem;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 50px;
    display: inline-block;
    align-self: flex-start;
}

.hero-left h1 {
    font-size: 3.2rem;
    line-height: 1.15;
    margin-bottom: 1.5rem;
    background: linear-gradient(to right, #0f172a, #1e3a8a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-left p {
    font-size: 1.15rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
}

.hero-buttons {
    display: flex;
    justify-content: flex-start;
    gap: 1rem;
}

.hero-right {
    display: flex;
    align-items: stretch;
    height: 100%;
}

/* Right Side Carousel - matches the height of the left text */
.carousel-container {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 450px; /* Base height matching the text and buttons */
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border-color);
    background: #f1f5f9;
}

.carousel-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 1.2s ease-in-out;
}

.carousel-image.active {
    opacity: 1;
}

@media (max-width: 992px) {
    .hero-grid {
        grid-template-columns: 1fr;
        gap: 3rem;
        text-align: center;
        padding-left: 2rem;
        padding-right: 2rem;
        align-items: center;
    }
    .hero-left {
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    .hero-tag {
        align-self: center;
    }
    .hero-buttons {
        justify-content: center;
        width: 100%;
    }
    .hero-right {
        width: 100%;
        display: block;
    }
    .carousel-container {
        aspect-ratio: 16 / 10;
        height: auto;
        min-height: unset;
        max-width: 600px;
        margin: 0 auto;
    }
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.8rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    transition: var(--transition-smooth);
    cursor: pointer;
}

.btn-primary {
    background: var(--accent-blue);
    color: #ffffff;
    box-shadow: 0 4px 20px var(--accent-blue-glow);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(59, 130, 246, 0.6);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    margin-left: 1rem;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text-secondary);
    transform: translateY(-2px);
}

/* Page Section Headers */
.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-header h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.section-header p {
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Oklahoma Hub Grid */
.hub-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 3rem;
    align-items: start;
}

@media (max-width: 992px) {
    .hub-grid {
        grid-template-columns: 1fr;
    }
}

/* Map Containers */
.map-box {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    position: relative;
    overflow: hidden;
}

.map-placeholder {
    width: 100%;
    max-width: 550px;
    height: auto;
}

/* Styled Interactive SVG Map */
.map-svg {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.08));
}

.map-state {
    fill: #f1f5f9;
    stroke: #ffffff;
    stroke-width: 1.5;
    transition: var(--transition-smooth);
}

.map-state:hover {
    fill: #e2e8f0;
}

.map-state.active {
    fill: rgba(37, 99, 235, 0.06);
    stroke: var(--accent-blue);
    stroke-width: 2.5;
    filter: drop-shadow(0 0 8px var(--accent-blue-glow));
}

.map-node {
    fill: var(--accent-copper);
    stroke: #ffffff;
    stroke-width: 1.5;
    transition: var(--transition-smooth);
    cursor: pointer;
}

.map-node:hover {
    fill: #ffffff;
    r: 10;
    filter: drop-shadow(0 0 12px var(--accent-copper));
}

.map-tooltip {
    position: absolute;
    background: #0f172a;
    color: #ffffff;
    border: 1px solid var(--accent-blue);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.25);
    z-index: 10;
}

/* Scrolling Publication Ticker */
.ticker-box {
    display: flex;
    flex-direction: column;
    height: 450px;
}

.ticker-title {
    font-size: 1.1rem;
    font-weight: 600;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ticker-container {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.ticker-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: absolute;
    width: 100%;
    animation: ticker-scroll 25s linear infinite;
}

.ticker-wrapper:hover {
    animation-play-state: paused;
}

@keyframes ticker-scroll {
    0% { transform: translateY(0); }
    100% { transform: translateY(-50%); }
}

.publication-card {
    padding: 1.2rem;
    background: rgba(0, 0, 0, 0.01);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: var(--transition-smooth);
}

.publication-card:hover {
    background: rgba(0, 0, 0, 0.02);
    border-color: var(--border-hover);
    transform: translateX(4px);
}

.pub-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}

.pub-authors {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
}

.pub-meta {
    font-size: 0.75rem;
    color: var(--accent-copper);
    font-weight: 500;
}

/* Projects Section & Grid */
.projects-container {
    margin-top: 3rem;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.project-card {
    padding: 2rem;
    transition: var(--transition-smooth);
}

.project-card:hover {
    border-color: var(--accent-blue);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.15);
}

.project-tag {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-blue);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
    display: inline-block;
}

.project-card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
}

.project-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.project-link {
    color: var(--accent-copper);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: var(--transition-smooth);
}

.project-link:hover {
    color: var(--text-primary);
}

/* US Map Section */
.us-map-box {
    width: 100%;
    margin-top: 2rem;
}

/* Labs and Team Section */
.labs-team-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
}

@media (max-width: 992px) {
    .labs-team-grid {
        grid-template-columns: 1fr;
    }
}

.team-list, .labs-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.member-row, .lab-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    transition: var(--transition-smooth);
}

.member-row:hover, .lab-row:hover {
    background: rgba(0, 0, 0, 0.02);
    border-color: var(--border-hover);
}

.avatar-placeholder {
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--text-secondary);
}

.member-info h3, .lab-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
}

.member-info p, .lab-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Links around page / Footer Links Section */
.links-section {
    background: #f8fafc;
    border-top: 1px solid var(--border-color);
}

.links-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
}

@media (max-width: 768px) {
    .links-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.links-col h3 {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-copper);
    margin-bottom: 1.5rem;
}

.links-col ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.links-col a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition-smooth);
}

.links-col a:hover {
    color: var(--text-primary);
    padding-left: 4px;
}

/* Footer Copyright */
.footer {
    padding: 3rem 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
    background: var(--bg-dark);
}

.footer p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Inner Pages - General Styling */
.page-hero {
    padding: 10rem 0 4rem;
    background: radial-gradient(circle at center, rgba(59, 130, 246, 0.08) 0%, transparent 70%);
    border-bottom: 1px solid var(--border-color);
}

.page-hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.page-hero p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 800px;
}

.page-content {
    padding: 6rem 0;
    min-height: 50vh;
}

/* Placeholder Template Card inside Inner Pages */
.placeholder-card {
    padding: 3rem;
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
}

.placeholder-card i {
    font-size: 3.5rem;
    color: var(--accent-copper);
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 10px var(--accent-copper-glow));
}

.placeholder-card h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.placeholder-card p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* FontAwesome icon styling helper */
.fas, .far {
    display: inline-block;
}

/* Fictional/Placeholder Labels */
.fictional-badge {
    font-size: 0.65rem;
    font-weight: 700;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

.fictional-banner-top {
    background: linear-gradient(to right, #7f1d1d, #991b1b);
    color: #fca5a5;
    text-align: center;
    padding: 10px 20px;
    font-size: 0.85rem;
    font-weight: 500;
    border-bottom: 1px solid rgba(239, 68, 68, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    z-index: 1001;
    width: 100%;
}

/* Partner Control Panel Styles */
.sidebar-link {
    transition: all 0.2s ease-in-out;
}
.sidebar-link:hover {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
}
.sidebar-link.active:hover {
    background-color: #e0f2fe !important;
    color: #0284c7 !important;
}

/* ==========================================
   7. RESPONSIVE STYLING (CELLPHONE & TABLET ROBUSTNESS)
   ========================================== */

/* Mobile Nav Toggle Button (Hidden by default on desktop) */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: var(--transition-smooth);
}
.nav-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Dashboard & Tool Grid Layouts */
.dashboard-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2rem;
    align-items: start;
}

.tool-layout {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 2rem;
    align-items: start;
}

/* Media Queries */

/* /* Tablet & Mobile Navigation Breakpoint (1024px or when in mobile-mode) */
@media (max-width: 1024px) {
    .nav-toggle {
        display: block;
        order: 2;
    }

    .nav-menu {
        display: none; /* Hide standard menu */
        position: absolute;
        top: 80px;
        left: 0;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-bottom: 1px solid var(--border-color);
        padding: 1.5rem 2rem;
        gap: 0.75rem;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
        z-index: 999;
    }

    .nav-menu.open {
        display: flex; /* Show when toggled */
    }

    .nav-item a {
        display: block;
        padding: 0.75rem 1rem;
        width: 100%;
    }

    .nav-right {
        order: 1;
        margin-left: auto;
        margin-right: 1rem;
    }

    .tool-layout {
        grid-template-columns: 1fr;
    }
}

/* Dynamic Mobile Mode triggered by JS content-collision */
.header.mobile-mode .nav-toggle {
    display: block;
    order: 2;
}

.header.mobile-mode .nav-menu {
    display: none; /* Hide standard menu */
    position: absolute;
    top: 80px;
    left: 0;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 2rem;
    gap: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    z-index: 999;
}

.header.mobile-mode .nav-menu.open {
    display: flex; /* Show when toggled */
}

.header.mobile-mode .nav-item a {
    display: block;
    padding: 0.75rem 1rem;
    width: 100%;
}

.header.mobile-mode .nav-right {
    order: 1;
    margin-left: auto;
    margin-right: 1rem;
}

/* Tablet & Mobile Layout Spacing (768px) */
@media (max-width: 768px) {
    .container {
        padding: 0 1.25rem;
    }

    .section {
        padding: 4rem 0;
    }

    .page-hero {
        padding: 7rem 0 3rem;
    }

    .page-content {
        padding: 3rem 0;
    }

    /* Fluid Typography */
    .hero h1 {
        font-size: 2.25rem;
    }

    .hero p {
        font-size: 1.05rem;
    }

    .section-header h2 {
        font-size: 1.85rem;
    }

    .page-hero h1 {
        font-size: 2rem;
    }

    .page-hero p {
        font-size: 0.95rem;
    }

    /* Stack grids vertically */
    .dashboard-layout {
        grid-template-columns: 1fr;
    }

    /* Adjust button alignment on hero */
    .hero-buttons {
        flex-direction: column !important;
        width: 100%;
        gap: 0.75rem;
    }

    .hero .btn {
        margin-left: 0 !important;
        width: 100%;
        justify-content: center;
    }
}

/* Small Cellphone Spacing (480px) */
@media (max-width: 480px) {
    .placeholder-card {
        padding: 1.5rem;
    }

    .map-box {
        padding: 1rem;
        min-height: auto;
    }

    .ticker-box {
        padding: 1rem !important;
        height: 400px;
    }
    
    .nav-right {
        margin-right: 0.5rem;
    }
    
    .nav-right .btn {
        padding: 0.4rem 0.75rem !important;
        font-size: 0.8rem !important;
    }

    /* Small list rows fit better on cellphones */
    .member-row, .lab-row {
        gap: 1rem !important;
        padding: 1rem !important;
    }
    
    .avatar-placeholder {
        width: 48px !important;
        height: 48px !important;
        font-size: 1.2rem !important;
    }

    /* Compact tables to prevent overflow */
    table {
        font-size: 0.75rem !important;
    }
    
    th, td {
        padding: 0.5rem 0.25rem !important;
    }
}

/* Intermediate Desktop Scaling (Prevents wrapping when Control Panel is active) */
@media (min-width: 1025px) and (max-width: 1350px) {
    .nav-menu {
        gap: 0.5rem;
    }
    
    .nav-item a {
        font-size: 0.8rem;
        padding: 0.35rem 0.5rem;
    }
    
    .nav-right {
        gap: 0.5rem !important;
    }
    
    .nav-right .btn {
        padding: 0.4rem 0.7rem !important;
        font-size: 0.8rem !important;
    }
}

/* Leaflet Map Fixes for Browser Extensions & Dark Mode */
.leaflet-container img.leaflet-tile {
    mix-blend-mode: normal !important;
    filter: none !important;
    opacity: 1 !important;
}

/* ==========================================
   8. HOMEPAGE VISUAL EDITOR STYLES
   ========================================== */

/* Floating Edit Page Tab */
.edit-page-tab {
    position: fixed;
    right: 0;
    top: 35%;
    z-index: 1001;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: var(--accent-blue);
    color: #ffffff;
    border-radius: 8px 0 0 8px;
    cursor: pointer;
    box-shadow: -4px 0 25px rgba(37, 99, 235, 0.25);
    transition: var(--transition-smooth);
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    user-select: none;
}
.edit-page-tab:hover {
    padding-left: 24px;
    background: #1d4ed8;
}
.edit-page-tab i {
    font-size: 1rem;
    transition: transform 0.3s ease;
}
.edit-page-tab.active {
    background: var(--text-primary);
    box-shadow: -4px 0 25px rgba(0, 0, 0, 0.25);
}
.edit-page-tab.active i {
    transform: rotate(90deg);
}

/* Edit Mode Highlighting */
.edit-mode-active .editable-section {
    outline: 2px dashed var(--accent-blue) !important;
    outline-offset: -4px;
    cursor: pointer !important;
    position: relative;
    transition: background-color 0.3s ease;
    animation: blink-outline 3s infinite;
}
.edit-mode-active .editable-section:hover {
    background-color: rgba(37, 99, 235, 0.02) !important;
}
.edit-mode-active .editable-section::after {
    content: 'Click to Edit Section';
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-blue);
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 999;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.3);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.edit-mode-active .editable-section:hover::after {
    opacity: 1;
    transform: translate(-50%, -5px);
}

@keyframes blink-outline {
    0%, 100% { outline-color: var(--accent-blue); }
    50% { outline-color: rgba(37, 99, 235, 0.2); }
}

/* Slide-out Edit Drawer */
.edit-drawer {
    position: fixed;
    right: -480px;
    top: 0;
    width: 480px;
    height: 100%;
    background: #ffffff;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-color);
}
.edit-drawer.open {
    right: 0;
}
.drawer-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
}
.drawer-header h2 {
    font-size: 1.25rem;
    font-family: var(--font-heading);
    color: var(--text-primary);
    margin: 0;
}
.drawer-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}
.drawer-close:hover {
    color: #ef4444;
}
.drawer-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 2rem;
}
.drawer-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    background: #f8fafc;
}

/* Editor Form Elements */
.editor-group {
    margin-bottom: 1.5rem;
}
.editor-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}
.editor-input, .editor-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: var(--text-primary);
    background: #ffffff;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.editor-input:focus, .editor-textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--accent-blue-glow);
}
.editor-textarea {
    resize: vertical;
    min-height: 100px;
}

/* Image Selection Grid */
.image-select-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: 0.5rem;
    max-height: 250px;
    overflow-y: auto;
    padding: 4px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #f8fafc;
}
.image-select-card {
    position: relative;
    aspect-ratio: 16/9;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition-smooth);
}
.image-select-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.image-select-card.selected {
    border-color: var(--accent-blue);
    box-shadow: 0 0 8px var(--accent-blue-glow);
}
.image-select-card::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--accent-blue);
    color: #ffffff;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    opacity: 0;
    transform: scale(0.5);
    transition: var(--transition-smooth);
}
.image-select-card.selected::after {
    opacity: 1;
    transform: scale(1);
}

/* Button Config Sub-Form */
.button-config-card {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}
.button-config-card h4 {
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.25rem;
}

/* Floating Edit Mode Banner */
.edit-banner {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-120px);
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 40px;
    z-index: 1999;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
    font-weight: 500;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    pointer-events: auto;
}
.edit-banner.visible {
    transform: translateX(-50%) translateY(0);
}
.edit-banner-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-blue);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-blue);
    animation: pulse-dot 1.5s infinite;
}
.edit-banner-btn {
    background: var(--accent-blue);
    border: none;
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}
.edit-banner-btn:hover {
    background: #1d4ed8;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Floating Section Controls (Move Up/Down/Delete) */
.section-controls {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 1000;
    display: none;
    gap: 8px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 6px 10px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
}
.edit-mode-active .editable-section:hover .section-controls {
    display: flex;
}
.control-btn {
    background: none;
    border: none;
    color: #ffffff;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
}
.control-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.1);
}
.control-btn.remove-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

/* ==========================================
   9. GRID LAYOUT & VISUAL MATRIX BUILDER
   ========================================== */

/* Homepage CSS Grid Container */
.grid-layout {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    width: 100%;
}
.grid-region {
    position: relative;
    width: 100%;
    min-width: 0; /* Prevents flex/grid blowouts */
}

/* Handle mobile responsiveness: collapse grid to 1 column */
@media (max-width: 768px) {
    .grid-layout {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    .grid-region {
        grid-column: 1 / -1 !important;
        grid-row: auto !important;
    }
}

/* Visual Matrix Board in Drawer */
.matrix-container {
    position: relative;
    width: 100%;
    height: 220px;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px;
    margin-bottom: 1.5rem;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}
.matrix-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 6px;
    width: 100%;
    height: 100%;
}
.matrix-cell {
    background: #ffffff;
    border-radius: 6px;
    border: 1px dashed rgba(148, 163, 184, 0.3);
    transition: var(--transition-smooth);
}
.matrix-cell:hover {
    background: #e2e8f0;
}

/* Allocated Region Blocks */
.matrix-region-overlay {
    position: absolute;
    background: var(--accent-blue-glow);
    border: 2px solid var(--accent-blue);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-blue);
    text-align: center;
    padding: 4px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    overflow: hidden;
    text-overflow: ellipsis;
}
.matrix-region-overlay:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.2);
    background: rgba(37, 99, 235, 0.15);
}
.matrix-region-overlay.selected {
    background: var(--accent-blue);
    color: #ffffff;
    border-color: var(--text-primary);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
    z-index: 20;
}

/* Grid Slider Controls */
.slider-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
    background: #f8fafc;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}
.slider-control {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.slider-control label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.slider-control input[type="range"] {
    width: 100%;
    accent-color: var(--accent-blue);
    cursor: pointer;
}
.slider-value {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: right;
    margin-top: 2px;
}

