/**
 * NuageLab Cookie Consent Banner
 * Mobile-first responsive design
 * Uses CookieYes-compatible .cky-* class naming
 */

/* Base styles */
.cky-consent-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    box-sizing: border-box;
    z-index: 999999;
}

.cky-consent-container *,
.cky-consent-container *::before,
.cky-consent-container *::after {
    box-sizing: border-box;
}

/* Bar style (full-width) */
.cky-consent-bar {
    position: fixed;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    padding: 16px;
}

.cky-consent-bar.cky-bottom {
    bottom: 0;
}

.cky-consent-bar.cky-top {
    top: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Popup style (centered modal) */
.cky-consent-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    padding: 24px;
    max-width: 500px;
    width: calc(100% - 32px);
    max-height: 90vh;
    overflow-y: auto;
}

.cky-consent-popup::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
}

/* Floating style (corner positioned) */
.cky-consent-floating {
    position: fixed;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    padding: 20px;
    max-width: 400px;
    width: calc(100% - 32px);
    margin: 16px;
}

.cky-consent-floating.cky-bottom-left {
    bottom: 0;
    left: 0;
}

.cky-consent-floating.cky-bottom-right {
    bottom: 0;
    right: 0;
}

.cky-consent-floating.cky-bottom {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

/* Content layout */
.cky-notice {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cky-notice-wrapper {
    flex: 1;
}

.cky-notice-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px;
    color: #1d2327;
}

.cky-notice-des {
    margin: 0;
    color: #50575e;
}

/* Action buttons */
.cky-notice-btn-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cky-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    min-width: 100px;
}

.cky-btn-accept {
    background: #2271b1;
    color: #fff;
}

.cky-btn-accept:hover {
    background: #135e96;
}

.cky-btn-reject {
    background: #f0f0f1;
    color: #50575e;
    border: 1px solid #c3c4c7;
}

.cky-btn-reject:hover {
    background: #e0e0e0;
}

.cky-btn-customize {
    background: transparent;
    color: #2271b1;
    text-decoration: underline;
}

.cky-btn-customize:hover {
    color: #135e96;
}

.cky-btn-save {
    background: #00a32a;
    color: #fff;
    width: 100%;
}

.cky-btn-save:hover {
    background: #008a20;
}

/* Customize panel */
.cky-preference-center {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.cky-preference-body-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 16px;
}

.cky-accordion-item {
    padding: 12px 16px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
}

.cky-accordion-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Accordion expand button */
.cky-accordion-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    flex: 1;
    text-align: left;
}

.cky-accordion-title {
    color: #1d2327;
    font-weight: 600;
    font-size: 15px;
}

.cky-accordion-count {
    color: #646970;
    font-size: 13px;
    font-weight: 400;
}

.cky-accordion-chevron {
    width: 10px;
    height: 10px;
    border-right: 2px solid #646970;
    border-bottom: 2px solid #646970;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
    margin-left: auto;
}

.cky-accordion-open .cky-accordion-chevron {
    transform: rotate(-135deg);
}

/* Toggle switch */
.cky-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.cky-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.cky-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.2s;
    border-radius: 24px;
}

.cky-slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.2s;
    border-radius: 50%;
}

.cky-switch input:checked + .cky-slider {
    background-color: #2271b1;
}

.cky-switch input:checked + .cky-slider::before {
    transform: translateX(20px);
}

.cky-switch input:disabled + .cky-slider {
    opacity: 0.6;
    cursor: not-allowed;
}

.cky-always-active {
    font-size: 11px;
    font-weight: 500;
    color: #00a32a;
    background: #e6f4ea;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

/* Accordion body */
.cky-accordion-body {
    padding-top: 12px;
    margin-top: 12px;
    border-top: 1px solid #e5e5e5;
}

.cky-accordion-description {
    margin: 0 0 12px;
    font-size: 13px;
    color: #646970;
    line-height: 1.5;
}

/* Cookie table */
.cky-cookie-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
}

.cky-cookie-table th,
.cky-cookie-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.cky-cookie-table th {
    background: #f5f5f5;
    font-weight: 600;
    color: #1d2327;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cky-cookie-table td {
    color: #50575e;
    vertical-align: top;
}

.cky-cookie-table td:first-child {
    font-weight: 500;
    width: 25%;
}

.cky-cookie-table td:nth-child(2) {
    width: 20%;
    white-space: nowrap;
}

.cky-cookie-table td:last-child {
    width: 55%;
}

.cky-cookie-table code {
    background: #f0f0f1;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-family: monospace;
}

.cky-cookie-table tbody tr:last-child td {
    border-bottom: none;
}

.cky-cookie-table tbody tr:hover {
    background: #fafafa;
}

.cky-preference-footer {
    margin-top: 16px;
}

/* Animation */
.cky-consent-container {
    animation: ckySlideIn 0.3s ease-out;
}

@keyframes ckySlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cky-consent-popup {
    animation: ckyFadeIn 0.3s ease-out;
}

@keyframes ckyFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Desktop styles */
@media (min-width: 768px) {
    .cky-consent-bar .cky-notice {
        flex-direction: row;
        align-items: center;
        max-width: 1200px;
        margin: 0 auto;
    }

    .cky-consent-bar .cky-notice-btn-wrapper {
        flex-shrink: 0;
    }

    .cky-btn {
        min-width: 120px;
    }

    .cky-btn-customize {
        min-width: auto;
    }
}

/* Accessibility */
.cky-consent-container:focus-within {
    outline: none;
}

.cky-btn:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.cky-accordion-header-toggle input[type="checkbox"]:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .cky-consent-container {
        border: 2px solid #000;
    }

    .cky-btn {
        border: 2px solid currentColor;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .cky-consent-container,
    .cky-consent-popup {
        animation: none;
    }

    .cky-btn {
        transition: none;
    }
}

/* Revisit consent button */
.cky-revisit-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #2271b1;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 999998;
}

.cky-revisit-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.cky-revisit-btn:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* Dark theme */
.cky-dark-theme.cky-consent-container,
.cky-dark-theme .cky-consent-bar,
.cky-dark-theme .cky-consent-popup,
.cky-dark-theme .cky-consent-floating {
    background: #1e1e1e;
    color: #e0e0e0;
}

.cky-dark-theme .cky-notice-title {
    color: #fff;
}

.cky-dark-theme .cky-notice-des {
    color: #b0b0b0;
}

.cky-dark-theme .cky-accordion-item {
    background: #2d2d2d;
    border-color: #444;
}

.cky-dark-theme .cky-accordion-title {
    color: #fff;
}

.cky-dark-theme .cky-accordion-description {
    color: #a0a0a0;
}

.cky-dark-theme .cky-accordion-body {
    border-top-color: #444;
}

.cky-dark-theme .cky-accordion-chevron {
    border-color: #888;
}

.cky-dark-theme .cky-accordion-count {
    color: #888;
}

.cky-dark-theme .cky-btn-reject {
    background: #333;
    color: #e0e0e0;
    border-color: #555;
}

.cky-dark-theme .cky-btn-reject:hover {
    background: #444;
}

.cky-dark-theme .cky-btn-customize {
    color: #6db3f2;
}

.cky-dark-theme .cky-btn-customize:hover {
    color: #9dcbf7;
}

.cky-dark-theme .cky-preference-center {
    border-top-color: #444;
}

.cky-dark-theme .cky-cookie-table {
    background: #252525;
}

.cky-dark-theme .cky-cookie-table th {
    background: #333;
    color: #e0e0e0;
}

.cky-dark-theme .cky-cookie-table td {
    color: #b0b0b0;
    border-bottom-color: #444;
}

.cky-dark-theme .cky-cookie-table tbody tr:hover {
    background: #2a2a2a;
}

.cky-dark-theme .cky-cookie-table code {
    background: #333;
    color: #e0e0e0;
}

.cky-dark-theme .cky-always-active {
    background: #1e3a2c;
    color: #4ade80;
}

.cky-dark-theme .cky-slider {
    background-color: #555;
}

.cky-dark-theme .cky-revisit-btn {
    background: #3b82f6;
}

/* Custom theme using CSS variables */
.cky-custom-theme.cky-consent-container,
.cky-custom-theme .cky-consent-bar,
.cky-custom-theme .cky-consent-popup,
.cky-custom-theme .cky-consent-floating {
    background: var(--cky-bg, #ffffff);
    color: var(--cky-text, #1d2327);
}

.cky-custom-theme .cky-notice-title {
    color: var(--cky-text, #1d2327);
}

.cky-custom-theme .cky-notice-des {
    color: var(--cky-secondary-text, #50575e);
}

.cky-custom-theme .cky-accordion-item {
    background: color-mix(in srgb, var(--cky-bg, #ffffff) 95%, var(--cky-text, #1d2327));
    border-color: var(--cky-border, #e0e0e0);
}

.cky-custom-theme .cky-accordion-title {
    color: var(--cky-text, #1d2327);
}

.cky-custom-theme .cky-accordion-description {
    color: var(--cky-secondary-text, #50575e);
}

.cky-custom-theme .cky-accordion-body {
    border-top-color: var(--cky-border, #e0e0e0);
}

.cky-custom-theme .cky-accordion-chevron {
    border-color: var(--cky-secondary-text, #50575e);
}

.cky-custom-theme .cky-accordion-count {
    color: var(--cky-secondary-text, #50575e);
}

.cky-custom-theme .cky-btn-accept,
.cky-custom-theme .cky-btn-save {
    background: var(--cky-primary, #2271b1);
    color: #fff;
}

.cky-custom-theme .cky-btn-accept:hover {
    background: color-mix(in srgb, var(--cky-primary, #2271b1) 85%, #000);
}

.cky-custom-theme .cky-btn-save:hover {
    background: color-mix(in srgb, var(--cky-primary, #2271b1) 85%, #000);
}

.cky-custom-theme .cky-btn-reject {
    background: var(--cky-bg, #ffffff);
    color: var(--cky-text, #1d2327);
    border-color: var(--cky-border, #e0e0e0);
}

.cky-custom-theme .cky-btn-reject:hover {
    background: color-mix(in srgb, var(--cky-bg, #ffffff) 90%, var(--cky-text, #1d2327));
}

.cky-custom-theme .cky-btn-customize {
    color: var(--cky-primary, #2271b1);
}

.cky-custom-theme .cky-btn-customize:hover {
    color: color-mix(in srgb, var(--cky-primary, #2271b1) 80%, #000);
}

.cky-custom-theme .cky-preference-center {
    border-top-color: var(--cky-border, #e0e0e0);
}

.cky-custom-theme .cky-cookie-table {
    background: var(--cky-bg, #ffffff);
}

.cky-custom-theme .cky-cookie-table th {
    background: color-mix(in srgb, var(--cky-bg, #ffffff) 95%, var(--cky-text, #1d2327));
    color: var(--cky-text, #1d2327);
}

.cky-custom-theme .cky-cookie-table td {
    color: var(--cky-secondary-text, #50575e);
    border-bottom-color: var(--cky-border, #e0e0e0);
}

.cky-custom-theme .cky-cookie-table tbody tr:hover {
    background: color-mix(in srgb, var(--cky-bg, #ffffff) 98%, var(--cky-text, #1d2327));
}

.cky-custom-theme .cky-cookie-table code {
    background: color-mix(in srgb, var(--cky-bg, #ffffff) 90%, var(--cky-text, #1d2327));
    color: var(--cky-text, #1d2327);
}

.cky-custom-theme .cky-switch input:checked + .cky-slider {
    background-color: var(--cky-primary, #2271b1);
}

.cky-custom-theme .cky-revisit-btn {
    background: var(--cky-primary, #2271b1);
}

.cky-custom-theme .cky-btn:focus {
    outline-color: var(--cky-primary, #2271b1);
}

/* Iframe placeholder (blocked content) */
.cky-iframe-placeholder {
    width: 100%;
    min-height: 200px;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.cky-iframe-placeholder > div {
    text-align: center;
    padding: 20px;
    max-width: 400px;
}

.cky-iframe-placeholder p {
    margin: 0 0 15px;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

.cky-iframe-placeholder .cky-iframe-accept {
    padding: 10px 20px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s ease;
}

.cky-iframe-placeholder .cky-iframe-accept:hover {
    background: #135e96;
}

.cky-iframe-placeholder .cky-iframe-accept:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* YouTube placeholder with thumbnail */
.cky-iframe-placeholder[data-cky-src*="youtube"] {
    background-size: cover;
    background-position: center;
    position: relative;
}

.cky-iframe-placeholder[data-cky-src*="youtube"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
}

.cky-iframe-placeholder[data-cky-src*="youtube"] > div {
    position: relative;
    z-index: 1;
}

.cky-iframe-placeholder[data-cky-src*="youtube"] p {
    color: #fff;
}

/* Dark theme placeholder */
.cky-dark-theme .cky-iframe-placeholder {
    background: linear-gradient(135deg, #2d2d2d 0%, #1e1e1e 100%);
    border-color: #444;
}

.cky-dark-theme .cky-iframe-placeholder p {
    color: #b0b0b0;
}

/* Custom theme placeholder */
.cky-custom-theme .cky-iframe-placeholder {
    background: linear-gradient(135deg, color-mix(in srgb, var(--cky-bg, #ffffff) 95%, var(--cky-text, #1d2327)) 0%, var(--cky-bg, #ffffff) 100%);
    border-color: var(--cky-border, #ddd);
}

.cky-custom-theme .cky-iframe-placeholder p {
    color: var(--cky-secondary-text, #666);
}

.cky-custom-theme .cky-iframe-placeholder .cky-iframe-accept {
    background: var(--cky-primary, #2271b1);
}

.cky-custom-theme .cky-iframe-placeholder .cky-iframe-accept:hover {
    background: color-mix(in srgb, var(--cky-primary, #2271b1) 85%, #000);
}
