/**
 * Pharma Index Core Platform
 * Global System Stylesheet (styles.css)
 * Theme Style: Pure Minimalist Light, High-Scannability
 * Layout Constraints: Max Width 900px Optimized
 */

/* ==========================================================================
   1. PREMIUM LIGHTWEIGHT DESIGN TOKENS
   ========================================================================== */
:root {
    /* Palette Spectrum */
    --primary: #1e293b;
    /* Refined Slate Core Gray */
    --primary-light: #f8fafc;
    /* Pure Cloud Panel Canvas */
    --accent: #216f98;
    /* Modern Electric Indigo Accent */
    --accent-hover: #2783b4;
    /* Indigo Transit State */
    --accent-danger: #e11d48;
    /* Precise Rose Alert Element */
    --accent-warning: #ea580c;
    /* Clean Burnt Amber Accent */
    --success: #15803d;
    /* Safe Botanical Green */
    --success-light: #f0fdf4;
    /* Soft Mint Canvas Wash */
    --info-bg: #f0f9ff;
    /* Clean Azure Diagnostic Canvas */
    --info-text: #0369a1;
    /* Pure Healthcare Blue Accent */
    --bg-muted: #f1f5f9;
    /* Sophisticated Off-White Foundation */
    --border-color: #e2e8f0;
    /* Razor-Thin Whisper Gray lines */
    --text-dark: #334155;
    /* Reduced Contrast Dark Charcoal Text */
    --text-muted: #64748b;
    /* Technical Slate Secondary Label */

    /* Elegant Dimensional Scale */
    --max-width: 900px;
    --radius-sm: 2px;
    --radius-md: 4px;
    --radius-lg: 6px;

    /* Fine Shadow Profiles */
    --shadow-soft: 0 4px 20px -2px rgba(15, 23, 42, 0.04), 0 2px 6px -1px rgba(15, 23, 42, 0.02);
    --shadow-hover: 0 20px 25px -5px rgba(79, 70, 229, 0.06), 0 8px 10px -6px rgba(79, 70, 229, 0.04);
}

/* ==========================================================================
   2. TYPE SCALING AND STRUCTURAL RESET
   ========================================================================== */
html {
    box-sizing: border-box;
    font-size: 15px;
    /* Compact scannability scaling */
    scroll-behavior: smooth;
    background-color: #fafbfc;
}

*,
*:before,
*:after {
    box-sizing: inherit;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-dark);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
    color: var(--primary);
    font-weight: 600;
    /* Sophisticated medium weighting */
    letter-spacing: -0.02em;
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    background-color: var(--bg-muted);
    color: var(--primary);
    padding: 3px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.85em;
    border: 1px solid var(--border-color);
}

.logo {
    position: absolute;
    width: 64px;
    height: 64px;
    object-fit: contain;
    flex-shrink: 0;
}

/* ==========================================================================
   3. SELF-CORRECTING GRIDS & RESPONSIVE COMPACT BOUNDS
   ========================================================================== */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
    box-sizing: border-box;
}

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

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.split-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 24px;
}

/* ==========================================================================
   4. SYSTEM DESIGN COMPONENTS (BUTTONS & BADGES)
   ========================================================================== */
.badge-ui {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.badge-danger {
    background-color: #fff1f2;
    color: var(--accent-danger);
    border: 1px solid #ffe4e6;
}

.badge-warning {
    background-color: #fff7ed;
    color: var(--accent-warning);
    border: 1px solid #ffedd5;
}

.badge-success {
    background-color: var(--success-light);
    color: var(--success);
    border: 1px solid #dcfce7;
}

.badge-info {
    background-color: var(--info-bg);
    color: var(--info-text);
    border: 1px solid #bae6fd;
}

.btn-submit {
    display: inline-block;
    background-color: var(--accent);
    color: #fff;
    border: none;
    padding: 12px 28px;
    font-size: 0.92rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: center;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    width: 25%;
}

.btn-submit:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.25);
}

/* ==========================================================================
   5. LANDING MAIN HUB SPECIFIC INTERFACES (index.php)
   ========================================================================== */
.home-header {
    margin: 10px;
    position: relative;
    z-index: 10;
    background: rgba(250, 251, 252, 0.9);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

.home-header-inner {
    min-height: 82px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.home-brand {
    display: inline-flex;
    align-items: center;
}

.home-brand img {
    display: block;
    width: 176px;
    height: auto;
}

.home-nav {
    display: flex;
    align-items: center;
    gap: 24px;
}

.home-nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
}

.home-nav a:hover {
    color: var(--accent);
}

.home-nav span {
    color: var(--accent);
    font-size: 1rem;
}

.home-main {
    overflow: hidden;
}

.hero-section {
    position: relative;
    background: linear-gradient(135deg, #f7fbff 0%, #ffffff 58%, #f0fdfa 100%);
    padding: 86px 0 76px;
    border-bottom: 1px solid var(--border-color);
}

.hero-section::before {
    position: absolute;
    top: 0;
    right: 8%;
    width: 260px;
    height: 260px;
    border-right: 1px solid rgba(14, 116, 144, 0.14);
    border-bottom: 1px solid rgba(14, 116, 144, 0.14);
    border-radius: 0 0 100% 0;
    content: "";
    pointer-events: none;
}

.hero-wrap {
    position: relative;
    max-width: 900px;
}

.hero-copy {
    max-width: 700px;
}

.eyebrow {
    display: inline-block;
    color: #0f766e;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.hero-section h1 {
    max-width: 760px;
    margin: 18px 0 16px;
    color: #123b60;
    font-size: clamp(1.7rem, 4vw, 3.3rem);
    line-height: 0.98;
    letter-spacing: -0.045em;
}

.hero-subtext {
    max-width: 600px;
    margin: 0;
    color: var(--text-muted);
    font-size: 1.08rem;
    line-height: 1.7;
}

.hero-search-shell {
    max-width: 760px;
    margin-top: 42px;
}

.search-form-wrapper {
    background: #fff;
    padding: 6px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
    max-width: none;
    margin: 0;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-form-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.08), var(--shadow-soft);
}

.search-input-group {
    display: flex;
    align-items: center;
    width: 100%;
}

.search-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    padding-left: 16px;
    user-select: none;
    pointer-events: none;
}

.search-input-group input[type="text"] {
    width: 100%;
    border: none;
    outline: none;
    padding: 17px 12px;
    font-size: 1rem;
    color: var(--primary);
    background: transparent;
}

.search-icon svg {
    width: 21px;
    height: 21px;
    display: block;
}

.search-form-wrapper>.btn-submit {
    display: block;
    width: 25%;
    margin-left: auto;
    margin-top: 6px;
}

.search-hint {
    margin: 12px 0 0 4px;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.hint-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin: 0 7px 1px 0;
    border-radius: 50%;
    background: #14b8a6;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 9999;
    display: none;
    max-height: 350px;
    margin-top: 6px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 18px 35px rgba(15, 23, 42, 0.12);
}

.autocomplete-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--bg-muted);
}

.autocomplete-item:last-child {
    border-bottom: 0;
}

.autocomplete-item:hover {
    background: #f0fdfa;
}

.autocomplete-term {
    color: var(--primary);
    font-weight: 600;
}

.autocomplete-type {
    padding: 3px 7px;
    border-radius: 4px;
    background: var(--bg-muted);
    color: var(--text-muted);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.home-overview {
    padding: 72px 0;
    background: #fff;
}

.overview-grid {
    display: grid;
    grid-template-columns: 0.9fr 1.1fr;
    gap: 80px;
    align-items: start;
}

.overview-intro h2 {
    margin: 12px 0 12px;
    color: #123b60;
    font-size: 2rem;
    letter-spacing: -0.035em;
}

.overview-intro p {
    max-width: 360px;
    margin: 0;
    color: var(--text-muted);
}

.overview-list {
    border-top: 1px solid var(--border-color);
}

.overview-item {
    display: grid;
    grid-template-columns: 46px 1fr;
    gap: 8px 16px;
    padding: 22px 0;
    border-bottom: 1px solid var(--border-color);
}

.overview-item>span {
    grid-row: span 2;
    color: #14b8a6;
    font-size: 0.78rem;
    font-weight: 700;
}

.overview-item strong {
    color: var(--primary);
    font-size: 1rem;
}

.overview-item p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Shared top navigation used by search and profile pages */
.site-navbar {
    position: sticky;
    top: 0;
    z-index: 1100;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.site-navbar-inner {
    width: 100%;
    max-width: 1100px;
    min-height: 50px;
    margin: 0 auto;
    padding: 5px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--primary);
    font-size: 1.05rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.site-navbar-brand:hover {
    color: var(--accent);
}

.site-navbar-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--accent);
    color: #fff;
    font-size: 1.1rem;
    box-shadow: 0 5px 12px rgba(79, 70, 229, 0.2);
}

.site-navbar-search {
    display: flex;
    flex: 1;
    max-width: 560px;
    min-width: 220px;
    align-items: center;
    gap: 8px;
    padding: 4px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--primary-light);
}

.site-navbar-search:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.site-navbar-search input {
    min-width: 0;
    flex: 1;
    border: 0;
    outline: 0;
    padding: 3px 6px;
    color: var(--primary);
    background: transparent;
    font: inherit;
}

.site-navbar-search button {
    border: 0;
    border-radius: var(--radius-sm);
    padding: 9px 16px;
    color: #fff;
    background: var(--accent);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.site-navbar-search button:hover {
    background: var(--accent-hover);
}

.system-stats {
    padding: 0 0 76px;
    background: #fff;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.stat-card {
    background: #f7fbff;
    padding: 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: none;
}

.stat-kicker {
    color: #0f766e;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.stat-card h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 6px;
    letter-spacing: 0.05em;
}

.stat-number {
    font-size: 2rem;
    font-weight: 600;
    color: var(--primary);
    margin: 0 0 2px 0;
}

/* ==========================================================================
   6. SEARCH RESULTS DASHBOARD ENGINE (search.php)
   ========================================================================== */
.results-header h1 {
    font-size: 1.8rem;
    margin-bottom: 6px;
}

.drug-card {
    background: #fff;
    padding: 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-soft);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.drug-card:hover {
    border-color: #cbd5e1;
    box-shadow: var(--shadow-hover);
}

.indications-box {
    background: var(--primary-light);
    padding: 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-size: 0.88rem;
    color: var(--text-dark);
    margin-top: 10px;
}

/* ==========================================================================
   7. DEEP PROFILE ENGINE STYLES (details.php Navigation Fixes)
   ========================================================================== */
.top-navbar {
    background-color: rgba(255, 255, 255, 0.85);
    /* Frost White Glassmorphism Header */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: relative;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.nav-container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

.nav-brand-row {
    display: flex;
    overflow-x: auto;
    align-items: center;
    gap: 40%;
    padding: 14px 0 8px 0;
   
}

.nav-brand h2 {
    font-size: 1.05rem;
    margin: 0;
    color: var(--primary);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    max-width: 100%;
    text-align: center;
}

.nav-brand strong {
    overflow: hidden;
    color: var(--primary);
    font-size: 0.95rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-context-label {
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    white-space: nowrap;
}

.nav-exit-link {
    color: var(--text-muted);
}

.data-label {
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1.3;
    text-transform: uppercase;
}

.data-value {
    min-width: 0;
    color: var(--text-dark);
    font-size: 0.92rem;
    overflow-wrap: anywhere;
}

.data-value strong {
    color: var(--primary);
}

.content-section > .grid-2,
.content-section > .grid-3,
.content-section > .split-layout {
    align-items: start;
}

.content-section .grid-2 > div,
.content-section .grid-3 > div,
.content-section .split-layout > div {
    min-width: 0;
}

.top-nav-links {
    justify-content: center;
    display: flex;
    gap: 4px;
    overflow-x: none;
    padding: 8px 0;
    scrollbar-width: none;
}

.top-nav-links::-webkit-scrollbar {
    display: flex;
}

/* Tab-switching anchors override */
.nav-link,
.top-nav-links button {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    transition: all 0.15s ease;
    background: none;
    border: none;
    cursor: pointer;
}

.nav-link:hover,
.top-nav-links button:hover {
    background-color: var(--bg-muted);
    color: var(--primary);
}

.nav-link.active,
.top-nav-links button.active {
    background-color: #e0e7ff;
    /* Soft Indigo Link Focus */
    color: var(--accent);
}

dialog#other-brand-names {
    color: var(--text-dark);
    background: #fff;
}

dialog#other-brand-names::backdrop {
    background: rgba(15, 23, 42, 0.42);
}

dialog#other-brand-names .data-table {
    margin-top: 0;
}

dialog#other-brand-names .nav-link {
    display: inline-block;
    color: var(--accent);
    font-weight: 600;
    padding: 0;
}

dialog#other-brand-names .nav-link:hover {
    background: transparent;
    color: var(--accent-hover);
    text-decoration: underline;
}

.record-hero {
    padding: 30px 32px;
}

.record-hero-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.record-hero h1 {
    margin: 12px 0 6px;
    color: #123b60;
    font-size: 2.2rem;
    letter-spacing: -0.04em;
}

.record-section-label {
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
}

.record-subtitle {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.98rem;
}

.record-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 22px;
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.78rem;
}

.record-meta strong {
    color: var(--primary);
}

.record-meta code {
    overflow-wrap: anywhere;
}

/* Core Document Elements Grid */
.main-content {
    max-width: var(--max-width);
    margin: 20px auto;
    padding: 0 24px;
    box-sizing: border-box;
}

.header-banner,
.content-section {
    background: #fff;
    padding: 28px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
    box-shadow: var(--shadow-soft);
}

.content-section {
    scroll-margin-top: 130px;
    /* Offset alignment tool for frosted header view jumps */
}

.section-title {
    font-size: 1.15rem;
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    color: var(--primary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.section-title span {
    display: block;
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
}

/* Document Data Presentation Matrices */
table.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 0.88rem;
}

table.data-table th {
    background: var(--primary-light);
    text-align: left;
    padding: 12px 10px;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

table.data-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-dark);
}

.alert-box {
    padding: 14px;
    border-radius: var(--radius-md);
    border: 1px solid #fee2e2;
    background-color: #fff1f2;
    color: #9f1239;
    font-size: 0.88rem;
    margin-bottom: 16px;
}

.text-block-scroll {
    max-height: 200px;
    overflow-y: auto;
    background-color: var(--primary-light);
    padding: 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-size: 0.88rem;
    color: var(--text-dark);
    line-height: 1.6;
}

/* Universal Legal Footer Overrides */
footer {
    border-top: 1px solid var(--border-color);
    background: #fff !important;
    color: var(--text-muted) !important;
    box-shadow: none !important;
    padding: 24px 0 !important;
    margin-top: 40px !important;
}

/* ==========================================================================
   8. RESPONSIVE SCALE MEDIA RULES (900px Viewport Core Breakpoints)
   ========================================================================== */
@media screen and (max-width: 900px) {
    .hero-section h1 {
        font-size: 2.2rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .overview-grid {
        grid-template-columns: 1fr;
        gap: 36px;
    }
}

@media screen and (max-width: 640px) {
    .home-header-inner {
        min-height: 70px;
    }

    .home-brand img {
        width: 148px;
    }

    .home-nav {
        display: none;
    }

    .hero-section {
        padding: 60px 0 54px;
    }

    .hero-section h1 {
        font-size: 1.75rem;
    }

    .hero-search-shell {
        margin-top: 30px;
    }

    .home-overview {
        padding: 54px 0;
    }

    .overview-intro h2 {
        font-size: 1.7rem;
    }

    .content-section,
    .header-banner {
        padding: 20px;
    }

    .nav-brand-row {
        flex-direction: column;
        gap: 8px;
        align-items: center;
    }

    .btn-submit {
        width: 25%;
    }

    .site-navbar-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 10px 16px;
    }

    .site-navbar-brand {
        align-self: flex-start;
    }

    .site-navbar-search {
        max-width: none;
        width: 100%;
    }

    .nav-container {
        padding: 0 16px;
    }

    .nav-brand-row {
        align-items: center;
    }

    .nav-brand {
        max-width: 70%;
        flex-direction: column;
        align-items: center;
        gap: 1px;
    }

    .nav-context-label {
        font-size: 0.62rem;
    }

    .record-hero {
        padding: 22px;
    }

    .record-hero h1 {
        font-size: 1.8rem;
    }

    .record-hero-topline {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .record-meta {
        flex-direction: column;
        gap: 6px;
    }
}