/* =====================================================================
   Matendo Medics — components.css
   Reusable components: nav, buttons, cards, forms, modals, etc.
   ===================================================================== */

/* --------- NAV --------- */
.nav-container {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    /* Heavy frosted glass — barely any tint, lots of blur, page bleeds through. */
    background: rgba(255, 255, 255, .06);
    -webkit-backdrop-filter: saturate(190%) blur(28px);
            backdrop-filter: saturate(190%) blur(28px);
    border-bottom: 1px solid transparent;
    padding: 14px var(--gutter);
    transition: background 280ms var(--ease),
                border-color 280ms var(--ease),
                box-shadow 280ms var(--ease),
                padding 280ms var(--ease);
}
.nav-container.is-scrolled {
    /* On scroll: lift tint a little for legibility but keep it heavily blurred. */
    background: rgba(255, 255, 255, .42);
    -webkit-backdrop-filter: saturate(190%) blur(36px);
            backdrop-filter: saturate(190%) blur(36px);
    border-bottom-color: rgba(229, 231, 235, .55);
    box-shadow: 0 4px 18px rgba(15, 23, 42, .04);
    padding-top: 10px; padding-bottom: 10px;
}
.nav-content {
    max-width: var(--container);
    margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--space-5);
}
.logo-img    {
    height: 50px; width: auto;
    transition: transform var(--transition), height 280ms var(--ease), filter var(--transition);
    filter: drop-shadow(0 2px 6px rgba(15, 23, 42, .08));
}
.nav-container.is-scrolled .logo-img { height: 42px; }
.logo-link:hover .logo-img { transform: scale(1.04); }

.nav-links   { display: flex; gap: 28px; align-items: center; font-size: 1rem; font-weight: 500; }
.nav-links a {
    position: relative;
    color: var(--c-text); font-weight: 500;
    padding: 8px 0;
    transition: color var(--transition);
}
.nav-links a::after {
    content: "";
    position: absolute; left: 0; right: 0; bottom: -2px;
    height: 2px; background: var(--c-primary);
    transform: scaleX(0); transform-origin: left;
    transition: transform 300ms var(--ease-out);
    border-radius: 2px;
}
.nav-links a:hover { color: var(--c-primary); text-decoration: none; }
.nav-links a:hover::after,
.nav-links a.active::after { transform: scaleX(1); }
.nav-links a.active        { color: var(--c-primary); }

.nav-cta     { display: flex; gap: var(--space-2); }

.mobile-menu-btn {
    display: none; background: transparent; border: 0;
    width: 40px; height: 40px; border-radius: 10px;
    font-size: 1.3rem; cursor: pointer; color: var(--c-text);
    transition: background var(--transition);
}
.mobile-menu-btn:hover { background: var(--c-bg-soft); }

/* Mobile drawer — compact right-side popover. Hugs its longest item so it
   never blankets the page, and uses the same frosted-glass treatment as
   the navbar so the page bleeds through. */
.mobile-menu {
    position: fixed;
    top: 68px;
    right: 10px;
    width: max-content;                         /* hug longest item */
    min-width: 150px;
    max-width: calc(100vw - 20px);
    max-height: calc(100dvh - 80px);
    z-index: 99;                                /* below nav (z:100) */
    padding: 6px;
    /* Match navbar scrolled glass: light tint, heavy blur. */
    background: rgba(255, 255, 255, .42);
    -webkit-backdrop-filter: saturate(190%) blur(28px);
            backdrop-filter: saturate(190%) blur(28px);
    border: 1px solid rgba(229, 231, 235, .55);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(15, 23, 42, .12);
    transform: translateX(110%);
    opacity: 0;
    transition: transform 320ms var(--ease-out), opacity 200ms var(--ease-out);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.mobile-menu:not([hidden]) { transform: translateX(0); opacity: 1; }

.mobile-menu a,
.mobile-menu .mobile-menu-cta {
    display: block; width: 100%;
    padding: 7px 12px;
    color: var(--c-text);
    font: inherit; font-size: .9rem; font-weight: 500;
    line-height: 1.3;
    text-align: left; white-space: nowrap;
    background: transparent; border: 0;
    border-radius: 6px;
    cursor: pointer;
    transition: color var(--transition), background var(--transition);
}
.mobile-menu a + a,
.mobile-menu a + .mobile-menu-cta,
.mobile-menu .mobile-menu-cta + .mobile-menu-cta { margin-top: 1px; }

.mobile-menu a:hover,
.mobile-menu .mobile-menu-cta:hover {
    color: var(--c-primary);
    background: rgba(255, 255, 255, .55);
    text-decoration: none;
}
.mobile-menu a.active {
    color: var(--c-primary);
    background: rgba(255, 255, 255, .55);
    box-shadow: inset 2px 0 0 var(--c-primary);
}

/* Hairline divider above the auth buttons. */
.mobile-menu .mobile-menu-cta:first-of-type {
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px solid rgba(229, 231, 235, .55);
}

@media (max-width: 920px) {
    .nav-links, .nav-cta { display: none; }
    .mobile-menu-btn     { display: inline-flex; align-items: center; justify-content: center; }
}

/* Compact navbar on phones — the desktop sizes leave a wasted band
   between the bar and the hero. Shrinking nav padding + logo brings
   page content right under the bar. */
@media (max-width: 720px) {
    .nav-container               { padding: 8px var(--gutter); }
    .nav-container.is-scrolled   { padding-top: 6px; padding-bottom: 6px; }
    .logo-img                    { height: 38px; }
    .nav-container.is-scrolled .logo-img { height: 34px; }
    .mobile-menu-btn             { width: 38px; height: 38px; font-size: 1.2rem; }
    .mobile-menu                 { top: 56px; max-height: calc(100dvh - 68px); }
}

/* --------- BUTTONS --------- */
.btn {
    position: relative; overflow: hidden;
    display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-weight: 600; font-size: .92rem;
    cursor: pointer; text-decoration: none;
    transition: transform 220ms var(--ease-out),
                background 220ms var(--ease),
                color 220ms var(--ease),
                box-shadow 280ms var(--ease-out),
                border-color 220ms var(--ease);
    line-height: 1.2;
    isolation: isolate;
}
.btn::before {
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,.35) 50%, transparent 100%);
    transform: translateX(-110%);
    transition: transform 700ms var(--ease-out);
    pointer-events: none; z-index: -1;
}
.btn:hover    { transform: translateY(-2px); text-decoration: none; }
.btn:hover::before { transform: translateX(110%); }
.btn:active   { transform: translateY(0); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-lg       { padding: 11px 20px; font-size: .98rem; border-radius: 12px; }
.btn-sm       { padding: 6px 12px; font-size: .78rem; }

.btn-primary  { background: var(--c-primary); color: #fff; box-shadow: 0 8px 22px rgba(30, 126, 124, .25); }
.btn-primary:hover  { background: var(--c-primary-dark); color: #fff; box-shadow: 0 14px 32px rgba(15, 79, 77, .35); }

.btn-outline  { background: transparent; color: var(--c-primary); border-color: var(--c-primary); }
.btn-outline:hover  { background: var(--c-primary); color: #fff; box-shadow: 0 12px 28px rgba(30, 126, 124, .25); }

.btn-ghost    { background: transparent; color: var(--c-text); }
.btn-ghost:hover { background: var(--c-bg-soft); color: var(--c-text); }

.btn-dark     { background: var(--c-ink); color: #fff; }
.btn-dark:hover { background: #000; color: #fff; box-shadow: 0 14px 32px rgba(0,0,0,.25); }

/* --------- CARDS --------- */
.card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
    transition: transform 320ms var(--ease-out), box-shadow 320ms var(--ease-out), border-color 320ms var(--ease-out);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: #d6e2e1; }

/* --------- FORMS --------- */
.field         { margin-bottom: var(--space-4); }
.field label   { display: block; font-weight: 600; margin-bottom: var(--space-2); color: var(--c-text); }

input[type="text"], input[type="email"], input[type="tel"], input[type="password"],
input[type="number"], input[type="date"], input[type="search"], input[type="file"],
select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--c-text);
    font-family: inherit; font-size: .95rem;
    transition: border var(--transition), box-shadow var(--transition);
}
input:focus, select:focus, textarea:focus {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(30, 126, 124, .15);
    outline: none;
}
textarea { resize: vertical; min-height: 80px; }

fieldset {
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: var(--space-4);
    margin: 0 0 var(--space-5);
}
legend  { padding: 0 var(--space-2); font-weight: 600; }

.checkboxes {
    display: flex; flex-wrap: wrap; gap: var(--space-3);
    margin-bottom: var(--space-3);
}
.checkboxes label {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--c-border);
    border-radius: 999px;
    background: #fff;
    cursor: pointer; font-weight: 500;
}
.checkboxes label:has(input:checked) { border-color: var(--c-primary); background: #e6f4f3; }

.radio-row { display: flex; flex-wrap: wrap; gap: var(--space-4); margin-bottom: var(--space-3); }

.checkbox-confirm {
    display: flex; gap: var(--space-3); padding: var(--space-3);
    background: var(--c-bg-alt); border-radius: var(--radius-sm);
    margin-bottom: var(--space-4);
}

.form-actions {
    display: flex; justify-content: flex-end; gap: var(--space-3);
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px solid var(--c-border);
}

.form-feedback {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-sm);
    margin-top: var(--space-4);
}
.form-feedback.success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.form-feedback.error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

.flash         { padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); margin-bottom: var(--space-4); }
.flash-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.flash-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* --------- MODAL --------- */
.modal {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, .55);
    display: flex; align-items: center; justify-content: center;
    padding: var(--space-4);
    z-index: 1000;
    animation: fadeIn 200ms ease;
}
.modal[hidden] { display: none !important; }
.modal-card {
    background: #fff;
    border-radius: var(--radius-lg);
    width: 100%; max-width: 720px;
    max-height: 90vh; overflow: auto;
    box-shadow: var(--shadow-lg);
    animation: pop 200ms ease;
}
.modal-card header {
    display: flex; justify-content: space-between; align-items: center;
    padding: var(--space-5); border-bottom: 1px solid var(--c-border);
    position: sticky; top: 0; background: #fff;
}
.modal-card form { padding: var(--space-5); }
.modal-close { background: transparent; border: 0; font-size: 1.5rem; cursor: pointer; color: var(--c-text-muted); line-height: 1; }
.modal-card-sm { max-width: 420px; }

/* Sign-in / Register popups — heavily frosted, mostly transparent.
   The .modal-auth scope keeps the bigger facility/care forms solid white. */
.modal.modal-auth {
    background: rgba(15, 23, 42, .14);
    -webkit-backdrop-filter: blur(14px);
            backdrop-filter: blur(14px);
}
.modal-auth .modal-card {
    background: rgba(255, 255, 255, .42);
    -webkit-backdrop-filter: saturate(190%) blur(40px);
            backdrop-filter: saturate(190%) blur(40px);
    border: 1px solid rgba(255, 255, 255, .55);
    box-shadow: 0 18px 50px rgba(15, 23, 42, .18);
    animation: pop 220ms var(--ease-out);
}
.modal-auth .modal-card header {
    background: transparent;
    border-bottom-color: rgba(229, 231, 235, .45);
}
/* Inputs stay solid so values remain crisp against the glass card. */
.modal-auth input, .modal-auth select, .modal-auth textarea {
    background: rgba(255, 255, 255, .85);
}
.modal-auth h3 { font-size: 1.1rem; margin: 0; }
.modal-auth form { padding: var(--space-5); }
.modal-auth .field { margin-bottom: var(--space-3); }

.linklike {
    background: transparent; border: 0; padding: 0;
    color: var(--c-primary); cursor: pointer;
    font: inherit; text-decoration: underline;
}
.linklike:hover { color: var(--c-primary-dark); }

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop    { from { transform: translateY(8px) scale(.98); opacity: 0 } to { transform: none; opacity: 1 } }

/* --------- COOKIE BANNER + BACK TO TOP --------- */
.cookie-consent {
    position: fixed; bottom: var(--space-4); left: var(--space-4); right: var(--space-4);
    background: #fff; border: 1px solid var(--c-border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--space-4) var(--space-5);
    display: flex; flex-wrap: wrap; gap: var(--space-4);
    align-items: center; justify-content: space-between;
    z-index: 999;
}
.cookie-consent[hidden] { display: none; }
.cookie-buttons { display: flex; gap: var(--space-3); }

.back-to-top {
    position: fixed; bottom: var(--space-5); right: var(--space-5);
    width: 44px; height: 44px;
    border-radius: 50%;
    background: var(--c-primary); color: #fff;
    border: 0; cursor: pointer;
    box-shadow: var(--shadow);
    display: flex; align-items: center; justify-content: center;
    z-index: 999;
}
.back-to-top[hidden] { display: none; }

/* --------- FOOTER --------- */
.footer {
    background: var(--c-ink);
    color: #cbd5e1;
    padding: var(--space-6) var(--gutter) var(--space-4);
    position: relative; overflow: hidden;
}
.footer::before {
    content: "";
    position: absolute; inset: 0;
    background: radial-gradient(60% 50% at 80% 0%, rgba(52,179,174,.18), transparent 60%),
                radial-gradient(50% 50% at 10% 100%, rgba(30,126,124,.18), transparent 65%);
    pointer-events: none;
}
.footer > * { position: relative; }
.footer-grid { max-width: var(--container); margin: 0 auto;
    display: grid; gap: var(--space-6);
    grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr; }
.footer h3 { color: #fff; font-size: 1rem; margin-bottom: var(--space-3); }
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer ul li { margin-bottom: var(--space-2); }
.footer a { color: #cbd5e1; }
.footer a:hover { color: #fff; }
.footer-logo { height: 32px; margin-bottom: var(--space-3); filter: brightness(0) invert(1); opacity: .92; }
.contact-list i { width: 18px; color: var(--c-primary-light); }
.social-icons { display: flex; gap: var(--space-3); margin-top: var(--space-3); }
.social-icons a { font-size: 1.2rem; }
.footer-bottom { border-top: 1px solid #1e293b; margin-top: var(--space-6); padding-top: var(--space-4);
    text-align: center; color: #94a3b8; }

@media (max-width: 920px) {
    .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 540px) {
    .footer-grid { grid-template-columns: 1fr; }
}
