/* ============================================================
   Freedom For Eternity Cookie Consent Styles
   File: css/cookies.css
   Used by: cookie banner + preferences modal
   ============================================================ */

/* FIX: Ensure all sizing is border-box so padding doesn't push width */
.cookie-banner,
.cookie-banner *,
.cookie-modal,
.cookie-modal * {
    box-sizing: border-box;
}

/* ===== COOKIE BANNER ===== */
.cookie-banner {
    background: #1e1e1e;
    color: #eee;
    padding: 20px 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;                    /* FIX: pin both sides instead of width:100% */
    width: 100%;
    max-width: 100vw;            /* FIX: never exceed viewport */
    overflow-x: hidden;          /* FIX: prevent inner overflow */
    z-index: 999;
    display: none;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.cookie-banner.visible {
    display: block;
    animation: cookieSlideUp 0.35s ease-out;
}

@keyframes cookieSlideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.cookie-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    width: 100%;                 /* FIX: explicit width */
}

.cookie-banner-text {
    flex: 1 1 320px;             /* FIX: allow shrink below 280px on tiny screens */
    min-width: 0;                /* FIX: allow flex child to shrink properly */
    max-width: 100%;
}

.cookie-banner-text h3 {
    font-size: 1.1rem;
    margin: 0 0 4px;
    color: #fff;
    font-weight: 600;
}

.cookie-banner-text p {
    font-size: 0.9rem;
    color: #ccc;
    margin: 0;
    line-height: 1.55;
    overflow-wrap: break-word;   /* FIX: prevent long links from overflowing */
    word-wrap: break-word;
}

.cookie-banner-learn-more {
    margin-top: 6px;
    font-size: 0.85rem;
}

.cookie-banner-learn-more a {
    color: #a67c52;
    text-decoration: none;
    transition: color 0.2s ease;
}

.cookie-banner-learn-more a:hover {
    color: #c4a077;
    text-decoration: underline;
}

.cookie-banner-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    flex-shrink: 0;
}

/* ===== COOKIE BUTTONS ===== */
.btn-cookie {
    padding: 9px 22px;
    border-radius: 30px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: inherit;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-cookie:focus-visible {
    outline: 2px solid #a67c52;
    outline-offset: 2px;
}

.btn-cookie-primary {
    background: #a67c52;
    color: #fff;
}

.btn-cookie-primary:hover {
    background: #8b6842;
    transform: translateY(-1px);
}

.btn-cookie-outline {
    background: transparent;
    border: 1px solid #777;
    color: #ddd;
}

.btn-cookie-outline:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: #aaa;
    color: #fff;
}

/* ===== COOKIE PREFERENCES MODAL ===== */
.cookie-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    animation: cookieFadeIn 0.25s ease-out;
    overflow-y: auto;            /* FIX: allow modal to scroll if too tall */
}

.cookie-modal.open {
    display: flex;
}

@keyframes cookieFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.cookie-modal-content {
    background: #fff;
    max-width: 520px;
    width: 100%;
    padding: 32px;
    border-radius: 16px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    animation: cookieScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cookieScaleIn {
    from { transform: scale(0.94); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

.cookie-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    color: #888;
    padding: 4px 8px;
    transition: color 0.2s ease;
    font-family: inherit;
}

.cookie-modal-close:hover {
    color: #333;
}

.cookie-modal h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.4rem;
    color: #2c3e50;
    margin: 0 0 8px;
    font-weight: 600;
}

.cookie-modal > .cookie-modal-content > p,
.cookie-modal-content > p {
    color: #4a4a4a;
    font-size: 0.9rem;
    margin-bottom: 20px;
    line-height: 1.6;
}

/* ===== COOKIE PREFERENCE ROWS ===== */
.cookie-preference {
    border: 1px solid #e0dcd7;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
    background: #fdfcfa;
}

.cookie-preference:last-of-type {
    margin-bottom: 0;
}

.cookie-preference-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    gap: 10px;
    flex-wrap: wrap;             /* FIX: allow badge to wrap under name on tiny screens */
}

.cookie-preference-name {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.95rem;
}

.cookie-preference-status {
    font-size: 0.75rem;
    color: #4CAF50;
    font-weight: 600;
    background: #e8f5e9;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.cookie-preference p {
    font-size: 0.85rem;
    color: #6a6a6a;
    margin: 0 0 10px;
    line-height: 1.55;
}

.cookie-preference p:last-child {
    margin-bottom: 0;
}

/* ===== TOGGLE SWITCH ===== */
.cookie-toggle {
    display: inline-block;
    position: relative;
    width: 48px;
    height: 26px;
    cursor: pointer;
    flex-shrink: 0;
}

.cookie-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.cookie-toggle-slider {
    position: absolute;
    inset: 0;
    background: #ccc;
    border-radius: 30px;
    transition: background 0.3s ease;
}

.cookie-toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.cookie-toggle input:checked + .cookie-toggle-slider {
    background: #a67c52;
}

.cookie-toggle input:checked + .cookie-toggle-slider::before {
    transform: translateX(22px);
}

.cookie-toggle input:focus-visible + .cookie-toggle-slider {
    outline: 2px solid #a67c52;
    outline-offset: 2px;
}

.cookie-toggle.disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

.cookie-toggle.disabled .cookie-toggle-slider {
    background: #a67c52;
    opacity: 0.7;
}

/* ===== SAVE BUTTON ===== */
.cookie-modal-content .btn-cookie-primary {
    display: block;
    margin-top: 20px;
    width: 100%;
    padding: 13px 22px;
    font-size: 0.95rem;
    white-space: normal;         /* FIX: allow text to wrap on tiny screens */
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
    .cookie-banner {
        padding: 16px 0;
    }

    .cookie-banner-content {
        flex-direction: column;
        text-align: center;
        gap: 14px;
        padding: 0 16px;         /* FIX: tighter padding on mobile */
    }

    .cookie-banner-text {
        flex: 1 1 auto;          /* FIX: no forced min-width on mobile */
        min-width: 0;
    }

    .cookie-banner-text h3 {
        font-size: 1rem;
    }

    .cookie-banner-text p {
        font-size: 0.85rem;
    }

    .cookie-banner-buttons {
        justify-content: center;
        width: 100%;
        flex-wrap: wrap;         /* FIX: allow buttons to wrap to a new row */
    }

    .btn-cookie {
        flex: 1 1 calc(50% - 5px);   /* FIX: two buttons per row */
        min-width: 0;
        padding: 10px 16px;
        font-size: 0.82rem;
        text-align: center;
        white-space: normal;         /* FIX: allow wrap if needed */
    }

    .cookie-modal {
        padding: 12px;
    }

    .cookie-modal-content {
        padding: 24px 20px;
        border-radius: 14px;
        max-height: 92vh;
    }

    .cookie-modal h3 {
        font-size: 1.2rem;
    }

    .cookie-preference {
        padding: 14px;
    }
}

@media (max-width: 480px) {
    .cookie-banner-content {
        padding: 0 14px;
    }

    .cookie-banner-buttons {
        flex-direction: column;      /* FIX: stack all 3 buttons vertically */
        gap: 8px;
    }

    .btn-cookie {
        width: 100%;
        flex: none;
        padding: 11px 16px;
        font-size: 0.84rem;
    }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    .cookie-banner.visible,
    .cookie-modal,
    .cookie-modal-content {
        animation: none;
    }

    .btn-cookie-primary:hover {
        transform: none;
    }
}

/* ===== HIGH CONTRAST ===== */
@media (prefers-contrast: high) {
    .cookie-banner {
        border-top: 2px solid #a67c52;
    }

    .btn-cookie-outline {
        border-color: #ccc;
    }
}

/* ============================================================
   FINAL COOKIE BANNER SIZE CONTROL
   Prevent global site CSS from enlarging cookie elements
   ============================================================ */

#cookie-banner {
    font-size: 14px;
    line-height: 1.4;
}

#cookie-banner .cookie-banner-content {
    box-sizing: border-box;
}

#cookie-banner h3 {
    font-size: 17px;
    line-height: 1.3;
    margin: 0 0 5px 0;
}

#cookie-banner p {
    font-size: 13px;
    line-height: 1.45;
    margin: 0;
}

#cookie-banner .cookie-banner-learn-more {
    font-size: 12px;
    line-height: 1.4;
    margin-top: 6px;
}

#cookie-banner .btn-cookie {
    box-sizing: border-box;
    height: auto;
    min-height: 38px;
    padding: 8px 18px;
    margin: 0;
    font-size: 13px;
    line-height: 1.2;
}

/* Desktop */
@media (min-width: 769px) {
    #cookie-banner {
        padding: 14px 0;
    }

    #cookie-banner .cookie-banner-content {
        gap: 12px;
    }
}

/* Tablet / Mobile */
@media (max-width: 768px) {
    #cookie-banner {
        padding: 12px 0;
    }

    #cookie-banner .cookie-banner-content {
        gap: 10px;
    }
}

/* Small phones */
@media (max-width: 480px) {
    #cookie-banner {
        padding: 10px 0;
    }

    #cookie-banner .cookie-banner-content {
        gap: 8px;
    }

    #cookie-banner .btn-cookie {
        min-height: 36px;
        padding: 7px 14px;
        font-size: 12px;
    }
}

/* ============================================================
   EMERGENCY OVERRIDE - COOKIE BANNER
   Completely isolate banner from website CSS
   ============================================================ */

html body #cookie-banner {
    position: fixed !important;

    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;

    width: 100vw !important;
    max-width: 100vw !important;
    min-width: 0 !important;

    height: auto !important;
    min-height: 0 !important;
    max-height: 40vh !important;

    margin: 0 !important;

    padding: 14px 0 !important;

    box-sizing: border-box !important;

    border-radius: 0 !important;

    overflow: hidden !important;

    z-index: 2147483647 !important;

    transform: none !important;
}

/* Content */
html body #cookie-banner .cookie-banner-content {
    width: 100% !important;
    max-width: 1200px !important;

    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;

    margin: 0 auto !important;
    padding: 0 20px !important;

    box-sizing: border-box !important;

    display: flex !important;
}

/* Text */
html body #cookie-banner .cookie-banner-text {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;

    flex: 1 1 320px !important;

    margin: 0 !important;
    padding: 0 !important;
}

/* Paragraphs */
html body #cookie-banner .cookie-banner-text p {
    height: auto !important;
    min-height: 0 !important;

    margin: 0 !important;
    padding: 0 !important;

    font-size: 13px !important;
    line-height: 1.4 !important;
}

/* Heading */
html body #cookie-banner .cookie-banner-text h3 {
    height: auto !important;
    margin: 0 0 5px 0 !important;
    padding: 0 !important;

    font-size: 17px !important;
    line-height: 1.3 !important;
}

/* Buttons */
html body #cookie-banner .cookie-banner-buttons {
    height: auto !important;
    min-height: 0 !important;

    margin: 0 !important;
    padding: 0 !important;

    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

html body #cookie-banner .btn-cookie {
    width: auto !important;
    height: auto !important;
    min-height: 36px !important;
    max-height: 45px !important;

    margin: 0 !important;
    padding: 8px 16px !important;

    font-size: 13px !important;
    line-height: 1.2 !important;
}