/* ── Med Info (public listing + detail page) ── */

:root {
    --mi-accent: #1d4ed8;
    --mi-accent-dark: #1e40af;
    --mi-accent-soft: #eff6ff;
    --mi-ink: #111827;
    --mi-body: #374151;
    --mi-muted: #6b7280;
    --mi-border: #e5e7eb;
    --mi-bg: #f6f7fb;
    --mi-img-bg: #f1f5f9;
}

/* ── Header ── */
.med-head {
    padding: 56px 0 36px;
    background: #ffffff;
    text-align: center;
    border-bottom: 1px solid var(--mi-border);
}
.med-head h1 {
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--mi-ink);
    margin: 0 0 12px;
    letter-spacing: -0.02em;
}
.med-head h1::after {
    content: "";
    display: block;
    width: 56px;
    height: 4px;
    background: var(--mi-accent);
    border-radius: 4px;
    margin: 14px auto 0;
}
.med-sub {
    font-size: 1.05rem;
    color: var(--mi-muted);
    margin: 0 auto;
    max-width: 640px;
    line-height: 1.6;
}

/* ── Listing section ── */
.med-section {
    padding: 40px 0 80px;
    background: var(--mi-bg);
}

.med-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
}

/* ── Medicine card (image + title only) ── */
.med-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border: 1px solid var(--mi-border);
    border-radius: 14px;
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}
.med-card:hover {
    box-shadow: 0 12px 28px rgba(17, 24, 39, 0.10);
    transform: translateY(-4px);
    border-color: #c7d2fe;
}

/* Thumbnail: show the WHOLE image (no cropping) on a neutral pad */
.med-card-thumb {
    width: 100%;
    height: 200px;
    background: var(--mi-img-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
}
.med-card-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}
.med-card-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--mi-accent);
    font-size: 2.6rem;
}

.med-card-body {
    padding: 18px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}
.med-card-title {
    font-size: 1.12rem;
    font-weight: 700;
    color: var(--mi-ink);
    margin: 0;
    letter-spacing: -0.01em;
    line-height: 1.4;
}
.med-card-cta {
    margin-top: auto;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--mi-accent);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.med-card-cta i { transition: transform 0.2s ease; }
.med-card:hover .med-card-cta i { transform: translateX(4px); }

.med-empty {
    text-align: center;
    color: var(--mi-muted);
    padding: 48px 0;
}

/* ── Detail page ── */
.med-detail-section {
    padding: 36px 0 80px;
    background: #ffffff;
}
.med-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--mi-accent);
    text-decoration: none;
    margin-bottom: 24px;
}
.med-back i { transition: transform 0.2s ease; }
.med-back:hover { color: var(--mi-accent-dark); }
.med-back:hover i { transform: translateX(-3px); }

.med-detail {
    display: grid;
    grid-template-columns: minmax(0, 440px) 1fr;
    gap: 40px;
    align-items: start;
}

/* Full image, never cropped */
.med-detail-image {
    background: var(--mi-img-bg);
    border: 1px solid var(--mi-border);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: sticky;
    top: 90px;
}
.med-detail-image img {
    max-width: 100%;
    max-height: 520px;
    object-fit: contain;
    border-radius: 8px;
    display: block;
}
.med-detail-image-placeholder {
    width: 100%;
    height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--mi-accent);
    font-size: 4rem;
}

.med-detail-content {
    min-width: 0;
}
.med-detail-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--mi-ink);
    margin: 0 0 24px;
    letter-spacing: -0.02em;
    line-height: 1.25;
}
.med-detail-block {
    margin-bottom: 24px;
}

.med-block-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--mi-accent);
    margin: 0 0 8px;
}
.med-block-text {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--mi-body);
    margin: 0;
    white-space: pre-line;
}

.med-doctor-note {
    background: var(--mi-accent-soft);
    border-left: 4px solid var(--mi-accent);
    border-radius: 8px;
    padding: 16px 18px;
    margin-top: 8px;
}
.med-doctor-note .med-block-text {
    color: #1f2937;
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .med-head h1 { font-size: 2rem; }
    .med-detail {
        grid-template-columns: 1fr;
        gap: 26px;
    }
    .med-detail-image {
        position: static;
        max-width: 420px;
    }
}
@media (max-width: 600px) {
    .med-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
    .med-head { padding: 40px 0 26px; }
    .med-head h1 { font-size: 1.65rem; }
    .med-card-thumb { height: 150px; }
    .med-detail-title { font-size: 1.5rem; }
    .med-detail-image { padding: 14px; }
}
