/* ==========================================================================
   DESIGN SYSTEM - CORE VARIABLES
   ========================================================================== */
:root {
    --primary-color: #0066cc; /* Default Blue - Override this per-page */
    --background-color: #ffffff;
    --hero-bg: #ffffff;
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --accent-blue: #0066cc;
    --border-color: #e5e5e5;
    --sidebar-width: 200px;
    --container-max-width: 1100px;
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Global Viewport Lock for Mobile */
html, body {
    margin: 0;
    padding: 0;
    overflow-x: hidden; /* Hard-blocks horizontal scroll on mobile */
    width: 100%;
    position: relative;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    transition: all 0.2s;
    color: var(--primary-color);
    text-decoration: none;
}

a:visited {
    color: var(--primary-color);
}

.container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* Splash & Main Visibility Logic */
#splash-layer, #main-site {
    transition: opacity 0.4s ease;
}

#main-site {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    flex: 1; /* Fills remaining space in body flex container */
}

/* Splash Flash Prevention */
.hide-splash-instantly #splash-layer {
    display: none !important;
}

.hide-splash-instantly #main-site {
    display: flex !important;
}

#splash-layer.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* ==========================================================================
   LAYOUT COMPONENTS
   ========================================================================== */

/* Main Header */
.main-header {
    height: 60px;
    border-bottom: 1px solid var(--border-color);
}

.main-header .container {
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 20px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 25px; /* Reduced from 35px for a tighter, more cohesive feel */
}

.site-logo {
    height: 2rem; /* Using relative rem for professional scaling */
    width: auto;
    display: block;
    object-fit: contain;
}

.dropdown {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
    cursor: pointer;
    font-size: 14px;
    padding: 10px 15px;
    margin-left: -15px; /* To maintain left alignment of text */
    transition: background-color 0.15s, box-shadow 0.15s;
}

.dropdown.active {
    background-color: #ffffff;
    box-shadow: -1px 0 0 var(--border-color), 1px 0 0 var(--border-color), 0 -1px 0 var(--border-color);
    border-radius: 0;
    z-index: 1001; /* Higher z-index to mask top border of dropdown content where they overlap */
}

.dropdown.active::after {
    content: '';
    position: absolute;
    bottom: -2px; /* Definitively overlap the header's bottom border and menu's top border */
    left: 0;
    width: 100%;
    height: 4px;
    background: #ffffff;
    z-index: 1002;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: -1px;
    background-color: #ffffff;
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color); /* Re-enabled full border */
    border-radius: 0;
    z-index: 1000;
    min-width: 210px;
    padding: 2px 0;
    margin-top: -1px; /* Align perfectly with button's bottom edge */
}

.dropdown-content.show {
    display: block;
}

.dropdown-content a {
    display: block;
    padding: 10px 18px;
    color: var(--text-primary) !important;
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s ease;
}

.dropdown-content a:hover {
    background-color: var(--hero-bg);
    color: var(--primary-color) !important;
}

/* Breadcrumbs */
.breadcrumb-nav {
    padding: 12px 0;
    font-size: 11px;
    color: var(--text-secondary);
}

.breadcrumbs {
    list-style: none;
    display: flex;
    gap: 8px;
}

.breadcrumbs li:not(:last-child)::after {
    content: ">";
    margin-left: 8px;
}

.breadcrumbs a, .breadcrumbs a:visited {
    color: var(--text-secondary);
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

/* Hero Section */
.hero-section {
    background-color: var(--hero-bg);
    height: 200px;
    position: relative;
    overflow: hidden;
    margin-bottom: 40px;
}

.hero-pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(var(--primary-color) 1.2px, transparent 1.2px);
    background-size: 24px 24px;
    opacity: 0.15;
}

.hero-section .container {
    height: 100%;
}

.hero-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    height: 100%;
    gap: 20px;
}

.product-badge {
    width: 100px;
    height: 100px;
    background: white;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-badge img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.hero-titles {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero-content h1 {
    font-size: 32px;
    font-weight: 700;
    color: #333;
    line-height: 1.1;
}

.hero-subtitle {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Sidebar Layout */
.main-layout {
    display: flex;
    gap: 40px;
    padding-top: 20px;
    padding-bottom: 68px; /* High-end breathing room before footer */
}

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
}

.content-area {
    flex-grow: 1;
}

.side-nav ul {
    list-style: none;
}

.side-nav li {
    margin-bottom: 8px;
}

.side-nav a, .side-nav a:visited {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    border-radius: 8px;
}

.side-nav a .material-icons-outlined {
    font-size: 18px;
    flex-shrink: 0;
    opacity: 0.75;
}

.side-nav li.active a, .side-nav li.active a:visited {
    color: var(--primary-color);
    background: color-mix(in srgb, var(--primary-color), transparent 95%);
    font-weight: 600;
}

.side-nav a:hover {
    color: var(--primary-color);
    background: color-mix(in srgb, var(--primary-color), transparent 97%);
}

.side-nav .divider {
    height: 1px;
    background: var(--border-color);
    margin: 20px 0;
}

/* Main Grid Content */
.grid-layout {
    display: grid;
    grid-template-columns: 310px 1fr;
    gap: 24px;
    align-items: start;
}

/* ==========================================================================
   UI COMPONENTS
   ========================================================================== */

.card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--card-shadow);
}

.card h2 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #333;
}

/* Buttons */
.cta-btn, .addon-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    background: var(--primary-color);
    color: #fff !important;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px color-mix(in srgb, var(--primary-color), transparent 70%);
}

.cta-btn:visited, .addon-cta-btn:visited {
    color: #fff !important;
}

.cta-btn:hover, .addon-cta-btn:hover {
    filter: brightness(0.9);
    box-shadow: 0 6px 20px color-mix(in srgb, var(--primary-color), transparent 60%);
    color: #fff !important;
}

/* Alternatives List */
.alternatives-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.alternative-item {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #f8f9fa;
    padding: 16px;
    border-radius: 10px;
    border: 1px solid #eee;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.alternative-item h3 {
    margin: 0;
    font-size: 15px;
}

.alternative-item--active {
    background: color-mix(in srgb, var(--primary-color), white 97%);
    border-color: var(--primary-color);
}

.alternative-item--active h3 {
    color: var(--primary-color);
    font-weight: 600;
}

.alternative-item--disabled {
    opacity: 0.45;
    cursor: default;
    filter: grayscale(100%);
}

.alternative-item:not(.alternative-item--disabled):hover {
    border-color: var(--primary-color);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.alt-logo {
    width: 64px;
    height: 64px;
    background: #fff;
    border-radius: 8px;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.alt-logo img {
    max-width: 100%;
    max-height: 100%;
}

.view-all {
    display: inline-block;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    margin-top: 20px;
    transition: color 0.2s;
}

.view-all:hover {
    color: var(--accent-blue);
    opacity: 0.8;
}

.view-all:visited {
    color: var(--primary-color);
}

/* Features & Details */
.expanded-details {
    padding: 36px 44px;
}

.product-description-title {
    margin-bottom: 4px !important;
    display: flex;
    align-items: center;
    justify-content: space-between; /* Pushes icon to the right corner of the line */
}

.product-description-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-icon {
    display: inline-flex;
    color: #ccc;
    cursor: pointer;
    transition: all 0.23s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    text-decoration: none !important;
}

.info-icon:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

.info-icon .material-icons-outlined {
    font-size: 18px;
}

/* Attribution Popover System */
.info-popover {
    display: none;
    position: absolute;
    bottom: calc(100% + 15px);
    left: 50%;
    transform: translateX(-90%) scale(0.95);
    width: 240px;
    max-width: calc(100vw - 40px); /* Mobile Safety: Prevents overflow on the left edge */
    background: #fff;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border: 1px solid #eee;
    z-index: 1000;
    cursor: default;
    text-align: left;
    white-space: normal;
    opacity: 0;
    transition: all 0.23s cubic-bezier(0.19, 1, 0.22, 1);
}

.info-popover.active {
    display: block;
    opacity: 1;
    transform: translateX(-90%) scale(1);
}

.popover-flex {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    justify-content: space-between;
}

.popover-text {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

/* Precise Centering using Percentage */
.info-popover::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 90%; /* This targets the 50% mark of the icon since popover is at -90% offset */
    transform: translateX(-50%);
    border-width: 8px;
    border-style: solid;
    border-color: #fff transparent transparent transparent;
}

.popover-close {
    background: none;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 1;
    color: #ff3b30;
    transition: transform 0.2s ease;
    flex-shrink: 0;
    margin-top: 2px;
}

.popover-close .material-icons-outlined {
    font-size: 16px;
}

.popover-close:hover {
    transform: scale(1.15);
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.desc-highlights {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.desc-highlights li {
    display: flex;
    gap: 12px;
    font-size: 13.5px;
    color: var(--text-secondary);
}

.desc-highlights li .material-icons-outlined {
    color: var(--primary-color);
    font-size: 20px;
}

.features-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.feature-item {
    display: flex;
    gap: 16px;
    background: #f8f9fa;
    border: 1px solid #eee;
    padding: 16px 18px;
    border-radius: 10px;
    transition: all 0.2s;
}

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

.feature-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.feature-text strong {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.feature-text span {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.main-footer {
    background: #f8f9fa;
    border-top: 1px solid var(--border-color);
    padding: 32px 0;
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: auto; /* Restores sticky bottom positioning */
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.main-footer a, .main-footer a:visited {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.main-footer a:hover {
    color: var(--primary-color);
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
/* ==========================================================================
   RESPONSIVE OPTIMIZATIONS
   ========================================================================== */

/* TABLET & MOBILE GLOBAL RESET */
@media (max-width: 900px) {
    .container {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 24px;
        padding-right: 24px;
    }

    .main-layout {
        flex-direction: column;
        gap: 32px;
        width: 100%;
        max-width: 100%;
        margin: 0;
    }

    .grid-layout {
        display: block;
        width: 100%;
        max-width: 100%;
    }

    .grid-layout > * {
        margin-bottom: 24px;
    }

    .grid-layout > *:last-child {
        margin-bottom: 0px;
    }

    .sidebar, .content-area, .details-section, .card {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }

    .sidebar {
        margin-bottom: 24px;
        overflow: visible;
        position: relative;
    }

    /* Scroll hint removed for wrapping layout */
    .sidebar::after {
        display: none !important;
    }

    .side-nav ul {
        display: flex;
        flex-wrap: wrap; /* Wraps items into rows for better visibility */
        gap: 10px 12px; /* Row and column gaps */
        padding: 0;
        margin: 0 0 8px 0; /* Standardized gap to sync with boxes below */
        overflow: visible;
        -webkit-overflow-scrolling: touch;
    }

    .side-nav ul::-webkit-scrollbar {
        display: none;
    }

    .side-nav li {
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .side-nav a {
        padding: 10px 18px;
        white-space: nowrap;
        background: #fdfdfd;
        border: 1px solid var(--border-color);
        font-size: 13px;
        border-radius: 100px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    }

    .side-nav li.active a {
        background: #fff;
        border-color: var(--primary-color);
        box-shadow: 0 4px 12px color-mix(in srgb, var(--primary-color), transparent 85%);
    }

    .side-nav .divider {
        display: none;
    }

    .expanded-details {
        padding: 32px 24px;
    }

    .hero-section {
        height: auto;
        padding: 48px 0;
    }

    .hero-content {
        gap: 24px;
    }

    .product-badge {
        width: 80px;
        height: 80px;
    }

    /* Fixed Tooltip for Tablets/Phones to prevent right-side clipping */
    .info-popover {
        left: auto !important;
        right: -5px !important;
        transform: scale(0.95) translateY(0) !important;
        width: 250px !important;
        max-width: 280px !important;
        transform-origin: right bottom;
    }

    .info-popover.active {
        display: block;
        opacity: 1;
        transform: scale(1) translateY(0) !important;
    }

    .info-popover::after {
        left: auto !important;
        right: 14px !important;
        transform: translateX(50%);
    }
}

/* MOBILE (600px and below) */
@media (max-width: 600px) {
    .main-header {
        padding: 16px 0;
    }

    .logo-section {
        flex-direction: row;
        justify-content: space-between;
        width: 100%;
    }

    .hero-section {
        padding: 40px 0;
        margin-bottom: 24px;
    }

    .hero-content h1 {
        font-size: 26px;
    }

    .product-description-title {
        font-size: 20px;
        gap: 12px;
    }

    /* Scaling the splash screen if present locally */
    .splash-content h1 {
        font-size: 32px !important;
    }
}

/* SMALL PHONES (380px and below) - Absolute Containment */
@media (max-width: 380px) {
    .container {
        padding-left: 16px;
        padding-right: 16px;
    }

    .site-logo {
        height: 1.6rem;
    }

    .side-nav ul {
        padding: 8px 16px 20px 16px;
        margin: 0 -16px;
    }

    .hero-content h1 {
        font-size: 22px;
    }

    .side-nav a {
        padding: 10px 14px;
        font-size: 12px;
    }

    .hero-section {
        padding: 32px 0;
    }

    .product-description-title {
        font-size: 18px;
    }

    .details-section, .card {
        padding: 24px 16px !important;
    }
    
    .info-popover {
        width: 220px !important; 
        max-width: 260px !important;
    }
}