/* ==========================================================================
   Cardel Cookie Consent Banner & Preferences Modal
   Matches CookieYes design from live site (www1.cardelhomes.com)
   Prefix: cardel-cc-
   ========================================================================== */

/* ---------- Banner (bottom-left popup) ---------- */
.cardel-cc-banner {
    position: fixed;
    bottom: 12px;
    left: 12px;
    z-index: 9999;
    background: #fff;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
    border-radius: 6px;
    padding: 24px 28px;
    width: 440px;
    max-width: calc(100vw - 24px);
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    line-height: 1.55;
    color: #555;
    transform: translateY(120%);
    transition: transform 0.4s ease;
}

.cardel-cc-banner[aria-hidden="false"] {
    transform: translateY(0);
}

.cardel-cc-banner-heading {
    font-size: 18px;
    font-weight: 700;
    color: #212529;
    margin: 0 0 10px;
}

.cardel-cc-banner-text {
    margin: 0 0 16px;
}

.cardel-cc-banner-text p {
    margin: 0;
    color: #555;
    font-size: 14px;
    line-height: 1.55;
}

.cardel-cc-banner-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Shared button base */
.cardel-cc-btn {
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: 500;
    padding: 9px 22px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s, opacity 0.2s;
    white-space: nowrap;
    line-height: 1.4;
}

.cardel-cc-btn:focus-visible {
    outline: 2px solid #333;
    outline-offset: 2px;
}

/* Accept / Accept All — green filled (5.21:1 contrast ratio, WCAG AA) */
.cardel-cc-btn-accept {
    background: #3d7a34;
    color: #fff;
    border: 1px solid #3d7a34;
}

.cardel-cc-btn-accept:hover {
    background: #357030;
    border-color: #357030;
}

/* Reject All — green filled (same as accept) */
.cardel-cc-btn-reject {
    background: #3d7a34;
    color: #fff;
    border: 1px solid #3d7a34;
}

.cardel-cc-btn-reject:hover {
    background: #357030;
    border-color: #357030;
}

/* Save My Preferences — white outlined */
.cardel-cc-btn-save {
    background: #fff;
    color: #333;
    border: 1px solid #ccc;
}

.cardel-cc-btn-save:hover {
    background: #f5f5f5;
    border-color: #999;
}

/* Customize — text link style */
.cardel-cc-btn-manage {
    background: none;
    border: none;
    color: #555;
    text-decoration: underline;
    padding: 9px 4px;
    font-size: 14px;
}

.cardel-cc-btn-manage:hover {
    color: #222;
}

/* ---------- Modal overlay ---------- */
.cardel-cc-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cardel-cc-modal-overlay[aria-hidden="false"] {
    opacity: 1;
    visibility: visible !important;
}

/* ---------- Modal dialog ---------- */
.cardel-cc-modal {
    background: #fff;
    border-radius: 6px;
    width: 90%;
    max-width: 520px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    font-family: 'Roboto', sans-serif;
    color: #333;
}

.cardel-cc-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 22px 24px 0;
}

.cardel-cc-modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #212529;
}

.cardel-cc-modal-close {
    background: none;
    border: none;
    font-size: 26px;
    cursor: pointer;
    color: #888;
    padding: 0 4px;
    line-height: 1;
    border-radius: 4px;
    flex-shrink: 0;
}

.cardel-cc-modal-close:hover {
    color: #333;
}

.cardel-cc-modal-close:focus-visible {
    outline: 2px solid #333;
    outline-offset: 2px;
}

/* Description text */
.cardel-cc-modal-desc {
    padding: 12px 24px 16px;
    font-size: 14px;
    color: #555;
    line-height: 1.55;
}

.cardel-cc-modal-desc p {
    margin: 0;
}

.cardel-cc-modal-desc-text {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cardel-cc-modal-desc-text.cardel-cc-expanded {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
}

.cardel-cc-show-more {
    background: none;
    border: none;
    padding: 4px 0 0;
    font-size: 13px;
    color: #555;
    text-decoration: underline;
    cursor: pointer;
    font-family: 'Roboto', sans-serif;
}

.cardel-cc-show-more:hover {
    color: #222;
}

/* ---------- Category list (scrollable) ---------- */
.cardel-cc-modal-body {
    padding: 0;
    overflow-y: auto;
    flex: 1 1 auto;
    border-top: 1px solid #e8e8e8;
    border-bottom: 1px solid #e8e8e8;
}

/* ---------- Category row (accordion) ---------- */
.cardel-cc-category {
    border-bottom: 1px solid #e8e8e8;
}

.cardel-cc-category:last-child {
    border-bottom: none;
}

.cardel-cc-category-header {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    cursor: pointer;
    user-select: none;
    gap: 10px;
}

.cardel-cc-category-header:hover {
    background: #fafafa;
}

/* Chevron */
.cardel-cc-chevron {
    width: 10px;
    height: 10px;
    border-right: 2px solid #888;
    border-bottom: 2px solid #888;
    transform: rotate(-45deg);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.cardel-cc-category.cardel-cc-open .cardel-cc-chevron {
    transform: rotate(45deg);
}

.cardel-cc-category-name {
    font-size: 14px;
    font-weight: 600;
    color: #212529;
    flex: 1;
}

/* Status label */
.cardel-cc-status {
    font-size: 13px;
    color: #888;
    margin-right: 8px;
    white-space: nowrap;
}

.cardel-cc-status-enabled {
    color: #3d7a34;
    font-weight: 500;
}

/* ---------- Toggle switch ---------- */
.cardel-cc-toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

.cardel-cc-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.cardel-cc-toggle-slider {
    position: absolute;
    inset: 0;
    background: #ccc;
    border-radius: 22px;
    cursor: pointer;
    transition: background-color 0.25s ease;
}

.cardel-cc-toggle-slider::before {
    content: '';
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.25s ease;
}

.cardel-cc-toggle input:checked + .cardel-cc-toggle-slider {
    background: #3d7a34;
}

.cardel-cc-toggle input:checked + .cardel-cc-toggle-slider::before {
    transform: translateX(18px);
}

.cardel-cc-toggle input:focus-visible + .cardel-cc-toggle-slider {
    outline: 2px solid #333;
    outline-offset: 2px;
}

/* Necessary — no toggle, just "Always Enabled" label */

/* ---------- Accordion content (hidden by default) ---------- */
.cardel-cc-category-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
    padding: 0 20px 0 42px;
}

.cardel-cc-category.cardel-cc-open .cardel-cc-category-content {
    max-height: 200px;
    padding-bottom: 14px;
}

.cardel-cc-category-desc {
    margin: 0;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

/* ---------- Modal footer ---------- */
.cardel-cc-modal-footer {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 16px 20px;
    flex-shrink: 0;
}

.cardel-cc-modal-footer .cardel-cc-btn {
    flex: 1;
    text-align: center;
    border-radius: 4px;
    padding: 10px 12px;
    font-size: 13px;
}

.cardel-cc-modal-footer .cardel-cc-btn + .cardel-cc-btn {
    margin-left: 8px;
}

/* ---------- Body scroll lock ---------- */
.cardel-cc-no-scroll {
    overflow: hidden;
}

/* ---------- Responsive ---------- */
@media (max-width: 520px) {
    .cardel-cc-banner {
        bottom: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 0;
        padding: 20px 20px 16px;
    }

    .cardel-cc-banner-actions {
        flex-direction: column;
        align-items: center;
        gap: 4px;
    }

    .cardel-cc-btn-manage {
        order: -1;
    }

    .cardel-cc-banner-actions .cardel-cc-btn-accept {
        width: 100%;
        text-align: center;
    }

    .cardel-cc-modal {
        width: 95%;
        max-height: 90vh;
    }

    .cardel-cc-modal-footer {
        flex-direction: column;
        gap: 0;
        padding: 12px 16px 16px;
    }

    .cardel-cc-modal-footer .cardel-cc-btn {
        width: 100%;
        border-radius: 4px;
    }

    .cardel-cc-modal-footer .cardel-cc-btn + .cardel-cc-btn {
        margin-left: 0;
        margin-top: 8px;
    }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .cardel-cc-banner,
    .cardel-cc-modal-overlay,
    .cardel-cc-toggle-slider,
    .cardel-cc-toggle-slider::before,
    .cardel-cc-chevron,
    .cardel-cc-category-content {
        transition: none;
    }
}
