:root {
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --primary: #2dd4bf;
    --primary-hover: #14b8a6;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --accent: #fbbf24;
    --border: #475569;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --radius: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    padding-bottom: 80px; /* Space for bottom nav */
}

header {
    background: var(--bg-card);
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.section { display: none; animation: fadeIn 0.3s ease; }
.section.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

h1 { font-size: 1.8rem; margin-bottom: 10px; }
h2 { font-size: 1.5rem; color: var(--primary); margin-bottom: 20px; border-bottom: 2px solid var(--border); padding-bottom: 10px; }
p.subtitle { color: var(--text-muted); font-size: 1rem; margin-bottom: 25px; }

/* CARDS */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}
.card.clickable { cursor: pointer; transition: transform 0.2s; }
.card.clickable:active { transform: scale(0.98); }
.card-icon { font-size: 2rem; margin-bottom: 10px; }
.card h3 { margin-bottom: 5px; }
.card p { color: var(--text-muted); font-size: 0.9rem; }

/* INPUTS */
.input-group { margin-bottom: 20px; }
.input-label { display: block; font-weight: 600; margin-bottom: 8px; font-size: 0.95rem; }
.input-row { display: flex; gap: 10px; }

input, select {
    width: 100%;
    padding: 14px;
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 1rem;
    color: var(--text-main);
}
input:focus, select:focus { outline: none; border-color: var(--primary); }
.unit-select { width: 90px; flex-shrink: 0; }

.btn-primary {
    width: 100%;
    padding: 16px;
    background: var(--primary);
    color: var(--bg-body);
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
}

/* RESULTS & SYRINGE */
.results-box {
    margin-top: 25px;
    background: rgba(45, 212, 191, 0.05);
    border: 1px solid var(--primary);
    border-radius: 12px;
    padding: 20px;
    display: none;
}
.results-box.show { display: block; }
.results-title { color: var(--primary); margin-bottom: 15px; font-size: 1.1rem; }

.summary-box {
    background: rgba(0,0,0,0.2);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}
.summary-row { display: flex; justify-content: space-between; margin-bottom: 8px; }
.summary-label { color: var(--text-muted); }
.summary-value { font-weight: 600; }
.summary-value.highlight { color: var(--accent); }

.syringe-visualizer { text-align: center; }
.syringe-label { margin-bottom: 10px; font-weight: 600; }

.syringe-container {
    position: relative;
    width: 80px;
    height: 250px;
    margin: 0 auto;
    background: #fff;
    border: 2px solid #333;
    border-radius: 4px 4px 0 0;
    overflow: hidden;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
}

.syringe-liquid {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--primary);
    transition: height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    height: 0%;
    opacity: 0.8;
}

.syringe-marks {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
}

.mark-major {
    position: absolute;
    right: 0;
    width: 60%;
    height: 2px;
    background: #000;
}

.mark-minor {
    position: absolute;
    right: 0;
    width: 30%;
    height: 1px;
    background: #555;
}

.mark-number {
    position: absolute;
    right: 65%;
    font-size: 10px;
    color: #000;
    font-weight: bold;
    transform: translateY(-50%);
}

.plunger-line {
    position: absolute;
    left: -15px;
    width: 110px;
    height: 3px;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
    transition: bottom 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    bottom: 0%;
    z-index: 10;
}

.syringe-readout { margin-top: 15px; }
.readout-units { display: block; font-size: 1.4rem; font-weight: 700; color: var(--primary); }
.readout-ml { display: block; font-size: 0.9rem; color: var(--text-muted); }

/* DOSING GUIDE */
.dosing-guide {
    background: rgba(251, 191, 36, 0.1);
    border-left: 4px solid var(--accent);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 25px;
    display: none;
}
.dosing-guide.show { display: block; }
.dosing-title { font-weight: 700; color: var(--accent); margin-bottom: 10px; }
.dosing-detail { display: flex; gap: 20px; }
.dosing-item { display: flex; flex-direction: column; }
.dosing-label { font-size: 0.75rem; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
.dosing-value { color: var(--text-main); font-weight: 600; }

/* GALLERY & FILTERS */
.filter-bar {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 25px;
    border: 1px solid var(--border);
}
.search-input { margin-bottom: 15px; }
.filter-group { margin-bottom: 15px; }
.filter-label { font-size: 0.85rem; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; }

.chip-container { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    background: var(--bg-input);
    color: var(--text-muted);
    cursor: pointer;
    border: 1px solid transparent;
}
.chip.active { 
    background: var(--primary); 
    color: var(--bg-body); 
    font-weight: 600; 
}

.protocol-grid { display: grid; gap: 15px; }
.proto-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    border-left: 4px solid var(--primary);
    box-shadow: var(--shadow);
    cursor: pointer;
    border: 1px solid var(--border);
}
.proto-card:active { transform: scale(0.99); }
.proto-header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 10px; }
.proto-name { font-size: 1.2rem; font-weight: 700; }
.proto-desc { color: var(--text-muted); font-size: 0.9rem; }

.badge { 
    font-size: 0.7rem; 
    padding: 4px 8px; 
    border-radius: 6px; 
    font-weight: 600; 
    text-transform: uppercase; 
}
.badge-clinical { background: #1e3a8a; color: #93c5fd; }
.badge-preclinical { background: #78350f; color: #fcd34d; }
.badge-investigational { background: #581c87; color: #d8b4fe; }

/* MODAL */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: flex-end;
}
.modal-overlay.active { display: flex; }

.modal-content {
    background: var(--bg-card);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 20px 20px 0 0;
    padding: 30px;
    position: relative;
    animation: slideUp 0.3s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.close-modal {
    position: absolute; top: 15px; right: 15px;
    background: var(--bg-input); border: none;
    width: 40px; height: 40px; border-radius: 50%;
    font-size: 1.5rem; cursor: pointer; color: var(--text-muted);
}
.modal-title { border: none; margin-bottom: 10px; }
.modal-section { margin-top: 20px; }
.modal-section h3 { font-size: 1rem; color: var(--primary); margin-bottom: 5px; }
.modal-section p { color: var(--text-muted); font-size: 0.95rem; }

.disclaimer-box {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid var(--accent);
    padding: 15px;
    border-radius: 12px;
    margin-top: 25px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* BOTTOM NAV */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    z-index: 100;
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
}
.nav-item.active { color: var(--primary); }
.nav-icon { font-size: 1.5rem; margin-bottom: 4px; }

/* DESKTOP RESPONSIVENESS */
@media (min-width: 768px) {
    .protocol-grid { grid-template-columns: repeat(2, 1fr); }
    .modal-overlay { align-items: center; }
    .modal-content { border-radius: 20px; }
}