/* ============================================
   Pediatric Dosing Calculator – Widget Styles
   ============================================ */

/* Reset only inside widget */
.pdc-widget,
.pdc-widget *,
.pdc-widget *::before,
.pdc-widget *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.pdc-widget {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    max-width: 100%;
    width: 100%;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.10);
    overflow: hidden;
    color: #2d3748;
    font-size: 14px;
    line-height: 1.5;
}

/* ── Accordion Toggle ─────────────────────── */
.pdc-accordion-toggle {
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.pdc-accordion-toggle:focus-visible {
    outline: 3px solid rgba(66,153,225,0.5);
    outline-offset: -3px;
}

/* ── Header ───────────────────────────────── */
.pdc-header {
    background: linear-gradient(135deg, #4299e1, #667eea);
    color: #fff;
    padding: 18px 20px 12px;
    text-align: center;
}
.pdc-header h2 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 2px;
    color: #fff;
    line-height: 1.3;
}
.pdc-header p {
    font-size: 12px;
    opacity: 0.9;
    margin: 0;
}

/* ── Accordion hint bar ───────────────────── */
.pdc-accordion-hint {
    background: linear-gradient(135deg, #3182ce, #5a67d8);
    color: #fff;
    text-align: center;
    padding: 8px 20px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.2s;
}
.pdc-accordion-toggle:hover .pdc-accordion-hint {
    background: linear-gradient(135deg, #2b6cb0, #4c51bf);
}
.pdc-accordion-arrow {
    display: inline-block;
    transition: transform 0.3s ease;
    font-size: 14px;
}
.pdc-accordion-toggle[aria-expanded="true"] .pdc-accordion-arrow {
    transform: rotate(180deg);
}
.pdc-accordion-toggle[aria-expanded="true"] .pdc-accordion-label {
    display: none;
}

/* ── Collapsible Body ─────────────────────── */
.pdc-accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.3s ease;
    padding-top: 0;
    padding-bottom: 0;
}
.pdc-accordion-body.pdc-open {
    max-height: 1200px;
    padding-top: 18px;
    padding-bottom: 18px;
}

/* ── Body ─────────────────────────────────── */
.pdc-body {
    padding-left: 20px;
    padding-right: 20px;
}

/* ── Disclaimer ───────────────────────────── */
.pdc-disclaimer {
    background: #fff5f5;
    border: 1px solid #fed7d7;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 16px;
    font-size: 11.5px;
    color: #c53030;
    line-height: 1.45;
}
.pdc-disclaimer strong {
    display: block;
    margin-bottom: 2px;
    font-size: 12px;
}

/* ── Tabs ─────────────────────────────────── */
.pdc-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
}
.pdc-tab {
    flex: 1;
    padding: 9px 0;
    text-align: center;
    background: #edf2f7;
    border: 2px solid transparent;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    color: #4a5568;
    user-select: none;
}
.pdc-tab:hover {
    background: #e2e8f0;
}
.pdc-tab.active {
    background: #ebf4ff;
    border-color: #4299e1;
    color: #2b6cb0;
}

/* ── Panels ───────────────────────────────── */
.pdc-panel {
    display: none;
}
.pdc-panel.active {
    display: block;
}

label.pdc-label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 6px;
    color: #4a5568;
}

/* ── Inputs ───────────────────────────────── */
.pdc-select,
.pdc-input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #cbd5e0;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    color: #2d3748;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
}
.pdc-select:focus,
.pdc-input:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66,153,225,0.15);
}
.pdc-select-wrap {
    position: relative;
}
.pdc-select-wrap::after {
    content: "\25BC";
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: #a0aec0;
    pointer-events: none;
}

/* ── Weight row ───────────────────────────── */
.pdc-weight-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.pdc-weight-row .pdc-input {
    flex: 1;
    min-width: 0;
}
.pdc-unit-toggle {
    display: flex;
    border: 1.5px solid #cbd5e0;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}
.pdc-unit-btn {
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    background: #edf2f7;
    color: #4a5568;
    transition: all 0.2s;
    line-height: 1;
}
.pdc-unit-btn.active {
    background: #4299e1;
    color: #fff;
}

/* ── Calculate button ─────────────────────── */
.pdc-btn {
    display: block;
    width: 100%;
    padding: 12px;
    margin-top: 16px;
    background: linear-gradient(135deg, #4299e1, #667eea);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
    text-align: center;
}
.pdc-btn:hover {
    opacity: 0.9;
}

/* ── Results ──────────────────────────────── */
.pdc-results {
    margin-top: 18px;
    display: none;
}
.pdc-results.show {
    display: block;
}

.pdc-med-card {
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 10px;
}
.pdc-med-card:last-child {
    margin-bottom: 0;
}
.pdc-med-card.tylenol {
    background: #f0fff4;
    border: 1px solid #c6f6d5;
}
.pdc-med-card.motrin {
    background: #fff5f7;
    border: 1px solid #fed7e2;
}

.pdc-med-title {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 2px;
}
.pdc-med-card.tylenol .pdc-med-title { color: #276749; }
.pdc-med-card.motrin  .pdc-med-title { color: #97266d; }

.pdc-med-strength {
    font-size: 11.5px;
    color: #718096;
    margin-bottom: 8px;
}

.pdc-dose-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 13px;
}
.pdc-dose-row + .pdc-dose-row {
    border-top: 1px dashed #e2e8f0;
}
.pdc-dose-label { color: #4a5568; }
.pdc-dose-value { font-weight: 700; color: #2d3748; }

.pdc-freq {
    margin-top: 6px;
    font-size: 11.5px;
    color: #718096;
    font-style: italic;
}

/* ── Error ────────────────────────────────── */
.pdc-error {
    background: #fff5f5;
    color: #c53030;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
    margin-top: 14px;
    display: none;
}
.pdc-error.show {
    display: block;
}

/* ── Footer note ──────────────────────────── */
.pdc-note {
    margin-top: 14px;
    font-size: 11px;
    color: #a0aec0;
    text-align: center;
    line-height: 1.4;
}

/* ── Responsive ───────────────────────────── */
@media (max-width: 400px) {
    .pdc-widget {
        border-radius: 0;
    }
    .pdc-body {
        padding: 14px 16px;
    }
    .pdc-unit-btn {
        padding: 10px 11px;
        font-size: 12px;
    }
}
