/* Cookie Magic Zero Banner Styles */
.cm-banner {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 350px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 20px;
    border-radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    z-index: 99998;
    border: 1px solid #e5e5e5;
}

.cm-hidden {
    display: none !important;
}

.cm-banner-content h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 18px;
    font-weight: 700;
    /* Bold title */
    color: #333;
}

.cm-banner-content p,
.cm-banner-message {
    font-size: 14px;
    color: #555;
    /* Matches typical text button color */
    margin-bottom: 20px;
    line-height: 1.5;
}

.cm-banner-message a {
    color: #0073aa;
    text-decoration: underline;
    font-weight: 600;
}

.cm-banner-message a:hover {
    color: #005177;
}

/* Privacy Policy links (from Settings > Privacy Policy Links) */
.cm-banner .cm-privacy-links {
    margin: 0 0 16px 0;
    font-size: 13px;
}
.cm-banner .cm-privacy-links a {
    color: #0073aa;
    text-decoration: underline;
}

/* Modal Content Links */
.cm-content-inner p a {
    color: #0073aa;
    text-decoration: underline;
    font-weight: 600;
}

.cm-content-inner p a:hover {
    color: #005177;
}

.cm-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
}

.cm-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    flex: 1;
}

#cm-btn-manage {
    flex-basis: 100%;
    background: transparent;
    color: #555;
    text-decoration: underline;
    margin-top: 5px;
    font-weight: normal;
}

.cm-btn-primary {
    background: #0073aa;
    color: #fff;
}

.cm-btn-primary:hover {
    background: #005177;
}

.cm-btn-secondary {
    background: #f1f1f1;
    color: #333;
}

.cm-btn-secondary:hover {
    background: #e1e1e1;
}

/* GDPR: Deny must have equal prominence to Accept (no visual nudge) */
.cm-banner[data-consent-mode="gdpr"] #cm-btn-deny {
    background: #1d2327;
    color: #fff;
}

.cm-banner[data-consent-mode="gdpr"] #cm-btn-deny:hover {
    background: #2c3338;
}

#cm-btn-do-not-sell {
    white-space: normal;
    text-align: center;
    line-height: 1.3;
}

.cm-btn-necessary {
    background: #5b9dd9;
    /* Soft Intermediate Blue */
    color: #fff;
}

.cm-btn-necessary:hover {
    background: #4a8cc7;
}

/* --- Modal Styles --- */
.cm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cm-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
}

.cm-modal-container {
    position: relative;
    background: #fff;
    width: 900px;
    max-width: 95%;
    height: 700px;
    max-height: 90vh;
    border-radius: 6px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Modal Header */
.cm-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #dcdcdc;
    background: #fff;
    flex-shrink: 0;
}

.cm-modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #333;
}

.cm-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #777;
    padding: 0;
}

/* Modal Body */
.cm-modal-body {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #f8f9fa;
    display: flex;
}

.cm-preference-list {
    width: 280px;
    background: #f1f2f3;
    border-right: 1px solid #dcdcdc;
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
}

/* Item Structure */
.cm-pref-item {
    display: block;
}

/* Sidebar Headers */
.cm-pref-header {
    padding: 15px 20px;
    cursor: pointer;
    border-bottom: 1px solid #e0e0e0;
    font-size: 14px;
    color: #555;
    background: #f1f2f3;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cm-pref-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
}

.cm-pref-header:hover {
    background: #e9ecef;
}

.cm-pref-item.active .cm-pref-header {
    background: #808080;
    /* Updated: Dark Grey */
    border-left: 4px solid #0073aa;
    padding-left: 16px;
    font-weight: 700;
    color: #fff;
    /* Updated: White Text */
    border-right: 1px solid #fff;
    margin-right: -1px;
}

.cm-pref-item.active .cm-pref-header h3 {
    color: #fff;
    /* Ensure title inherits white */
}

.cm-mobile-status {
    display: none;
    font-size: 11px;
    color: #0073aa;
}

/* Content Panel (Desktop - Absolute Right) */
.cm-pref-content {
    display: none;
    position: absolute;
    top: 0;
    left: 280px;
    right: 0;
    bottom: 0;
    background: #fff;
    padding: 30px;
    overflow-y: auto;
    animation: fadeIn 0.2s ease;
}

.cm-pref-item.active .cm-pref-content {
    display: block;
}

.cm-content-inner {
    max-width: 800px;
}

.cm-content-inner h3 {
    margin-top: 0;
    font-size: 20px;
    color: #333;
    margin-bottom: 15px;
    display: none;
}

/* Panel Header */
.cm-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    margin-bottom: 15px;
}

.cm-panel-header h3 {
    display: block;
    margin: 0;
    font-size: 18px;
}

.cm-content-inner p {
    font-size: 14px;
    line-height: 1.6;
    color: #555;
}

.cm-always-active {
    color: #0073aa;
    font-weight: 600;
    font-size: 13px;
}


/* Toggle Switch */
.cm-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.cm-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.cm-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.cm-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.cm-slider {
    background-color: #0073aa;
}

input:focus+.cm-slider {
    box-shadow: 0 0 1px #0073aa;
}

input:checked+.cm-slider:before {
    transform: translateX(18px);
}


/* Modal Footer */
.cm-modal-footer {
    padding: 15px 25px;
    border-top: 1px solid #dcdcdc;
    background: #fff;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.cm-footer-actions {
    width: 100%;
    display: flex;
    justify-content: flex-end;
}

#cm-btn-save-preferences {
    width: 25%;
    min-width: 150px;
    background: #0073aa;
    color: #fff;
    border-radius: 4px;
    padding: 10px;
    font-size: 14px;
}

.cm-powered-by {
    font-size: 11px;
    color: #aaa;
    margin-top: 8px;
    text-align: right;
}

/* --- Mobile View --- */
@media (max-width: 768px) {
    .cm-modal {
        align-items: flex-end;
        /* Or align-items: stretch to fill */
    }

    .cm-modal-container {
        width: 100%;
        height: 100vh;
        /* Full Height Override */
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
    }

    .cm-modal-body {
        display: block;
        /* Stack vertically */
        overflow-y: auto;
        flex: 1;
    }

    .cm-preference-list {
        width: 100%;
        border-right: none;
        background: #fff;
    }

    .cm-pref-header {
        background: #fff;
        border-bottom: 1px solid #eee;
        padding: 15px;
    }

    .cm-pref-item.active .cm-pref-header {
        background: #808080;
        /* Match desktop active style */
        border-left: none;
        padding-left: 15px;
        border-right: none;
        color: #fff;
        border-bottom: 1px solid #e0e0e0;
    }

    /* Reveal Content Inline (Accordion) */
    .cm-pref-content {
        position: static;
        width: 100%;
        padding: 15px;
        background: #f9f9f9;
        display: none;
        border-bottom: 1px solid #eee;
    }

    .cm-pref-item.active .cm-pref-content {
        display: block;
    }

    .cm-panel-header {
        margin-top: 0;
    }

    .cm-mobile-status {
        display: block;
    }

    #cm-btn-save-preferences {
        width: 100%;
    }

    .cm-powered-by {
        text-align: center;
        width: 100%;
    }
}

/* --- Minimized Widget --- */
.cm-minimized-widget {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
    background: #fff;
    color: #333;
    border: 1px solid #ddd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 10px 15px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cm-minimized-widget:hover {
    background: #f9f9f9;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.cm-minimized-widget.cm-hidden {
    display: none !important;
}

/* Mobile responsive for widget */
@media (max-width: 600px) {
    .cm-minimized-widget {
        bottom: 15px;
        left: 15px;
        padding: 8px 12px;
        font-size: 12px;
    }
}

/* --- Dark mode (banner + modal) --- */
.cm-banner.cm-theme-dark,
.cm-modal.cm-theme-dark .cm-modal-container {
    background: #1d2327;
    border-color: #2c3338;
    color: #e0e0e0;
}

.cm-banner.cm-theme-dark .cm-banner-content h3,
.cm-banner.cm-theme-dark .cm-banner-message,
.cm-modal.cm-theme-dark .cm-modal-header h2,
.cm-modal.cm-theme-dark .cm-content-inner p,
.cm-modal.cm-theme-dark .cm-panel-header h3 {
    color: #e0e0e0;
}

.cm-banner.cm-theme-dark .cm-banner-message a,
.cm-banner.cm-theme-dark .cm-privacy-links a,
.cm-modal.cm-theme-dark .cm-content-inner p a,
.cm-modal.cm-theme-dark .cm-always-active {
    color: #72aee6;
}

.cm-banner.cm-theme-dark #cm-btn-manage,
.cm-modal.cm-theme-dark .cm-close-btn {
    color: #a7aaad;
}

.cm-modal.cm-theme-dark .cm-modal-header,
.cm-modal.cm-theme-dark .cm-modal-footer {
    background: #1d2327;
    border-color: #2c3338;
}

.cm-modal.cm-theme-dark .cm-modal-body {
    background: #2c3338;
}

.cm-modal.cm-theme-dark .cm-preference-list {
    background: #1d2327;
    border-color: #2c3338;
}

.cm-modal.cm-theme-dark .cm-pref-header {
    background: #1d2327;
    border-color: #2c3338;
    color: #e0e0e0;
}

.cm-modal.cm-theme-dark .cm-pref-header:hover {
    background: #2c3338;
}

.cm-modal.cm-theme-dark .cm-pref-item.active .cm-pref-header {
    background: #50575e;
    border-left-color: #72aee6;
    color: #fff;
}

.cm-modal.cm-theme-dark .cm-pref-content {
    background: #2c3338;
}

.cm-modal.cm-theme-dark .cm-panel-header {
    border-color: #3c434a;
}

.cm-modal.cm-theme-dark .cm-switch .cm-slider {
    background-color: #50575e;
}

.cm-modal.cm-theme-dark input:checked + .cm-slider {
    background-color: #72aee6;
}

.cm-modal.cm-theme-dark .cm-powered-by {
    color: #a7aaad;
}

.cm-banner.cm-theme-dark .cm-btn-secondary {
    background: #3c434a;
    color: #e0e0e0;
}

.cm-banner.cm-theme-dark .cm-btn-secondary:hover {
    background: #50575e;
}

.cm-banner.cm-theme-dark[data-consent-mode="gdpr"] #cm-btn-deny {
    background: #3c434a;
}

.cm-banner.cm-theme-dark[data-consent-mode="gdpr"] #cm-btn-deny:hover {
    background: #50575e;
}

.cm-minimized-widget.cm-theme-dark {
    background: #1d2327;
    color: #e0e0e0;
    border-color: #2c3338;
}

.cm-minimized-widget.cm-theme-dark:hover {
    background: #2c3338;
}

/* Auto: follow system preference */
@media (prefers-color-scheme: dark) {
    .cm-banner.cm-theme-auto,
    .cm-modal.cm-theme-auto .cm-modal-container {
        background: #1d2327;
        border-color: #2c3338;
        color: #e0e0e0;
    }

    .cm-banner.cm-theme-auto .cm-banner-content h3,
    .cm-banner.cm-theme-auto .cm-banner-message,
    .cm-modal.cm-theme-auto .cm-modal-header h2,
    .cm-modal.cm-theme-auto .cm-content-inner p,
    .cm-modal.cm-theme-auto .cm-panel-header h3 {
        color: #e0e0e0;
    }

    .cm-banner.cm-theme-auto .cm-banner-message a,
    .cm-banner.cm-theme-auto .cm-privacy-links a,
    .cm-modal.cm-theme-auto .cm-content-inner p a,
    .cm-modal.cm-theme-auto .cm-always-active {
        color: #72aee6;
    }

    .cm-banner.cm-theme-auto #cm-btn-manage,
    .cm-modal.cm-theme-auto .cm-close-btn {
        color: #a7aaad;
    }

    .cm-modal.cm-theme-auto .cm-modal-header,
    .cm-modal.cm-theme-auto .cm-modal-footer {
        background: #1d2327;
        border-color: #2c3338;
    }

    .cm-modal.cm-theme-auto .cm-modal-body {
        background: #2c3338;
    }

    .cm-modal.cm-theme-auto .cm-preference-list {
        background: #1d2327;
        border-color: #2c3338;
    }

    .cm-modal.cm-theme-auto .cm-pref-header {
        background: #1d2327;
        border-color: #2c3338;
        color: #e0e0e0;
    }

    .cm-modal.cm-theme-auto .cm-pref-header:hover {
        background: #2c3338;
    }

    .cm-modal.cm-theme-auto .cm-pref-item.active .cm-pref-header {
        background: #50575e;
        border-left-color: #72aee6;
        color: #fff;
    }

    .cm-modal.cm-theme-auto .cm-pref-content {
        background: #2c3338;
    }

    .cm-modal.cm-theme-auto .cm-panel-header {
        border-color: #3c434a;
    }

    .cm-modal.cm-theme-auto .cm-switch .cm-slider {
        background-color: #50575e;
    }

    .cm-modal.cm-theme-auto input:checked + .cm-slider {
        background-color: #72aee6;
    }

    .cm-modal.cm-theme-auto .cm-powered-by {
        color: #a7aaad;
    }

    .cm-banner.cm-theme-auto .cm-btn-secondary {
        background: #3c434a;
        color: #e0e0e0;
    }

    .cm-banner.cm-theme-auto .cm-btn-secondary:hover {
        background: #50575e;
    }

    .cm-banner.cm-theme-auto[data-consent-mode="gdpr"] #cm-btn-deny {
        background: #3c434a;
    }

    .cm-banner.cm-theme-auto[data-consent-mode="gdpr"] #cm-btn-deny:hover {
        background: #50575e;
    }

    .cm-minimized-widget.cm-theme-auto {
        background: #1d2327;
        color: #e0e0e0;
        border-color: #2c3338;
    }

    .cm-minimized-widget.cm-theme-auto:hover {
        background: #2c3338;
    }
}