/* =====================================================
   Legal Pages — Privacy & Cookie Policy
   ===================================================== */

.legal-page { background: var(--color-bg); }

.legal-main {
    padding: 3rem 0 5rem;
    min-height: 70vh;
}

.legal-container {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header */
.legal-header {
    border-bottom: 2px solid var(--color-border);
    padding-bottom: 2rem;
    margin-bottom: 2.5rem;
}
.legal-header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--color-primary-dark);
    margin-bottom: 0.75rem;
}
.legal-meta {
    font-size: 0.9rem;
    color: var(--color-text-light);
    line-height: 1.7;
}
.legal-meta a { color: var(--color-primary-dark); }

/* Table of Contents */
.legal-toc {
    background: var(--color-bg-alt);
    border-left: 4px solid var(--color-primary);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    padding: 1.5rem 2rem;
    margin-bottom: 3rem;
}
.legal-toc h2 { font-size: 1rem; font-weight: 600; margin-bottom: 0.75rem; }
.legal-toc ol { margin: 0; padding-left: 1.25rem; }
.legal-toc li { margin-bottom: 0.35rem; font-size: 0.88rem; }
.legal-toc a { color: var(--color-primary-dark); text-decoration: none; }
.legal-toc a:hover { text-decoration: underline; }

/* Sections */
.legal-container section {
    margin-bottom: 3rem;
    scroll-margin-top: 100px;
}
.legal-container h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-primary-dark);
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0.5rem;
    margin-bottom: 1.25rem;
}
.legal-container h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 1.5rem 0 0.6rem;
    color: var(--color-text);
}
.legal-container p {
    font-size: 0.9rem;
    line-height: 1.75;
    color: var(--color-text);
    margin-bottom: 0.9rem;
}
.legal-container ul, .legal-container ol {
    padding-left: 1.4rem;
    margin-bottom: 1rem;
}
.legal-container li {
    font-size: 0.88rem;
    line-height: 1.65;
    margin-bottom: 0.4rem;
    color: var(--color-text);
}
.legal-container a { color: var(--color-primary-dark); }

/* Info box */
.info-box {
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    margin: 1rem 0;
}
.info-box p { margin: 0; font-size: 0.88rem; line-height: 1.7; }

/* Purpose grid */
.purpose-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin: 1.25rem 0;
}
.purpose-item {
    background: var(--color-bg-alt);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    border: 1px solid var(--color-border);
}
.purpose-item h4 {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--color-primary-dark);
}
.purpose-item h4 i { margin-right: 6px; }
.purpose-item p { font-size: 0.82rem; margin: 0; color: var(--color-text-light); }

/* Third-party table */
.third-party-table, .cookie-table {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin: 1.25rem 0;
    font-size: 0.82rem;
}
.tp-row, .ct-row {
    display: grid;
    grid-template-columns: 1.5fr 2fr 1fr 0.6fr;
    gap: 0;
}
.ct-row { grid-template-columns: 1.4fr 1fr 2fr 0.8fr; }
.tp-row.header, .ct-row.header {
    background: var(--color-primary-dark);
    color: white;
    font-weight: 600;
}
.tp-row > span, .ct-row > span {
    padding: 0.6rem 0.9rem;
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    line-height: 1.5;
}
.tp-row > span:last-child, .ct-row > span:last-child { border-right: none; }
.tp-row:nth-child(even), .ct-row:nth-child(even) { background: var(--color-bg-alt); }
.ct-section-title {
    background: rgba(120, 177, 207, 0.15);
    color: var(--color-primary-dark);
    font-weight: 600;
    font-size: 0.78rem;
    padding: 0.4rem 0.9rem;
    border-bottom: 1px solid var(--color-border);
    grid-column: 1 / -1;
}
.cookie-table .ct-section-title { display: block; }
code {
    background: rgba(120,177,207,0.15);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.85em;
}
.tp-note {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    margin-top: 0.5rem;
    font-style: italic;
}
.tp-note i { color: var(--color-primary); margin-right: 4px; }

/* Link-style button */
.link-btn {
    background: none;
    border: none;
    color: var(--color-primary-dark);
    text-decoration: underline;
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
    padding: 0;
}

@media (max-width: 640px) {
    .tp-row, .ct-row { grid-template-columns: 1fr 1fr; }
    .tp-row.header > span:nth-child(3),
    .tp-row.header > span:nth-child(4),
    .ct-row.header > span:nth-child(3),
    .ct-row.header > span:nth-child(4) { display: none; }
    .tp-row > span:nth-child(3),
    .tp-row > span:nth-child(4),
    .ct-row > span:nth-child(3),
    .ct-row > span:nth-child(4) { display: none; }
    .purpose-grid { grid-template-columns: 1fr; }
    .legal-header h1 { font-size: 1.6rem; }
}


/* =====================================================
   Cookie Consent Banner
   ===================================================== */

#cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: rgba(15, 30, 45, 0.97);
    color: rgba(255,255,255,0.92);
    padding: 1.25rem 1.5rem;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.35);
    display: none;
    animation: slideUp 0.35s ease;
}
#cookie-banner.visible { display: block; }

/* Persistent floating button (bottom-left) to reopen cookie preferences.
   GDPR: withdrawing consent must be as easy as giving it. Sits below the
   banner/modal (z 9999/10000) and clear of the concierge widget (bottom-right). */
.cookie-settings-btn {
    position: fixed;
    left: 20px;
    bottom: 20px;
    z-index: 9990;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: #5A9ABC;
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background 0.2s ease;
}
.cookie-settings-btn:hover { background: #4a89ab; transform: scale(1.08); }
.cookie-settings-btn:focus-visible { outline: 3px solid #5A9ABC; outline-offset: 2px; }
@media (max-width: 600px) {
    .cookie-settings-btn { width: 40px; height: 40px; left: 14px; bottom: 14px; font-size: 16px; }
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.cookie-banner-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.cookie-banner-text {
    flex: 1;
    min-width: 260px;
}
.cookie-banner-text p {
    font-size: 0.83rem;
    line-height: 1.6;
    margin: 0;
    color: rgba(255,255,255,0.82);
}
.cookie-banner-text a { color: var(--color-primary-light); }
.cookie-banner-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}
.cookie-btn {
    padding: 0.55rem 1.2rem;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    font-family: var(--font-primary);
    white-space: nowrap;
}
.cookie-btn-accept {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}
.cookie-btn-accept:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); }
.cookie-btn-reject {
    /* Equal prominence to "Accept all" (EDPB/CNIL guidance): a solid, full-weight
       button of the same size — a distinct colour, but not visually demoted. */
    background: #ffffff;
    color: #1a1a1a;
    border-color: #ffffff;
}
.cookie-btn-reject:hover { background: rgba(255,255,255,0.85); border-color: rgba(255,255,255,0.85); color: #1a1a1a; }
.cookie-btn-manage {
    background: transparent;
    color: var(--color-primary-light);
    border-color: var(--color-primary-light);
    font-size: 0.78rem;
}
.cookie-btn-manage:hover { background: var(--color-primary-light); color: #1a1a1a; }


/* =====================================================
   Cookie Preferences Modal
   ===================================================== */

#cookie-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.6);
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
#cookie-modal.visible { display: flex; }

.cookie-modal-box {
    background: white;
    border-radius: var(--radius-lg);
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: fadeInScale 0.25s ease;
}
@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

.cookie-modal-header {
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.cookie-modal-header h3 { font-size: 1.1rem; font-weight: 700; color: var(--color-text); margin: 0; }
.cookie-modal-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 4px 8px;
    border-radius: 4px;
}
.cookie-modal-close:hover { background: var(--color-bg-alt); }

.cookie-modal-body { padding: 1.25rem 1.5rem; }

.cookie-pref-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--color-border);
}
.cookie-pref-item:last-child { border-bottom: none; }
.cookie-pref-info { flex: 1; }
.cookie-pref-info strong { font-size: 0.9rem; display: block; margin-bottom: 0.25rem; }
.cookie-pref-info p { font-size: 0.78rem; color: var(--color-text-muted); margin: 0; line-height: 1.5; }

/* Toggle switch */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    margin-top: 2px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    inset: 0;
    background: #ccc;
    border-radius: 24px;
    cursor: pointer;
    transition: background 0.2s;
}
.toggle-slider:before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--color-primary); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(20px); }
.toggle-switch input:disabled + .toggle-slider { opacity: 0.6; cursor: not-allowed; }

.cookie-modal-footer {
    padding: 1rem 1.5rem 1.5rem;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    border-top: 1px solid var(--color-border);
    flex-wrap: wrap;
}

@media (max-width: 600px) {
    .cookie-banner-inner { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .cookie-banner-actions { width: 100%; }
    .cookie-btn { flex: 1; text-align: center; }
}
