/* ================================================
   Health Calculators Suite — WordPress Plugin CSS
   ================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=DM+Serif+Display:ital@0;1&display=swap');

:root {
    --hc-primary: #0f766e;
    --hc-primary-light: #14b8a6;
    --hc-primary-dark: #0d5c56;
    --hc-accent: #f97316;
    --hc-accent-light: #fed7aa;
    --hc-bg: #f8fafc;
    --hc-surface: #ffffff;
    --hc-surface2: #f1f5f9;
    --hc-border: #e2e8f0;
    --hc-text: #0f172a;
    --hc-text-muted: #64748b;
    --hc-success: #16a34a;
    --hc-warning: #d97706;
    --hc-danger: #dc2626;
    --hc-info: #2563eb;
    --hc-radius: 16px;
    --hc-radius-sm: 10px;
    --hc-shadow: 0 4px 24px rgba(0,0,0,0.08);
    --hc-shadow-lg: 0 12px 40px rgba(0,0,0,0.14);
    --hc-font: 'DM Sans', sans-serif;
    --hc-font-display: 'DM Serif Display', serif;
    --hc-transition: 0.22s cubic-bezier(0.4,0,0.2,1);
}

/* ── Reset ────────────────────────────────────── */
.hc-hub *, .hc-standalone *, .hc-calc *,
.hc-modal * {
    box-sizing: border-box;
}

/* ── HUB WRAPPER ──────────────────────────────── */
.hc-hub {
    font-family: var(--hc-font);
    background: var(--hc-bg);
    border-radius: var(--hc-radius);
    padding: 40px 32px 48px;
    max-width: 1100px;
    margin: 0 auto;
}

/* ── HUB HEADER ───────────────────────────────── */
.hc-hub-header {
    text-align: center;
    margin-bottom: 36px;
}

.hc-hub-title {
    font-family: var(--hc-font-display);
    font-size: clamp(2rem, 5vw, 3rem);
    color: var(--hc-text);
    margin: 0 0 8px;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.hc-hub-subtitle {
    font-size: 1.05rem;
    color: var(--hc-text-muted);
    margin: 0 0 24px;
}

/* ── SEARCH ───────────────────────────────────── */
.hc-search-bar {
    display: flex;
    align-items: center;
    background: var(--hc-surface);
    border: 2px solid var(--hc-border);
    border-radius: 50px;
    padding: 10px 20px;
    max-width: 440px;
    margin: 0 auto;
    transition: border-color var(--hc-transition);
}

.hc-search-bar:focus-within {
    border-color: var(--hc-primary-light);
    box-shadow: 0 0 0 4px rgba(20,184,166,0.1);
}

.hc-search-icon { font-size: 1rem; margin-right: 10px; }

.hc-search-bar input {
    border: none;
    outline: none;
    font-family: var(--hc-font);
    font-size: 0.95rem;
    color: var(--hc-text);
    background: transparent;
    flex: 1;
}

/* ── CATEGORY FILTERS ─────────────────────────── */
.hc-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 32px;
}

.hc-cat-btn {
    font-family: var(--hc-font);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 7px 18px;
    border-radius: 50px;
    border: 2px solid var(--hc-border);
    background: var(--hc-surface);
    color: var(--hc-text-muted);
    cursor: pointer;
    transition: all var(--hc-transition);
}

.hc-cat-btn:hover,
.hc-cat-btn.active {
    background: var(--hc-primary);
    border-color: var(--hc-primary);
    color: #fff;
}

/* ── CALCULATOR GRID ──────────────────────────── */
.hc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* ── CALCULATOR CARD ──────────────────────────── */
.hc-card {
    background: var(--hc-surface);
    border: 1.5px solid var(--hc-border);
    border-radius: var(--hc-radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    transition: all var(--hc-transition);
    position: relative;
    overflow: hidden;
}

.hc-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(20,184,166,0.04) 0%, transparent 60%);
    opacity: 0;
    transition: opacity var(--hc-transition);
}

.hc-card:hover {
    border-color: var(--hc-primary-light);
    box-shadow: var(--hc-shadow);
    transform: translateY(-3px);
}

.hc-card:hover::before { opacity: 1; }

.hc-card-icon {
    font-size: 2.2rem;
    line-height: 1;
    margin-bottom: 4px;
}

.hc-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--hc-text);
    margin: 0;
    line-height: 1.3;
}

.hc-card-desc {
    font-size: 0.83rem;
    color: var(--hc-text-muted);
    margin: 0;
    line-height: 1.5;
    flex: 1;
}

.hc-card-btn {
    font-family: var(--hc-font);
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--hc-primary);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    margin-top: 6px;
    text-align: left;
    transition: color var(--hc-transition);
    letter-spacing: 0.01em;
}

.hc-card-btn:hover { color: var(--hc-accent); }

/* ── MODAL ────────────────────────────────────── */
.hc-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: hcFadeIn 0.2s ease;
}

.hc-modal-overlay.open {
    display: flex;
}

@keyframes hcFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.hc-modal {
    background: var(--hc-surface);
    border-radius: var(--hc-radius);
    box-shadow: var(--hc-shadow-lg);
    width: 100%;
    max-width: 520px;
    max-height: 92vh;
    overflow-y: auto;
    position: relative;
    animation: hcSlideUp 0.28s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes hcSlideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.hc-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: var(--hc-surface2);
    color: var(--hc-text-muted);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all var(--hc-transition);
    line-height: 1;
}

.hc-modal-close:hover {
    background: var(--hc-danger);
    color: #fff;
}

.hc-modal-content { padding: 8px; }

/* ── STANDALONE (individual shortcode) ─────────── */
.hc-standalone {
    font-family: var(--hc-font);
    max-width: 520px;
    margin: 0 auto;
}

/* ── CALCULATOR UI ────────────────────────────── */
.hc-calc {
    padding: 28px;
    background: var(--hc-surface);
    border-radius: var(--hc-radius);
    border: 1.5px solid var(--hc-border);
}

.hc-calc-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1.5px solid var(--hc-border);
}

.hc-calc-icon {
    font-size: 2.4rem;
    flex-shrink: 0;
}

.hc-calc-header h3 {
    font-family: var(--hc-font-display);
    font-size: 1.4rem;
    margin: 0 0 2px;
    color: var(--hc-text);
    line-height: 1.2;
}

.hc-calc-header p {
    font-size: 0.82rem;
    color: var(--hc-text-muted);
    margin: 0;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── UNIT TOGGLE ──────────────────────────────── */
.hc-unit-toggle {
    display: flex;
    gap: 4px;
    background: var(--hc-surface2);
    border-radius: 50px;
    padding: 4px;
    width: fit-content;
    margin-bottom: 20px;
}

.hc-unit-btn {
    font-family: var(--hc-font);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 16px;
    border-radius: 50px;
    border: none;
    background: transparent;
    color: var(--hc-text-muted);
    cursor: pointer;
    transition: all var(--hc-transition);
    letter-spacing: 0.02em;
}

.hc-unit-btn.active {
    background: var(--hc-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(15,118,110,0.3);
}

/* ── FORM ─────────────────────────────────────── */
.hc-form { display: flex; flex-direction: column; gap: 16px; }

.hc-field { display: flex; flex-direction: column; gap: 6px; }

.hc-field > label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--hc-text);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.hc-input-wrap {
    display: flex;
    align-items: center;
    background: var(--hc-surface2);
    border: 2px solid var(--hc-border);
    border-radius: var(--hc-radius-sm);
    overflow: hidden;
    transition: border-color var(--hc-transition), box-shadow var(--hc-transition);
}

.hc-input-wrap:focus-within {
    border-color: var(--hc-primary-light);
    box-shadow: 0 0 0 4px rgba(20,184,166,0.12);
    background: #fff;
}

.hc-input-wrap input,
.hc-input-wrap select {
    flex: 1;
    border: none;
    outline: none;
    font-family: var(--hc-font);
    font-size: 1rem;
    font-weight: 500;
    color: var(--hc-text);
    background: transparent;
    padding: 11px 14px;
}

.hc-input-wrap input[type="date"],
.hc-input-wrap input[type="time"] {
    font-size: 0.95rem;
}

.hc-unit {
    padding: 11px 14px 11px 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--hc-text-muted);
    white-space: nowrap;
    letter-spacing: 0.03em;
}

.hc-select-wrap {
    background: var(--hc-surface2);
    border: 2px solid var(--hc-border);
    border-radius: var(--hc-radius-sm);
    overflow: hidden;
    transition: border-color var(--hc-transition);
}

.hc-select-wrap:focus-within {
    border-color: var(--hc-primary-light);
    box-shadow: 0 0 0 4px rgba(20,184,166,0.12);
}

.hc-select-wrap select {
    width: 100%;
    border: none;
    outline: none;
    font-family: var(--hc-font);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--hc-text);
    background: transparent;
    padding: 11px 14px;
    cursor: pointer;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%2364748b' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 34px;
}

.hc-input-multi {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hc-input-multi input {
    flex: 1;
    background: var(--hc-surface2);
    border: 2px solid var(--hc-border);
    border-radius: var(--hc-radius-sm);
    padding: 11px 14px;
    font-family: var(--hc-font);
    font-size: 1rem;
    font-weight: 500;
    color: var(--hc-text);
    outline: none;
    transition: border-color var(--hc-transition);
    width: 0;
    min-width: 0;
}

.hc-input-multi input:focus {
    border-color: var(--hc-primary-light);
    box-shadow: 0 0 0 4px rgba(20,184,166,0.12);
    background: #fff;
}

.hc-input-multi span {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--hc-text-muted);
    flex-shrink: 0;
}

/* ── BUTTON ───────────────────────────────────── */
.hc-btn {
    font-family: var(--hc-font);
    font-size: 0.95rem;
    font-weight: 700;
    padding: 14px 24px;
    border-radius: var(--hc-radius-sm);
    border: none;
    background: linear-gradient(135deg, var(--hc-primary) 0%, var(--hc-primary-light) 100%);
    color: #fff;
    cursor: pointer;
    transition: all var(--hc-transition);
    letter-spacing: 0.02em;
    box-shadow: 0 4px 14px rgba(15,118,110,0.35);
    margin-top: 4px;
    width: 100%;
}

.hc-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(15,118,110,0.4);
    filter: brightness(1.05);
}

.hc-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(15,118,110,0.3);
}

/* ── INFO BOX ─────────────────────────────────── */
.hc-info-box {
    background: #eff6ff;
    border: 1.5px solid #bfdbfe;
    border-radius: var(--hc-radius-sm);
    padding: 10px 14px;
    font-size: 0.82rem;
    color: #1e40af;
    line-height: 1.5;
}

/* ── RESULT PANEL ─────────────────────────────── */
.hc-result {
    margin-top: 24px;
    border-radius: var(--hc-radius-sm);
    border: 2px solid var(--hc-border);
    overflow: hidden;
    animation: hcResultReveal 0.35s cubic-bezier(0.4,0,0.2,1);
}

@keyframes hcResultReveal {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.hc-result-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: var(--hc-primary);
    color: #fff;
}

.hc-result-header h4 {
    font-size: 0.78rem;
    font-weight: 700;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.hc-result-body { padding: 18px; }

.hc-result-main {
    font-family: var(--hc-font-display);
    font-size: 3rem;
    color: var(--hc-text);
    font-weight: 400;
    line-height: 1;
    margin-bottom: 4px;
}

.hc-result-label {
    font-size: 0.85rem;
    color: var(--hc-text-muted);
    margin-bottom: 16px;
}

/* classification badge */
.hc-badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    margin-bottom: 14px;
}

.hc-badge-success { background: #dcfce7; color: #15803d; }
.hc-badge-warning { background: #fef9c3; color: #a16207; }
.hc-badge-danger  { background: #fee2e2; color: #991b1b; }
.hc-badge-info    { background: #dbeafe; color: #1d4ed8; }
.hc-badge-purple  { background: #ede9fe; color: #6d28d9; }

/* gauge bar */
.hc-gauge {
    margin: 12px 0;
}

.hc-gauge-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--hc-text-muted);
    margin-bottom: 5px;
    font-weight: 600;
}

.hc-gauge-track {
    height: 10px;
    background: var(--hc-surface2);
    border-radius: 50px;
    overflow: hidden;
    position: relative;
}

.hc-gauge-fill {
    height: 100%;
    border-radius: 50px;
    transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}

/* result rows/table */
.hc-result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--hc-border);
    font-size: 0.9rem;
}

.hc-result-row:last-child { border-bottom: none; }

.hc-result-row-label { color: var(--hc-text-muted); font-weight: 500; }

.hc-result-row-value {
    font-weight: 700;
    color: var(--hc-text);
}

/* zones (heart rate) */
.hc-zone {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid var(--hc-border);
    font-size: 0.88rem;
}

.hc-zone:last-child { border-bottom: none; }

.hc-zone-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.hc-zone-name { flex: 1; font-weight: 600; color: var(--hc-text); }

.hc-zone-range {
    font-weight: 700;
    color: var(--hc-text);
    font-variant-numeric: tabular-nums;
}

/* sleep times */
.hc-sleep-time-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hc-sleep-time {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--hc-surface2);
    border: 1.5px solid var(--hc-border);
    border-radius: var(--hc-radius-sm);
    padding: 12px 16px;
    min-width: 90px;
    transition: all var(--hc-transition);
}

.hc-sleep-time.best {
    background: linear-gradient(135deg, var(--hc-primary) 0%, var(--hc-primary-light) 100%);
    border-color: var(--hc-primary);
    color: #fff;
}

.hc-sleep-time .time {
    font-family: var(--hc-font-display);
    font-size: 1.4rem;
    font-weight: 400;
}

.hc-sleep-time .cycles {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.7;
    margin-top: 3px;
}

/* disclaimer */
.hc-disclaimer {
    background: var(--hc-surface2);
    border-left: 4px solid var(--hc-accent);
    padding: 10px 14px;
    margin-top: 14px;
    font-size: 0.76rem;
    color: var(--hc-text-muted);
    border-radius: 0 var(--hc-radius-sm) var(--hc-radius-sm) 0;
    line-height: 1.5;
}

/* ── HIDDEN ───────────────────────────────────── */
.hc-hidden { display: none !important; }

/* ── RESPONSIVE ───────────────────────────────── */
@media (max-width: 640px) {
    .hc-hub { padding: 24px 16px 32px; }
    .hc-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .hc-card { padding: 16px; }
    .hc-card-desc { display: none; }
    .hc-result-main { font-size: 2.2rem; }
    .hc-modal { border-radius: var(--hc-radius) var(--hc-radius) 0 0; }
    .hc-modal-overlay { align-items: flex-end; padding: 0; }
    .hc-sleep-time-list { gap: 7px; }
    .hc-sleep-time { min-width: 76px; padding: 10px 12px; }
}

@media (max-width: 400px) {
    .hc-grid { grid-template-columns: 1fr; }
}
