:root {
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --secondary: #64748b;
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #475569;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 12px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* HEADER */
header { text-align: center; margin-bottom: 40px; }
h1 { font-family: 'Merriweather', serif; color: var(--text-main); font-size: 2.2rem; margin-bottom: 10px; }
.subtitle { color: var(--text-muted); font-size: 1.1rem; }

.search-card {
    background: var(--bg-card);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 40px;
}

.search-form {
    display: flex;
    flex-direction: column; /* Stack vertically by default */
    gap: 20px;
}

/* ROW 1: The Search Bar (Full Width) */
.form-row-main {
    width: 100%;
}

/* ROW 2: Age, Goal, Button (Grid Layout) */
.form-row-secondary {
    display: grid;
    grid-template-columns: 80px 1fr auto; 
    gap: 15px;
    align-items: center;
}

/* --- STANDARD INPUT STYLING --- */
input, select {
    width: 100%; /* Fill the container we gave it */
    height: 48px; /* Standard comfortable touch target */
    padding: 0 15px; /* Comfortable padding text left/right */
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1rem;
    background-color: #f8fafc;
    color: var(--text-main);
    transition: all 0.2s;
    
    /* PREVENTS CUTOFF */
    box-sizing: border-box; 
    min-width: 0;
}

input:focus, select:focus {
    border-color: var(--primary);
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
    outline: none;
}

/* DROPDOWN SPECIFIC (Standard Practice) */
select {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    background-color: #fff;
    
    /* Standard Arrow Icon */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2em;
    padding-right: 3rem; 
}

/* BUTTON STYLING */
button.btn-primary {
    height: 48px;
    padding: 0 25px;
    background-color: var(--primary);
    color: white;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    white-space: nowrap;
}

button.btn-primary:hover {
    background-color: var(--primary-dark);
}

/* REPORT STYLES */
.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border);
}
.report-title h2 { margin: 0; font-size: 1.8rem; font-family: 'Merriweather', serif; }
.badges { display: flex; gap: 10px; }
.badge {
    background: #e0f2fe; color: #0369a1;
    padding: 5px 12px; border-radius: 20px;
    font-size: 0.85rem; font-weight: 600; text-transform: uppercase;
}

/* EVIDENCE CARDS & BORDERS */
.evidence-section { display: grid; gap: 20px; margin-bottom: 40px; }

.card {
    background: var(--bg-card);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    border-left-width: 5px; /* Thicker left border */
}

/* SIMPLE BORDER CLASSES */
.card.border-green  { border-left: 5px solid #10b981; }
.card.border-purple { border-left: 5px solid #8b5cf6; }
.card.border-red    { border-left: 5px solid #ef4444; }
.card.border-blue   { border-left: 5px solid #0ea5e9; }


/* TYPOGRAPHY IN CARDS */
.card h3 { margin-top: 0; color: var(--text-main); font-size: 1.25rem; display: flex; align-items: center; gap: 10px; }
.card-text { color: #334155; font-size: 1.05rem; line-height: 1.7; }

/* CITATIONS & REFS */
.cite-ref {
    color: var(--primary); font-weight: bold; font-size: 0.75em; vertical-align: super;
    text-decoration: none; margin-left: 2px; background: #e0f2fe; padding: 1px 5px; border-radius: 4px;
}
.cite-ref:hover { background: var(--primary); color: white; }

.references-container { background: #e2e8f0; padding: 30px; border-radius: var(--radius); margin-top: 50px; }
.references-container h3 { margin-top: 0; color: var(--text-muted); text-transform: uppercase; font-size: 0.9rem; letter-spacing: 1px; }
.ref-list { list-style: none; padding: 0; }
.ref-item { background: white; padding: 15px; margin-bottom: 10px; border-radius: 8px; border-left: 3px solid transparent; }
.ref-item:target { border-left-color: var(--primary); background-color: #f0f9ff; }
.ref-title { font-weight: 600; display: block; margin-bottom: 5px; }
.ref-meta { font-size: 0.85rem; color: var(--secondary); display: flex; gap: 15px; align-items: center; }
.pubmed-link { color: var(--primary); text-decoration: none; font-weight: 500; font-size: 0.85rem; }
.pubmed-link:hover { text-decoration: underline; }

/* UTILS */
.error-box { background: #fef2f2; color: #991b1b; padding: 15px; border-radius: 8px; border: 1px solid #fecaca; margin-top: 20px; }
@media (max-width: 600px) {
    .form-row-secondary {
        grid-template-columns: 1fr; /* Stack everything on mobile */
    }
}

/* Modal Overlay (Background) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7); /* Dark semi-transparent background */
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
    z-index: 1000; /* Sit on top of everything */
    backdrop-filter: blur(4px); /* Nice modern blur effect */
}

/* Modal Box */
.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    text-align: left;
    border: 1px solid #ddd;
}

.modal-header h2 {
    margin-top: 0;
    color: #d32f2f; /* Warning Red */
    font-size: 1.5rem;
}

.modal-body {
    margin: 20px 0;
    color: #444;
    line-height: 1.6;
}

.modal-body ul {
    margin-top: 10px;
    padding-left: 20px;
    color: #555;
}

.modal-body li {
    margin-bottom: 8px;
}

/* The Button */
.modal-btn {
    background: #222;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    width: 100%;
    transition: background 0.2s;
}

.modal-btn:hover {
    background: #444;
}