/* Cookie Consent Styles */
:root {
    --cc-card-bg-color: #FFFFFF;
    --cc-card-text-color: #000000;
    --cc-button-bg-color: #161a1d;
    --cc-button-bg-color-rgb: 22, 26, 29;
    --cc-button-bg-opacity: .8;
    --cc-button-text-color: #FFFFFF;
    --cc-modal-transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

[theme="dark"] {
    --cc-card-bg-color: #161a1c;
    --cc-card-text-color: #f0f0f0;
    --cc-button-bg-color-rgb: 194, 208, 224;
    --cc-button-text-color: #161a1c;
}

.cookie-disable-interaction body {
    height: auto !important;
    overflow: hidden !important;
}

.cookie-disable-interaction body::before {
    background: rgba(0, 0, 0, .65);
    content: "";
    inset: 0;
    position: fixed;
    z-index: 900;
    opacity: 1;
}

/* Add exception for top navigation bar */
.cookie-disable-interaction .bg-green-600 {
    position: relative;
    z-index: 1001; /* Higher than the cookie banner */
}

.cookie-consent-root {
    --cookie-consent-width: 100%;
    --cookie-consent-bottom: 20px;
    position: fixed;
    background: var(--cc-card-bg-color);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    z-index: 1000;
    bottom: var(--cookie-consent-bottom);
    inset-inline-start: 20px;
    inset-inline-end: 20px;
    max-width: var(--cookie-consent-width);
    overflow: hidden;
    transition: 1s ease-in-out all;
    /* Add margin-top to prevent covering the top bar */
    margin-top: 50px;
}

.consent-layout-box,
.consent-layout-box-inline {
    --cookie-consent-width: 24rem;
}

.consent-layout-box-wide {
    --cookie-consent-width: 36rem;
}

.consent-layout-cloud,
.consent-layout-cloud-inline {
    --cookie-consent-width: 54em;
}

/* For bar type, adjust to avoid covering the top navigation */
.consent-layout-bar,
.consent-layout-bar-inline {
    --cookie-consent-bottom: 0;
    --cookie-consent-top: auto;
    top: auto; /* Ensure it stays at the bottom */
    inset-inline-start: 0;
    inset-inline-end: 0;
    border-radius: 0;
}

.cookie-consent-hide {
    --cookie-consent-bottom: -110%;
}

@media screen and (max-width: 640px) {
    .consent-layout-cloud,
    .consent-layout-cloud-inline {
        --cookie-consent-width: none !important;
        width: calc(100% - 40px) !important;
    }
}

.cookie-consent-content-container {
    --cc-content-container-width: 1200px;
    display: flex;
    justify-content: space-between;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 20px;
    max-width: var(--cc-content-container-width);
    margin: auto;
}

.consent-layout-box .cookie-consent-content-container,
.consent-layout-box-inline .cookie-consent-content-container,
.consent-layout-box-wide .cookie-consent-content-container,
.consent-layout-bar .cookie-consent-content-container {
    flex-direction: column;
}

.cookie-consent-content {
    width: 100%;
}

.cookie-consent-content-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--cc-card-text-color);
    margin: 0;
    padding: 0 0 .35rem 0;
}

.cookie-consent-content-description {
    font-size: 14px;
    color: var(--cc-card-text-color);
    margin: 0;
    padding: 0;
    opacity: .8;
}

.cookie-consent-button-container {
    display: flex;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.consent-layout-box .cookie-consent-button-container,
.consent-layout-box .cookie-consent-button-action,
.consent-layout-box-inline .cookie-consent-button-container,
.consent-layout-box-inline .cookie-consent-button-action,
.consent-layout-box-wide .cookie-consent-button-container,
.consent-layout-bar .cookie-consent-button-container {
    width: 100%;
}

.cookie-consent-button-action {
    display: flex;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
}

.consent-layout-box-inline .cookie-consent-button-action,
.consent-layout-box-wide .cookie-consent-button-action,
.consent-layout-bar .cookie-consent-button-action,
.consent-layout-bar-inline .cookie-consent-button-action {
    flex-direction: row;
}

.consent-layout-box-wide .cookie-consent-button-container,
.consent-layout-cloud-inline .cookie-consent-button-action,
.consent-layout-bar .cookie-consent-button-container {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.cookie-consent-button-container button {
    padding: .5rem 1.25rem;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: rgba(var(--cc-button-bg-color-rgb), var(--cc-button-bg-opacity, 1));
    color: var(--cc-button-text-color);
    min-width: max-content;
}

.cookie-consent-button-container button.preferences-btn {
    --cc-button-bg-color-rgb: 227, 232, 235;
    --cc-button-text-color: #000;
}

.cookie-consent-button-container button:hover {
    --cc-button-bg-opacity: 1;
}

.consent-layout-box-inline .cookie-consent-button-action button {
    width: 100%;
}

/* Cookie Consent Links Container (Footer) */
.cookie-consent-links-container {
    text-align: center;
    padding: .5rem 1.25rem;
    background: rgba(0, 0, 0, 0.03);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.cookie-consent-links-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

.cookie-consent-link-item {
    display: inline-block;
}

.cookie-consent-link {
    color: var(--cc-card-text-color);
    opacity: 0.7;
    font-size: 12px;
    text-decoration: none;
    transition: opacity 0.2s;
}

.cookie-consent-link:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Cookie Preferences Modal */
.cookie-preferences-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1050;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    box-sizing: border-box;
    overflow-y: auto;
    transition: var(--cc-modal-transition);
}

.cookie-preferences-modal.is-visible {
    opacity: 1;
    visibility: visible;
}

.cookie-preferences-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: -1;
    opacity: 0;
    transition: var(--cc-modal-transition);
}

.cookie-preferences-modal.is-visible .cookie-preferences-modal-overlay {
    opacity: 1;
}

.cookie-preferences-modal-content {
    background-color: var(--cc-card-bg-color);
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    max-width: 800px;
    margin: 0 auto;
    transform: translateY(-20px);
    transition: var(--cc-modal-transition);
    position: relative;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 40px);
    max-height: 650px;
}

.cookie-preferences-modal.is-visible .cookie-preferences-modal-content {
    transform: translateY(0);
}

.cookie-preferences-modal-header {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.cookie-preferences-modal-header h2 {
    margin: 0;
    font-size: 18px;
    color: var(--cc-card-text-color);
    font-weight: 600;
}

.cookie-preferences-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: var(--cc-card-text-color);
    opacity: 0.6;
    transition: opacity 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cookie-preferences-modal-close:hover,
.cookie-preferences-modal-close:focus {
    opacity: 1;
    outline: none;
}

.cookie-preferences-modal-close svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.cookie-preferences-modal-body {
    padding: 20px;
    overflow-y: auto;
    color: var(--cc-card-text-color);
    flex-grow: 1;
}

.cookie-preferences-modal p {
    font-size: 14px;
    line-height: 1.5;
    color: var(--cc-card-text-color);
    opacity: 0.9;
    margin-top: 0;
    margin-bottom: 15px;
}

.cookie-preferences-modal-footer {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.cookie-preferences-modal-button-group {
    display: flex;
    gap: 10px;
}

.cookie-preferences-modal-save {
    display: flex;
}

.primary-button,
.secondary-button {
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.primary-button {
    background-color: rgba(var(--cc-button-bg-color-rgb), var(--cc-button-bg-opacity, 1));
    color: var(--cc-button-text-color);
    border: none;
}

.primary-button:hover {
    --cc-button-bg-opacity: 1;
}

.secondary-button {
    background-color: transparent;
    color: var(--cc-card-text-color);
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.secondary-button:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Cookie Category Toggles */
.cookie-category {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.cookie-category:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.cookie-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.cookie-category-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: var(--cc-card-text-color);
}

.cookie-toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.cookie-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.cookie-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 22px;
}

.cookie-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.cookie-toggle input:checked + .cookie-toggle-slider {
    background-color: #059669;
}

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

.cookie-toggle input:disabled + .cookie-toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .cookie-preferences-modal-footer {
        flex-direction: column;
    }

    .cookie-preferences-modal-button-group,
    .cookie-preferences-modal-save {
        width: 100%;
    }

    .cookie-preferences-modal-button-group {
        margin-bottom: 10px;
    }

    .cookie-preferences-modal-save button {
        width: 100%;
    }

    .cookie-consent-links-list {
        flex-direction: column;
        gap: 0.5rem;
    }
}
