
/* ==========================================================
   FERN HILL EDUCATION GROUP — COOKIE CONSENT
   ========================================================== */

:root {
    --fh-cookie-green: #123d35;
    --fh-cookie-green-hover: #0b2f29;
    --fh-cookie-ochre: #d9a62e;
    --fh-cookie-text: #24342f;
    --fh-cookie-muted: #62716b;
    --fh-cookie-border: #dce3df;
    --fh-cookie-surface: #ffffff;
    --fh-cookie-soft: #f3f6f3;
}

/* Bottom-positioned modal */
.fh-cookie-modal {
    --bs-modal-bg: transparent;
    --bs-modal-border-width: 0;
    --bs-modal-box-shadow: 0 12px 50px rgba(0, 0, 0, .2);

    padding: 0 !important;
    overflow-y: auto;
}

.fh-cookie-dialog {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    pointer-events: none;
    transform: none !important;
}

.fh-cookie-modal .modal-content {
    pointer-events: auto;
}

.fh-cookie-content {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    padding: 24px 28px 22px;
    color: var(--fh-cookie-text);
    background: var(--fh-cookie-surface);
    border: 1px solid rgba(18, 61, 53, .12);
    border-top: 5px solid var(--fh-cookie-ochre);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, .16);
}

.fh-cookie-modal .modal-dialog {
    min-height: 0;
}

/* Header */
.fh-cookie-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.fh-cookie-icon {
    display: flex;
    flex: 0 0 46px;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    color: #fff;
    background: var(--fh-cookie-green);
    border-radius: 12px;
}

.fh-cookie-title {
    margin: 0;
    color: var(--fh-cookie-green);
    font-family: inherit;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.25;
}

.fh-cookie-subtitle {
    margin: 4px 0 0;
    color: var(--fh-cookie-muted);
    font-size: .85rem;
}

/* Main content */
.fh-cookie-body {
    margin-bottom: 20px;
    font-size: .95rem;
    line-height: 1.6;
}

.fh-cookie-body p {
    margin-bottom: 10px;
}

.fh-cookie-body p:last-child {
    margin-bottom: 0;
}

.fh-cookie-policy-link a {
    color: var(--fh-cookie-green);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.fh-cookie-policy-link a:hover {
    color: var(--fh-cookie-green-hover);
}

.fh-cookie-policy-link a:focus-visible {
    outline: 3px solid var(--fh-cookie-ochre);
    outline-offset: 3px;
}

/* Action buttons */
.fh-cookie-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

.fh-cookie-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 650;
    line-height: 1.35;
    transition: background-color .15s ease, border-color .15s ease;
}

.fh-cookie-btn-primary {
    color: #fff;
    background: var(--fh-cookie-green);
    border: 1px solid var(--fh-cookie-green);
}

.fh-cookie-btn-primary:hover,
.fh-cookie-btn-primary:focus {
    color: #fff;
    background: var(--fh-cookie-green-hover);
    border-color: var(--fh-cookie-green-hover);
}

.fh-cookie-btn-outline {
    color: var(--fh-cookie-green);
    background: #fff;
    border: 1px solid var(--fh-cookie-green);
}

.fh-cookie-btn-outline:hover,
.fh-cookie-btn-outline:focus {
    color: var(--fh-cookie-green);
    background: var(--fh-cookie-soft);
    border-color: var(--fh-cookie-green-hover);
}

.fh-cookie-btn-text {
    color: var(--fh-cookie-green);
    background: transparent;
    border: 1px solid transparent;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.fh-cookie-btn-text:hover,
.fh-cookie-btn-text:focus {
    color: var(--fh-cookie-green-hover);
    background: var(--fh-cookie-soft);
}

.fh-cookie-btn:focus-visible,
.fh-cookie-toggle input:focus-visible + .fh-cookie-toggle-track {
    outline: 3px solid var(--fh-cookie-ochre);
    outline-offset: 3px;
}

/* Preference categories */
.fh-cookie-preference-list {
    margin-bottom: 16px;
}

.fh-cookie-category {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 15px 0;
    border-bottom: 1px solid var(--fh-cookie-border);
}

.fh-cookie-category:first-child {
    padding-top: 0;
}

.fh-cookie-category-copy {
    flex: 1 1 auto;
}

.fh-cookie-category h3 {
    margin: 0 0 5px;
    color: var(--fh-cookie-green);
    font-size: 1rem;
    font-weight: 700;
}

.fh-cookie-category p {
    margin: 0;
    color: var(--fh-cookie-muted);
    font-size: .88rem;
    line-height: 1.5;
}

/* Toggle controls */
.fh-cookie-toggle {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 9px;
    cursor: pointer;
}

.fh-cookie-toggle input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.fh-cookie-toggle-track {
    position: relative;
    display: inline-block;
    flex: 0 0 42px;
    width: 42px;
    height: 24px;
    background: #cbd3ce;
    border: 1px solid #aab5ae;
    border-radius: 99px;
    transition: background-color .15s ease;
}

.fh-cookie-toggle-track::after {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    content: "";
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
    transition: transform .15s ease;
}

.fh-cookie-toggle input:checked + .fh-cookie-toggle-track {
    background: var(--fh-cookie-green);
    border-color: var(--fh-cookie-green);
}

.fh-cookie-toggle input:checked + .fh-cookie-toggle-track::after {
    transform: translateX(18px);
}

.fh-cookie-toggle-label {
    min-width: 64px;
    color: var(--fh-cookie-muted);
    font-size: .8rem;
}

.fh-cookie-toggle-locked {
    cursor: not-allowed;
}

.fh-cookie-toggle-locked .fh-cookie-toggle-track {
    opacity: .8;
}

.fh-cookie-note {
    margin: 14px 0 0;
    color: var(--fh-cookie-muted);
    font-size: .82rem;
    line-height: 1.5;
}

.fh-cookie-preference-actions {
    grid-template-columns: 1.3fr 1.3fr .7fr;
}

/* Hidden preference screen must remain hidden */
.fh-cookie-content [hidden] {
    display: none !important;
}

/* Bootstrap backdrop */
.modal-backdrop.show {
    opacity: .35;
}

/* Mobile layout */
@media (max-width: 575.98px) {
    .fh-cookie-content {
        max-width: none;
        padding: 20px 18px max(18px, env(safe-area-inset-bottom));
        border-radius: 14px 14px 0 0;
    }

    .fh-cookie-header {
        gap: 11px;
        margin-bottom: 12px;
    }

    .fh-cookie-icon {
        flex-basis: 40px;
        width: 40px;
        height: 40px;
    }

    .fh-cookie-title {
        font-size: 1.15rem;
    }

    .fh-cookie-body {
        font-size: .9rem;
        margin-bottom: 16px;
    }

    .fh-cookie-actions,
    .fh-cookie-preference-actions {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .fh-cookie-btn {
        width: 100%;
        min-height: 44px;
    }

    .fh-cookie-category {
        align-items: flex-start;
        gap: 12px;
    }

    .fh-cookie-toggle {
        padding-top: 2px;
    }

    .fh-cookie-toggle-label {
        display: none;
    }

    .fh-cookie-modal {
        overflow-y: auto;
    }

    .fh-cookie-dialog {
        max-height: 100%;
    }

    .fh-cookie-content {
        max-height: 90dvh;
        overflow-y: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .fh-cookie-toggle-track,
    .fh-cookie-toggle-track::after,
    .fh-cookie-btn {
        transition: none;
    }
}
