.dark-mode .bg-image {
    filter: brightness(50%);
}
/* Unified admin/settings style */
.cq-admin-page .block-rounded,
.cq-admin-card {
    border-radius: 1rem;
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.05);
}

.cq-admin-card-header {
    border-top-left-radius: 1rem;
    border-top-right-radius: 1rem;
}

.cq-admin-page .nav-tabs-block .nav-link {
    font-weight: 600;
}

.cq-filter-row {
    background: rgba(0, 0, 0, 0.015);
    border-radius: 1rem;
    padding: 1rem;
}

.cq-bg-card {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0.9rem;
    padding: 0.8rem;
    background: #fff;
}

.cq-bg-preview-frame {
    height: 118px;
    border-radius: 0.7rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.cq-bg-thumb {
    display: block;
    width: auto !important;
    height: auto !important;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border: 0;
    border-radius: 0;
}

.cq-bg-empty {
    width: 100%;
    height: 118px;
    border-radius: 0.7rem;
    border: 1px dashed rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    background: rgba(0, 0, 0, 0.02);
    text-align: center;
    padding: 0.5rem;
}

.cq-bg-card .form-control[type="file"] {
    font-size: 0.74rem;
}

.cq-test-card {
    border-radius: 1rem;
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.05);
}

.cq-test-question {
    font-size: 1.05rem;
    line-height: 1.55;
}

@media (max-width: 576px) {
    .cq-bg-thumb,
    .cq-bg-empty {
        height: 120px;
    }
}


/* Active backend menu marker */
.nav-main-link.active,
.nav-main-item.open > .nav-main-link {
    background: rgba(6, 101, 208, 0.10);
    color: #0665d0;
    border-radius: 0.65rem;
    font-weight: 700;
}
.nav-main-link.active .nav-main-link-icon,
.nav-main-item.open > .nav-main-link .nav-main-link-icon {
    color: #0665d0;
}

/* Visual document editor */
.cq-doc-editor-wrap {
    background: #f6f7fb;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 1rem;
    padding: 1rem;
    overflow: auto;
}
.cq-doc-page {
    position: relative;
    width: min(100%, 560px);
    aspect-ratio: 210 / 297;
    margin: 0 auto;
    background: #fff;
    border-radius: 0.6rem;
    overflow: hidden;
    box-shadow: 0 0.8rem 2rem rgba(0, 0, 0, 0.12);
}
.cq-doc-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    user-select: none;
}
.cq-doc-layer {
    position: absolute;
    min-width: 8px;
    min-height: 8px;
    border: 1px dashed rgba(6, 101, 208, 0.25);
    background: rgba(255, 255, 255, 0.10);
    cursor: move;
    overflow: hidden;
    padding: 2px;
    line-height: 1.15;
}
.cq-doc-layer:hover,
.cq-doc-layer.active {
    border: 2px solid #0665d0;
    background: rgba(6, 101, 208, 0.07);
    z-index: 20;
}
.cq-doc-layer img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}
.cq-doc-layer-qrcode {
    display: flex;
    align-items: center;
    justify-content: center;
    background: repeating-linear-gradient(45deg, #fff, #fff 4px, #e9ecef 4px, #e9ecef 8px);
    color: #222;
    font-size: 10px;
    text-align: center;
}
.cq-editor-panel {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 1rem;
    padding: 1rem;
    background: #fff;
    position: sticky;
    top: 1rem;
}
.cq-editor-tools .btn {
    margin-right: 0.35rem;
    margin-bottom: 0.35rem;
}
.cq-appeal-focus .block {
    max-width: 1180px;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 576px) {
    .cq-bg-preview-frame,
    .cq-bg-empty {
        height: 96px;
    }
}

/* Image selection and lightbox */
.cq-image-library-thumb {
    width: 72px;
    height: 52px;
    object-fit: contain;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 0.5rem;
    background: #f8f9fa;
    padding: 2px;
}
.cq-lightboxable,
.cq-bg-thumb,
.cq-category-photo {
    cursor: zoom-in;
}
.cq-lightbox-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10800;
    background: rgba(0, 0, 0, 0.86);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.cq-lightbox-backdrop img {
    max-width: 96vw;
    max-height: 92vh;
    object-fit: contain;
    border-radius: 0.5rem;
    background: #fff;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.4);
}
.cq-lightbox-close {
    position: fixed;
    top: 16px;
    right: 20px;
    z-index: 10801;
    border: 0;
    border-radius: 999px;
    width: 42px;
    height: 42px;
    font-size: 24px;
    color: #fff;
    background: rgba(255, 255, 255, 0.16);
}
.subject-thumb,
.subject-preview,
.cq-admin-page img:not([data-no-lightbox="1"]) {
    cursor: zoom-in;
}

/* Comfortable bottom spacing for backend pages */
.content {
    padding-bottom: 3.5rem !important;
}
.block:last-child,
.content > .row:last-child {
    margin-bottom: 1.5rem;
}
.cq-site-edit-form:last-child {
    margin-bottom: 1rem !important;
}

/* Image path previews and extra card spacing */
.cq-image-path-preview {
    width: 76px;
    height: 56px;
    flex: 0 0 76px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 0.55rem;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    text-decoration: none;
    color: #6c757d;
    font-size: 0.72rem;
    text-align: center;
    padding: 0.25rem;
}
.cq-image-path-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.cq-image-path-preview-empty {
    border-style: dashed;
}
.cq-admin-page .block-content {
    padding-bottom: 1.25rem;
}
.cq-admin-page .block-content-full {
    padding-bottom: 1.25rem !important;
}
.cq-admin-page .block.bg-body-light .block-content,
.cq-admin-page .cq-site-edit-form {
    padding-bottom: 1.5rem !important;
}

/* Extra bottom breathing room for utility admin cards */
.cq-admin-page .block-content.pb-5,
.cq-admin-page .cq-site-edit-form {
    padding-bottom: 2rem !important;
}
.cq-admin-page .btn.mb-2:last-child {
    margin-bottom: .75rem !important;
}

/* Settings cards and modals need an explicit surface because Codebase keeps
   Bootstrap modal backgrounds transparent by default. */
.cq-settings-card,
.cq-admin-page .bg-body-light {
    background-color: #fff !important;
    border-color: #e4e7ed !important;
}
.cq-settings-modal .modal-content {
    color: #2c3034;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 1rem;
    box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.28);
    overflow: hidden;
}
.cq-settings-modal .modal-header,
.cq-settings-modal .modal-footer {
    background: #f6f7f9;
    border-color: #e4e7ed;
}
.cq-settings-modal .modal-header {
    border-bottom-width: 1px;
}
.cq-settings-modal .modal-footer {
    border-top-width: 1px;
}
.cq-settings-modal .btn-primary,
.cq-admin-page .btn-primary {
    color: #fff !important;
    background-color: #0284c7 !important;
    border-color: #0284c7 !important;
}
.cq-settings-modal .btn-alt-secondary,
.cq-admin-page .btn-alt-secondary {
    color: #2c3034;
    background-color: #e9ecef;
    border-color: #d9dde2;
}
.cq-settings-modal .form-control,
.cq-settings-modal .form-select {
    color: #2c3034;
    background-color: #fff;
    border-color: #ced4da;
}
.dark-mode .cq-settings-card,
.dark-mode .cq-admin-page .bg-body-light,
.dark-mode .cq-settings-modal .modal-content {
    color: #c5cdd8;
    background: #262a2f !important;
    border-color: #3b424a !important;
}
.dark-mode .cq-settings-modal .modal-header,
.dark-mode .cq-settings-modal .modal-footer {
    background: #333a40;
    border-color: #454e57;
}
.dark-mode .cq-settings-modal .form-control,
.dark-mode .cq-settings-modal .form-select {
    color: #f1f3f5;
    background-color: #1f2327;
    border-color: #4a545e;
}
.cq-home-video-row,
.cq-home-upload-card,
.cq-home-video-empty {
    background: #f8f9fa;
    border-color: #dfe3e7 !important;
}
.cq-video-order-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 31px;
    color: #014f77;
    background: #d9effa;
    border-radius: .45rem;
    font-weight: 700;
}
.dark-mode .cq-home-video-row,
.dark-mode .cq-home-upload-card,
.dark-mode .cq-home-video-empty {
    background: #202429;
    border-color: #3b424a !important;
}
.dark-mode .cq-video-order-number {
    color: #9edcff;
    background: #123e54;
}
.cq-ad-cache-table {
    max-height: 420px;
    overflow: auto;
}
.cq-ad-status-card {
    background: #f8f9fa;
    border-color: #dfe3e7 !important;
    overflow-wrap: anywhere;
}
.dark-mode .cq-ad-status-card {
    background: #202429;
    border-color: #3b424a !important;
}

/* Native homepage video background. */
.cq-home-hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 500px;
    overflow: hidden;
    background: #e9ecef;
}
.cq-home-hero-height-compact { height: 500px; }
.cq-home-hero-height-large { height: 75vh; min-height: 560px; }
.cq-home-hero-height-full { height: 100vh; min-height: 500px; }
.cq-home-hero-video,
.cq-home-hero-poster {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.cq-home-hero-overlay {
    position: absolute;
    inset: 0;
}
.cq-home-hero-content {
    position: relative;
    z-index: 2;
    width: 100%;
}
.cq-home-quiz-grid > [class*="col-"] {
    min-width: 0;
}
.cq-home-quiz-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.cq-home-quiz-card > .block-content:last-child {
    flex: 1 1 auto;
}
.cq-ad-section {
    border-top: 1px solid #e4e7ed;
}
.cq-ad-disclosure {
    margin: -.25rem 0 .75rem;
    color: #8a9199;
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.cq-ad-product-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.cq-ad-product-image-link {
    position: relative;
    display: block;
    height: 225px;
    overflow: hidden;
    background: #eef0f2;
}
.cq-ad-product-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .2s ease;
}
.cq-ad-product-image-link:hover .cq-ad-product-image {
    transform: scale(1.025);
}
.cq-ad-product-brand {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    max-width: calc(100% - 3rem);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cq-ad-fallback-image {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 260px;
    margin: 0 auto;
    object-fit: contain;
    border-radius: .5rem;
}
.dark-mode .cq-ad-section {
    border-top-color: #3b424a;
}
.dark-mode .cq-ad-product-image-link {
    background: #202429;
}
.dark-mode .cq-ad-product-card .text-dark {
    color: #f1f3f5 !important;
}
@media (max-width: 767.98px) {
    .cq-home-hero-height-compact,
    .cq-home-hero-height-large,
    .cq-home-hero-height-full {
        height: 70vh;
        min-height: 460px;
    }
}
