/* ============================
   FertilityHub v2
   Warm, premium feminine theme
   ============================ */

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

:root {
    /* Warm rose palette */
    --rose: #b5647b;
    --rose-light: #f5e1e7;
    --rose-pale: #fdf4f6;
    --rose-dark: #8e4a5e;
    --rose-glow: rgba(181,100,123,0.12);

    /* Accent palette */
    --mauve: #9883a8;
    --mauve-light: #f0ecf3;
    --sage: #6d9e82;
    --sage-light: #e7f3ec;
    --amber: #d4a24e;
    --amber-light: #fdf5e6;
    --coral: #d4756a;
    --coral-light: #fbe9e7;

    /* Neutrals */
    --bg: #faf8f5;
    --white: #ffffff;
    --cream: #f7f3ef;
    --text: #3a2f3d;
    --text-soft: #6b5f70;
    --muted: #a89bab;
    --border: #ece5e0;
    --border-light: #f3eeea;

    /* Effects */
    --shadow-sm: 0 1px 3px rgba(58,47,61,0.04);
    --shadow: 0 2px 8px rgba(58,47,61,0.06);
    --shadow-md: 0 4px 20px rgba(58,47,61,0.08);
    --shadow-lg: 0 8px 32px rgba(58,47,61,0.1);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
}

/* ─── Base ─── */
*, *::before, *::after { box-sizing: border-box; }
body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}
h1,h2,h3 { font-family: 'DM Serif Display', Georgia, serif; font-weight: 400; color: var(--text); letter-spacing: -0.01em; }
h4,h5,h6 { font-family: 'DM Sans', sans-serif; font-weight: 600; color: var(--text); }
a { color: var(--rose); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--rose-dark); }
::selection { background: var(--rose-light); color: var(--rose-dark); }

/* ─── Navbar ─── */
.navbar-ivf {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-light);
    padding: 0.5rem 0;
    transition: all 0.3s;
}
.navbar-ivf .navbar-brand {
    font-family: 'DM Serif Display', serif;
    font-size: 1.35rem;
    color: var(--rose);
    letter-spacing: -0.02em;
}
.navbar-ivf .navbar-brand span { color: var(--mauve); }
.navbar-ivf .navbar-brand .bi { font-size: 1.1rem; margin-right: 0.15rem; }
.navbar-ivf .nav-link {
    color: var(--text-soft);
    font-weight: 500;
    font-size: 0.88rem;
    padding: 0.45rem 0.85rem;
    border-radius: 50px;
    transition: all 0.2s;
}
.navbar-ivf .nav-link:hover { color: var(--rose); background: var(--rose-pale); }
.navbar-ivf .nav-link.active { color: var(--rose); background: var(--rose-light); }
.navbar-ivf .nav-link .bi { font-size: 0.82rem; margin-right: 0.2rem; }

/* ─── Mobile hamburger button ─── */
.offcanvas-toggler {
    background: none;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xs);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.2s;
}
.offcanvas-toggler:hover { border-color: var(--rose); color: var(--rose); }

/* ─── Mobile offcanvas sidebar ─── */
#mobileNav {
    background: var(--white);
    border-left: 1px solid var(--border-light);
}
#mobileNav .offcanvas-header {
    background: var(--bg);
}
.mob-nav { display: flex; flex-direction: column; }
.mob-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1.25rem;
    color: var(--text);
    font-weight: 500;
    font-size: 0.92rem;
    text-decoration: none;
    transition: all 0.15s;
    border-radius: 0;
}
.mob-link:hover { background: var(--rose-pale); color: var(--rose); }
.mob-link .bi { width: 20px; text-align: center; font-size: 1rem; color: var(--muted); }
.mob-link:hover .bi { color: var(--rose); }
.mob-divider { height: 1px; background: var(--border-light); margin: 0.5rem 1.25rem; }
.mob-section {
    padding: 0.3rem 1.25rem 0.2rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
}

/* ─── Buttons ─── */
.btn-rose {
    background: linear-gradient(135deg, var(--rose) 0%, #c07a8e 100%);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 0.6rem 1.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.25s;
    box-shadow: 0 2px 8px rgba(181,100,123,0.25);
}
.btn-rose:hover {
    background: linear-gradient(135deg, var(--rose-dark) 0%, var(--rose) 100%);
    color: #fff;
    box-shadow: 0 4px 16px rgba(181,100,123,0.35);
    transform: translateY(-1px);
}
.btn-rose-outline {
    background: transparent;
    color: var(--rose);
    border: 1.5px solid var(--rose-light);
    border-radius: 50px;
    padding: 0.5rem 1.2rem;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.25s;
}
.btn-rose-outline:hover {
    background: var(--rose-pale);
    color: var(--rose-dark);
    border-color: var(--rose);
}

/* ─── Tags ─── */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.22rem 0.6rem;
    border-radius: 50px;
    font-size: 0.73rem;
    font-weight: 600;
    margin: 0.12rem;
    letter-spacing: 0.01em;
}
.tag .bi { font-size: 0.65rem; }
.tag-nhs { background: #dce8fa; color: #2756a8; }
.tag-private { background: var(--rose-light); color: var(--rose-dark); }
.tag-treatment { background: var(--mauve-light); color: #6d5b82; }
.tag-facility { background: var(--sage-light); color: #3d6b50; }
.tag-donor { background: var(--amber-light); color: #9a7430; }
.tag-off { background: var(--cream); color: #c0b5aa; text-decoration: line-through; text-decoration-color: rgba(192,181,170,0.4); }
.tag[data-bs-toggle="tooltip"] { cursor: help; }

/* ─── Stars ─── */
.stars { color: var(--amber); font-size: 0.88rem; letter-spacing: 1px; }
.stars .empty { color: var(--border); }

.rating-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--rose-pale);
    padding: 0.25rem 0.65rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--rose);
    border: 1px solid var(--rose-light);
}

/* ─── Inspection dots ─── */
.inspection-dots { display: inline-flex; gap: 3px; }
.inspection-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--sage); }
.inspection-dot.empty { background: var(--border); }

/* ─── Cards ─── */
.card-clinic {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(.4,0,.2,1);
    overflow: hidden;
}
.card-clinic:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--rose-light);
    transform: translateY(-2px);
}
.card-clinic .card-body { padding: 1.25rem; flex: 1; display: flex; flex-direction: column; }

/* ─── Equal height cards (only in card grids, not detail pages) ─── */
.row > .col-md-6.d-flex > .card-clinic,
.row > .col-lg-4.d-flex > .card-clinic,
.row > .col-md-6.d-flex > .info-card,
.row > .col-lg-4.d-flex > .info-card,
.row > .col-md-4.d-flex > .info-card,
.row > .col-md-3.d-flex > .info-card { height: 100%; display: flex; flex-direction: column; }
.d-flex > .card-clinic > .card-body,
.d-flex > .info-card > :last-child { margin-top: auto; }
.card-clinic .clinic-name { font-family: 'DM Sans', sans-serif; font-weight: 700; font-size: 0.95rem; line-height: 1.3; }
.card-clinic .clinic-name a { color: var(--text); }
.card-clinic .clinic-name a:hover { color: var(--rose); }
.card-clinic .clinic-city { color: var(--muted); font-size: 0.8rem; margin-top: 0.15rem; }

/* ─── Success Rate Ring (card) ─── */
.success-ring {
    position: relative;
    width: 58px;
    height: 58px;
    flex-shrink: 0;
}
.success-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.success-ring circle { fill: none; stroke-width: 4; }
.success-ring .ring-bg { stroke: var(--border); }
.success-ring .ring-fill { stroke: var(--rose); stroke-linecap: round; transition: stroke-dashoffset 0.6s ease; }
.success-ring .ring-label {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--rose);
    line-height: 1;
}
.success-ring .ring-label small { font-size: 0.55rem; font-weight: 500; color: var(--muted); margin-top: 1px; }

/* ─── Hero ─── */
.hero-section {
    background: linear-gradient(165deg, var(--rose-pale) 0%, #f9eef1 30%, #f0ecf3 60%, var(--cream) 100%);
    padding: 4rem 0 3.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--rose-glow) 0%, transparent 70%);
    pointer-events: none;
}
.hero-section h1 { font-size: 2.8rem; margin-bottom: 0.75rem; line-height: 1.15; }
.hero-section p { font-size: 1.1rem; color: var(--text-soft); max-width: 520px; margin: 0 auto 2rem; line-height: 1.7; }
.hero-search { max-width: 500px; margin: 0 auto; }
.hero-search .form-control {
    border-radius: 50px 0 0 50px;
    border: 2px solid var(--border);
    padding: 0.75rem 1.4rem;
    border-right: none;
    background: var(--white);
    font-size: 0.95rem;
}
.hero-search .form-control:focus { border-color: var(--rose); box-shadow: none; }
.hero-search .btn-search { border-radius: 0 50px 50px 0; padding: 0.75rem 1.6rem; }

/* ─── Stat cards (home) ─── */
.stat-card { text-align: center; padding: 1.75rem 1rem; }
.stat-card .stat-number { font-family: 'DM Serif Display', serif; font-size: 2.5rem; color: var(--rose); line-height: 1; margin-bottom: 0.3rem; }
.stat-card .stat-label { font-size: 0.82rem; color: var(--muted); font-weight: 500; }

/* ─── Detail page ─── */
.detail-hero {
    background: linear-gradient(165deg, var(--rose-pale) 0%, #f0ecf3 100%);
    padding: 2rem 0 1.75rem;
}
.detail-hero h1 { font-size: 2rem; margin-bottom: 0.3rem; }
.detail-hero .clinic-meta { color: var(--text-soft); font-size: 0.95rem; }

.section { margin-bottom: 2rem; }
.section-title { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); margin-bottom: 0.75rem; }

.info-card {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.25rem;
    transition: box-shadow 0.2s;
}
.info-card:hover { box-shadow: var(--shadow); }
.info-card h4 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1rem;
    padding-bottom: 0.65rem;
    border-bottom: 1.5px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.info-card h4 .bi { color: var(--rose); font-size: 1rem; }
.info-card .info-row { display: flex; align-items: flex-start; margin-bottom: 0.5rem; font-size: 0.88rem; gap: 0.5rem; }
.info-card .info-row i { color: var(--rose); margin-top: 2px; flex-shrink: 0; width: 18px; }

.feature-grid { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* Sample size indicator */
.sample-size { margin-top: 0.75rem; font-size: 0.78rem; text-align: center; font-weight: 500; }
.sample-size i { font-size: 0.45rem; vertical-align: middle; margin-right: 0.15rem; }
.sample-high { color: var(--sage); }
.sample-medium { color: var(--amber); }
.sample-low { color: var(--coral); }

.back-link { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--rose); font-weight: 600; font-size: 0.85rem; }

/* ─── Pagination ─── */
.pagination .page-link { color: var(--rose); border-color: var(--border-light); border-radius: var(--radius-xs); margin: 0 2px; font-size: 0.85rem; font-weight: 500; }
.pagination .page-item.active .page-link { background: var(--rose); border-color: var(--rose); color: #fff; }
.pagination .page-link:hover { background: var(--rose-pale); color: var(--rose-dark); }

/* ─── Support banner ─── */
.support-banner {
    background: linear-gradient(165deg, var(--rose-pale) 0%, var(--cream) 100%);
    padding: 2.5rem 0;
    border-top: 1px solid var(--border-light);
}
.support-photo {
    width: 120px; height: 120px; border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--white);
    box-shadow: var(--shadow-md);
    flex-shrink: 0;
}
.support-title { font-size: 1.2rem; margin-bottom: 0.4rem; }
.support-text { font-size: 0.85rem; color: var(--text-soft); line-height: 1.7; margin-bottom: 1rem; }
.support-btn { padding: 0.5rem 1.3rem; font-size: 0.88rem; }
.support-btn .bi { margin-right: 0.25rem; }

/* ─── Footer ─── */
.footer-ivf {
    background: var(--text);
    color: rgba(255,255,255,0.6);
    padding: 2.5rem 0;
    margin-top: 0;
    font-size: 0.85rem;
}
.footer-ivf a { color: var(--rose-light); }
.footer-ivf a:hover { color: #fff; }
.footer-ivf .footer-brand { font-family: 'DM Serif Display', serif; color: #fff; font-size: 1.15rem; }

/* ─── Form controls ─── */
.form-control, .form-select { font-size: 0.9rem; border-color: var(--border); border-radius: var(--radius-sm); }
.form-control:focus, .form-select:focus { border-color: var(--rose); box-shadow: 0 0 0 3px var(--rose-glow); }
.form-check-input:checked { background-color: var(--rose); border-color: var(--rose); }

/* ─── Compare button ─── */
.btn-compare {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: var(--white);
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}
.btn-compare:hover { border-color: var(--rose); color: var(--rose); background: var(--rose-pale); }
.btn-compare.active { background: var(--rose); border-color: var(--rose); color: #fff; }

/* ─── Responsive — Tablet ─── */
@media (max-width: 991.98px) {
    .hero-section { padding: 2.5rem 0 2rem; }
    .hero-section h1 { font-size: 2rem; }
    .hero-section p { font-size: 0.95rem; }
    .detail-hero h1 { font-size: 1.5rem; }
    .stat-card .stat-number { font-size: 2rem; }
    .navbar-ivf .nav-link { padding: 0.5rem 0.6rem; font-size: 0.85rem; }
    .info-card { padding: 1.25rem; }
}

/* ─── Responsive — Mobile ─── */
@media (max-width: 575.98px) {
    /* Typography */
    body { font-size: 0.92rem; }
    h1 { font-size: 1.6rem !important; }
    h2 { font-size: 1.3rem; }
    h3 { font-size: 1.15rem; }

    /* Hero */
    .hero-section { padding: 2rem 0 1.5rem; }
    .hero-section h1 { font-size: 1.6rem !important; line-height: 1.2; }
    .hero-section p { font-size: 0.88rem; margin-bottom: 1.25rem; }
    .hero-search .form-control { padding: 0.6rem 1rem; font-size: 0.88rem; }
    .hero-search .btn-search { padding: 0.6rem 1rem; font-size: 0.88rem; }

    /* Detail hero */
    .detail-hero { padding: 1.25rem 0 1rem; }
    .detail-hero h1 { font-size: 1.3rem !important; }
    .detail-hero .clinic-meta { font-size: 0.82rem; }

    /* Cards */
    .card-clinic .card-body { padding: 1rem; }
    .card-clinic .clinic-name { font-size: 0.88rem; }
    .info-card { padding: 1rem; margin-bottom: 1rem; border-radius: 12px; }
    .info-card h4 { font-size: 0.85rem; margin-bottom: 0.75rem; padding-bottom: 0.5rem; }

    /* Stats */
    .stat-card { padding: 1rem 0.5rem; }
    .stat-card .stat-number { font-size: 1.6rem; }
    .stat-card .stat-label { font-size: 0.72rem; }

    /* Tags */
    .tag { font-size: 0.68rem; padding: 0.18rem 0.5rem; }

    /* Buttons */
    .btn-rose, .btn-rose-outline { font-size: 0.85rem; padding: 0.5rem 1.1rem; }
    .btn-sm { font-size: 0.78rem !important; padding: 0.4rem 0.85rem !important; }

    /* Rating badge */
    .rating-badge { font-size: 0.72rem; padding: 0.2rem 0.5rem; }

    /* Stars */
    .stars { font-size: 0.78rem; }

    /* Success ring */
    .success-ring { width: 48px; height: 48px; }
    .success-ring .ring-label { font-size: 0.72rem; }
    .success-ring .ring-label small { font-size: 0.5rem; }

    /* Navbar mobile */
    .navbar-ivf { padding: 0.4rem 0; }
    .navbar-ivf .navbar-brand { font-size: 1.15rem; }

    /* Footer */
    .footer-ivf { padding: 1.5rem 0; margin-top: 2rem; font-size: 0.8rem; }
    .footer-ivf .footer-brand { font-size: 1rem; }

    /* Compare bar */
    .compare-bar { font-size: 0.8rem; }

    /* Pagination */
    .pagination .page-link { font-size: 0.78rem; padding: 0.3rem 0.55rem; }

    /* Tables */
    .table { font-size: 0.78rem; }
    .table th, .table td { padding: 0.4rem 0.5rem; }

    /* Feature grid tags wrap better */
    .feature-grid { gap: 0.3rem; }

    /* Full-width buttons on mobile */
    .btn-rose.btn-lg, .btn-rose-outline.btn-lg { width: 100%; }

    /* Form inputs larger touch targets */
    .form-control, .form-select { font-size: 1rem !important; padding: 0.6rem 0.85rem; min-height: 44px; }

    /* Back link */
    .back-link { font-size: 0.8rem; }

    /* Section title */
    .section-title { font-size: 0.62rem; letter-spacing: 1px; }

    /* Sample size */
    .sample-size { font-size: 0.7rem; }

    /* Inspection dots smaller */
    .inspection-dot { width: 8px; height: 8px; }
}

/* ─── Touch-friendly improvements ─── */
@media (hover: none) and (pointer: coarse) {
    /* No hover effects on touch devices */
    .card-clinic:hover { transform: none; box-shadow: var(--shadow-sm); }
    .info-card:hover { box-shadow: var(--shadow-sm); }
    .btn-rose:hover { transform: none; }

    /* Larger tap targets */
    .tag { min-height: 32px; display: inline-flex; align-items: center; }
    .btn-compare { width: 38px; height: 38px; }
    .chip { min-height: 36px; }
    .pagination .page-link { min-width: 36px; min-height: 36px; display: flex; align-items: center; justify-content: center; }
}

/* ─── Safe area for notch devices ─── */
@supports (padding: env(safe-area-inset-bottom)) {
    .compare-bar { padding-bottom: calc(0.65rem + env(safe-area-inset-bottom)); }
    .footer-ivf { padding-bottom: calc(2.5rem + env(safe-area-inset-bottom)); }
}

html { scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }
body { overflow-x: hidden; }
* { -webkit-text-size-adjust: 100%; }
