/* ==========================================================================
   Clinical-Scientific Design System - Bilingual Laboratory Portal
   Harmonious Palette: Royal Blue, Biotech Green, Clean Sterile Whites
   Fully Responsive (Mobile, Tablet, Desktop) & Accessible (Light/Dark themes)
   ========================================================================== */

:root {
    /* light theme scientific tokens */
    --primary-blue: #0b56a4;       /* deep scientific royal blue */
    --primary-green: #0f9d58;      /* biotech laboratory green */
    --accent-cyan: #00b4d8;        /* liquid sterile cyan */
    --bg-main: #f4f7fb;            /* soft sterile gray-blue canvas */
    --bg-container: #ffffff;       /* clean white containers */
    --border-color: #dbe2eb;       /* light clean borders */
    
    --text-primary: #1e293b;       /* slate dark slate text */
    --text-secondary: #64748b;     /* cool grey muted text */
    --text-muted: #94a3b8;
    
    --accent-blue-light: #e6f0fa;
    --accent-green-light: #e6f7ed;
    --accent-cyan-light: #e0f7fa;
    
    --system-red: #d32f2f;
    --system-amber: #f57c00;
    
    --font-ar: 'Segoe UI', Tahoma, Arial, system-ui, -apple-system, sans-serif;
    --font-en: 'Segoe UI', Arial, system-ui, -apple-system, sans-serif;
    --shadow-sm: 0 2px 8px rgba(11, 86, 164, 0.04);
    --shadow-md: 0 10px 30px rgba(11, 86, 164, 0.06);
    --shadow-lg: 0 20px 40px rgba(11, 86, 164, 0.09);
    --radius-lg: 16px;
    --radius-xl: 24px;
}

/* dark theme clinical tokens */
[data-theme="dark"] {
    --bg-main: #0f172a;
    --bg-container: #1e293b;
    --border-color: #334155;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --primary-blue: #38bdf8;
    --primary-green: #4ade80;
    --accent-cyan: #22d3ee;
    
    --accent-blue-light: rgba(56, 189, 248, 0.12);
    --accent-green-light: rgba(74, 222, 128, 0.12);
    --accent-cyan-light: rgba(34, 211, 238, 0.12);
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.5);
}

/* general resets & base flow */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    padding-bottom: 50px;
    overflow-x: hidden;
}

/* scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* bilingual fonts & directions */
html[dir="rtl"] body {
    font-family: var(--font-ar);
}
html[dir="ltr"] body {
    font-family: var(--font-en);
}

.portal-container {
    width: 100%;
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 24px;
}

/* portal unified header */
#portal-header {
    background-color: var(--bg-container);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 0;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

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

/* header branding */
.brand-box {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* scientific segmented horizontal tab bar */
#portal-tab-bar {
    background-color: var(--bg-container);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 6px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 4px;
    margin-bottom: 28px;
    box-shadow: var(--shadow-sm);
}

.tab-btn {
    padding: 12px 6px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    background-color: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-btn:hover {
    color: var(--text-primary);
    background-color: var(--bg-main);
}

.tab-btn.active {
    color: var(--primary-blue);
    background-color: var(--accent-blue-light);
    border-color: rgba(11, 86, 164, 0.1);
    box-shadow: var(--shadow-sm);
}

/* unified scientific cards */
.science-card {
    background-color: var(--bg-container);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.science-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* clean inputs & select dropdowns */
input, select, textarea {
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    outline: none;
    transition: all 0.2s ease;
    width: 100%;
}
input:focus, select:focus, textarea:focus {
    background-color: var(--bg-container);
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px var(--accent-blue-light);
}

/* button styling classes */
.btn-science-primary {
    background-color: var(--primary-blue);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(11, 86, 164, 0.15);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}
.btn-science-primary:hover {
    opacity: 0.95;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(11, 86, 164, 0.2);
}

.btn-science-secondary {
    background-color: var(--bg-main);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}
.btn-science-secondary:hover {
    background-color: var(--border-color);
}

.pill-filter {
    background-color: var(--bg-container);
    border: 1px solid var(--border-color);
    border-radius: 980px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}
.pill-filter:hover {
    color: var(--text-primary);
    background-color: var(--bg-main);
}
.pill-filter.active {
    background-color: var(--primary-blue);
    color: #ffffff;
    border-color: transparent;
}

/* grids & alignments */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: 1fr; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }

@media (min-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1024px) {
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
}

/* full screen chatbot view styling */
.chatbot-grid {
    display: flex;
    flex-direction: row;
    gap: 24px;
    height: 580px;
}

@media (max-width: 900px) {
    .chatbot-grid {
        flex-direction: column-reverse;
        height: auto;
    }
    .chat-faq-side {
        width: 100% !important;
        height: auto !important;
    }
}

.chat-window-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    background-color: var(--bg-container);
    overflow: hidden;
}

.chat-faq-side {
    width: 330px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    background-color: var(--bg-container);
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

#chat-messages-box {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: var(--bg-main);
}

.message-bubble {
    max-w: 80%;
    padding: 12px 16px;
    font-size: 13px;
    line-height: 1.55;
    border-radius: 14px;
}

/* RTL user bubble align left */
html[dir="rtl"] .message-bubble.user {
    align-self: flex-start;
    background-color: var(--primary-blue);
    color: #ffffff;
    border-bottom-left-radius: 2px;
}
/* RTL bot bubble align right */
html[dir="rtl"] .message-bubble.bot {
    align-self: flex-end;
    background-color: var(--bg-container);
    color: var(--text-primary);
    border-bottom-right-radius: 2px;
    border: 1px solid var(--border-color);
}

/* LTR user bubble align right */
html[dir="ltr"] .message-bubble.user {
    align-self: flex-end;
    background-color: var(--primary-blue);
    color: #ffffff;
    border-bottom-right-radius: 2px;
}
/* LTR bot bubble align left */
html[dir="ltr"] .message-bubble.bot {
    align-self: flex-start;
    background-color: var(--bg-container);
    color: var(--text-primary);
    border-bottom-left-radius: 2px;
    border: 1px solid var(--border-color);
}

/* microscope simulation view layout */
.microscope-box {
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.microscope-lens-viewport {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 8px solid var(--border-color);
    background-color: #000;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.8), var(--shadow-md);
}

.microscope-lens-light {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    box-shadow: inset 0 0 30px rgba(0, 180, 216, 0.4);
    pointer-events: none;
    z-index: 10;
}

.microscope-lens-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s ease;
}

.microscope-lens-content svg {
    width: 100%;
    height: 100%;
}

.controls-panel {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* news board timeline styling */
.news-timeline {
    position: relative;
    padding-right: 20px;
    border-right: 2px solid var(--border-color);
}
html[dir="ltr"] .news-timeline {
    padding-right: 0;
    padding-left: 20px;
    border-right: none;
    border-left: 2px solid var(--border-color);
}

.news-item {
    position: relative;
    margin-bottom: 24px;
}

.news-dot {
    position: absolute;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--primary-green);
    border: 2px solid var(--bg-container);
}
html[dir="rtl"] .news-dot {
    right: -27px;
}
html[dir="ltr"] .news-dot {
    left: -27px;
}

/* table custom alignments */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}
tr {
    border-bottom: 1px solid var(--border-color);
}
tr:hover {
    background-color: var(--bg-main);
}
th, td {
    padding: 14px;
    font-size: 13px;
}
html[dir="rtl"] th, html[dir="rtl"] td {
    text-align: right;
}
html[dir="ltr"] th, html[dir="ltr"] td {
    text-align: left;
}
th {
    font-weight: 700;
    background-color: var(--accent-blue-light);
    color: var(--primary-blue);
}

/* Spotlight search panel */
#spotlight-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 10%;
}

#spotlight-container {
    background-color: var(--bg-container);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: zoomIn 0.2s ease-out;
}

@keyframes zoomIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* chemical preparator simulation assets */
.prep-sim-box {
    background-color: var(--bg-main);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 220px;
}

/* page pane fade-in animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.tab-pane {
    animation: fadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.hidden {
    display: none !important;
}

/* iOS notifications box */
.ios-notification {
    background-color: var(--bg-container);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 12px 16px;
    box-shadow: var(--shadow-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease-out;
    pointer-events: auto;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* utility flex containers */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.w-full { width: 100%; }
.max-w-sm { max-w: 380px; }
.max-w-lg { max-w: 520px; }
.max-w-xl { max-w: 640px; }
.rounded-xl { border-radius: 12px; }
.rounded-2xl { border-radius: 16px; }
.text-center { text-align: center; }
.text-xs { font-size: 11px; }
.text-sm { font-size: 13px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 20px; }
.text-2xl { font-size: 24px; }
.text-3xl { font-size: 30px; }
.font-bold { font-weight: 700; }
.font-black { font-weight: 900; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.p-6 { padding: 24px; }
.relative { position: relative; }
.absolute { position: absolute; }
.cursor-pointer { cursor: pointer; }

/* printing styles for solutions bottle label */
@media print {
    body * {
        visibility: hidden;
    }
    #bottle-label-print, #bottle-label-print * {
        visibility: visible;
    }
    #bottle-label-print {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
}

/* ==========================================================================
   Tailwind Utility Class Fallbacks for Vanilla CSS compatibility (SVGs & Cards)
   ========================================================================== */
.w-6 { width: 24px; }
.w-10 { width: 40px; }
.w-12 { width: 48px; }
.w-14 { width: 56px; }
.w-16 { width: 64px; }
.w-20 { width: 80px; }
.w-24 { width: 96px; }
.w-32 { width: 128px; }
.w-48 { width: 192px; }
.w-80 { width: 320px; }

.h-1 { height: 4px; }
.h-1\.5 { height: 6px; }
.h-8 { height: 32px; }
.h-12 { height: 48px; }
.h-14 { height: 56px; }
.h-16 { height: 64px; }
.h-20 { height: 80px; }
.h-24 { height: 96px; }
.h-28 { height: 112px; }
.h-32 { height: 128px; }
.h-36 { height: 144px; }
.h-48 { height: 192px; }

.mb-4 { margin-bottom: 16px; }
.fixed { position: fixed; }
.top-6 { top: 24px; }
.left-6 { left: 24px; }
.z-\[2000\] { z-index: 2000; }
.justify-center { justify-content: center; }

.stroke-current { stroke: currentColor; }
.text-blue-500 { color: #3b82f6; }
.bg-blue-500\/5 { background-color: rgba(59, 130, 246, 0.05); }
.bg-blue-500\/30 { background-color: rgba(59, 130, 246, 0.30); }
.bg-blue-500\/40 { background-color: rgba(59, 130, 246, 0.40); }
.bg-cyan-500\/40 { background-color: rgba(6, 182, 212, 0.40); }
.border-black\/5 { border-color: rgba(0, 0, 0, 0.05); }

.space-y-3 > * + * { margin-top: 12px; }

/* Neon & Biotech Styling for Chemical Preparator */
.text-neon-cyan { color: #00b4d8; }
.text-neon-green { color: #0f9d58; }
.bg-neon-green { background-color: #0f9d58; }
.bg-neon-cyan { background-color: #00b4d8; }
.bg-neon-blue { background-color: #0b56a4; }
.bg-dark-bg { background-color: var(--bg-main); }
.bg-dark-bg\/40 { background-color: var(--bg-main); opacity: 0.85; }
.border-neon-blue\/10 { border-color: var(--border-color); }
.shadow-neon { box-shadow: 0 2px 8px rgba(15, 157, 88, 0.2); }
.shadow-neon-cyan { box-shadow: 0 2px 8px rgba(0, 180, 216, 0.2); }

.text-gray-300 { color: var(--text-primary); }
.text-gray-500 { color: var(--text-secondary); }
.text-gray-600 { color: var(--text-muted); }
.text-red-600 { color: var(--system-red); }
.text-blue-700 { color: var(--primary-blue); }
.shadow-2xl { box-shadow: var(--shadow-lg); }
.border-red-500 { border-color: var(--system-red); }
.bg-white { background-color: var(--bg-container); }
.text-black { color: var(--text-primary); }

