/**
 * Ze Certification Maps - Shortcode Styles
 * Styles for [ze_certification] shortcode widget
 * Matches exactly the side panel appearance
 */

/* ============================================
   BASE WIDGET STYLES
   ============================================ */
.zcm-cert-widget {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    box-sizing: border-box;
    line-height: 1.5;
}

.zcm-cert-widget *,
.zcm-cert-widget *::before,
.zcm-cert-widget *::after {
    box-sizing: inherit;
}

/* ============================================
   BADGE STYLE - "Niveau actuel" VIGNETTE
   Exact match to side panel .zcm-gauge-current
   ============================================ */
.zcm-cert-badge {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-left: 4px solid #2563eb;
    border-radius: 0 8px 8px 0;
}

.zcm-cert-badge-icon {
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zcm-cert-badge-icon img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    border-radius: 50%;
}

.zcm-cert-badge-icon span {
    font-size: 18px;
    line-height: 1;
}

.zcm-cert-badge-text {
    font-size: 13px;
    color: #1e40af;
}

.zcm-cert-badge-text strong {
    color: #2563eb;
    font-weight: 600;
}

/* Info icon with tooltip */
.zcm-cert-badge-info {
    cursor: help;
    font-size: 16px;
    margin-left: auto;
    padding: 5px 5px 5px 10px;
    position: static;
    transition: color 0.2s;
    color: #3b82f6;
}

.zcm-cert-badge-info:hover {
    color: #2563eb;
}

/* Tooltip for badge info icon */
.zcm-cert-tooltip {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #1f2937;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    padding: 12px 16px;
    border-radius: 10px;
    z-index: 10002;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
    white-space: normal;
    text-align: left;
    line-height: 1.6;
    word-wrap: break-word;
    pointer-events: none;
}

.zcm-cert-badge-info:hover .zcm-cert-tooltip {
    display: block;
}

/* ============================================
   GAUGE STYLE - FULL GAUGE
   Exact match to side panel gauge
   ============================================ */
.zcm-cert-gauge {
    margin: 0;
}

/* Gauge container (for scoped pulse animation) */
.zcm-gauge-container {
    position: relative;
}

.zcm-cert-gauge-title {
    margin: 0 0 16px 0;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Gauge track (horizontal bar) */
.zcm-gauge-track {
    display: flex;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.zcm-gauge-segment {
    height: 100%;
    transition: all 0.3s ease;
    position: relative;
}

.zcm-gauge-segment.active {
    /* Color set inline */
}

.zcm-gauge-segment.inactive {
    background: #e5e7eb;
}

.zcm-gauge-segment:not(:last-child) {
    border-right: 2px solid #ffffff;
}

/* Gauge labels */
.zcm-gauge-labels {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-top: 8px;
    gap: 4px;
    position: relative;
}

.zcm-gauge-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 0;
    position: relative;
    cursor: pointer;
}

.zcm-gauge-label-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 14px;
    margin-bottom: 4px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    background: #f3f4f6;
}

.zcm-gauge-label-icon.active {
    background: #fff;
}

.zcm-gauge-label-icon.current {
    background: #fff;
}

.zcm-gauge-label-icon.inactive {
    background: #f3f4f6;
    filter: grayscale(100%);
    opacity: 0.6;
}

.zcm-gauge-icon-img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    border-radius: 50%;
}

.zcm-gauge-icon-emoji {
    font-size: 16px;
    line-height: 1;
}

.zcm-gauge-label-text {
    font-size: 10px;
    font-weight: 500;
    color: #6b7280;
    text-align: center;
    line-height: 1.2;
    max-width: 60px;
    word-wrap: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zcm-gauge-label.current .zcm-gauge-label-text {
    font-weight: 600;
}

.zcm-gauge-label.active .zcm-gauge-label-text {
    color: #6b7280;
}

/* Position tooltip relative to the labels container */
.zcm-gauge-labels {
    position: relative;
}

/* Tooltip - full width, positioned at bottom of .zcm-gauge-labels */
.zcm-gauge-label-tooltip {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    margin-top: 8px;
    background: #1f2937;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    padding: 12px 16px;
    border-radius: 10px;
    z-index: 10002;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
    white-space: normal;
    text-align: left;
    line-height: 1.6;
    word-wrap: break-word;
    pointer-events: none;
}

/* Show tooltip when corresponding label is hovered using ~ sibling selector */
.zcm-gauge-label[data-tooltip-index="1"]:hover ~ .zcm-gauge-label-tooltip[data-for-index="1"],
.zcm-gauge-label[data-tooltip-index="2"]:hover ~ .zcm-gauge-label-tooltip[data-for-index="2"],
.zcm-gauge-label[data-tooltip-index="3"]:hover ~ .zcm-gauge-label-tooltip[data-for-index="3"],
.zcm-gauge-label[data-tooltip-index="4"]:hover ~ .zcm-gauge-label-tooltip[data-for-index="4"],
.zcm-gauge-label[data-tooltip-index="5"]:hover ~ .zcm-gauge-label-tooltip[data-for-index="5"],
.zcm-gauge-label[data-tooltip-index="6"]:hover ~ .zcm-gauge-label-tooltip[data-for-index="6"],
.zcm-gauge-label[data-tooltip-index="7"]:hover ~ .zcm-gauge-label-tooltip[data-for-index="7"],
.zcm-gauge-label[data-tooltip-index="8"]:hover ~ .zcm-gauge-label-tooltip[data-for-index="8"],
.zcm-gauge-label[data-tooltip-index="9"]:hover ~ .zcm-gauge-label-tooltip[data-for-index="9"],
.zcm-gauge-label[data-tooltip-index="10"]:hover ~ .zcm-gauge-label-tooltip[data-for-index="10"] {
    display: block;
}

/* Tooltip for gauge labels - DEPRECATED (kept for compatibility) */
.zcm-gauge-labels > .zcm-gauge-tooltip {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 8px);
    background: #1f2937;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    padding: 12px 16px;
    border-radius: 10px;
    z-index: 10002;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
    white-space: normal;
    text-align: left;
    line-height: 1.6;
    word-wrap: break-word;
    pointer-events: none;
}

.zcm-gauge-label:hover ~ .zcm-gauge-tooltip {
    display: block;
}

/* Current level vignette in gauge */
.zcm-gauge-current-vignette {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-left: 4px solid #2563eb;
    border-radius: 0 8px 8px 0;
    margin-top: 12px;
}

.zcm-gauge-current-icon {
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zcm-gauge-current-img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    border-radius: 50%;
}

.zcm-gauge-current-emoji {
    font-size: 18px;
    line-height: 1;
}

.zcm-gauge-current-text {
    font-size: 13px;
    color: #1e40af;
}

.zcm-gauge-current-text strong {
    color: #2563eb;
    font-weight: 600;
}

/* Description text */
.zcm-cert-description {
    margin: 16px 0 0 0;
    color: #6b7280;
    font-size: 13px;
    line-height: 1.6;
}

/* ============================================
   RESPONSIVE STYLES
   ============================================ */
@media (max-width: 480px) {
    .zcm-cert-badge {
        padding: 8px 12px;
    }

    .zcm-cert-badge-text {
        font-size: 12px;
    }

    .zcm-gauge-label-icon {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }

    .zcm-gauge-label-text {
        font-size: 9px;
        max-width: 50px;
    }

    .zcm-gauge-current-vignette {
        padding: 8px 12px;
    }

    .zcm-gauge-current-text {
        font-size: 12px;
    }

    .zcm-gauge-labels > .zcm-gauge-tooltip,
    .zcm-cert-tooltip {
        font-size: 12px;
        padding: 10px 12px;
    }
}

/* ============================================
   ERROR MESSAGE (admin only)
   ============================================ */
.zcm-shortcode-error {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
}

/* ============================================
   STICKY CTA - Google My Business
   Responsive: Mobile (compact) / Desktop (cookie-banner)
   ============================================ */
.zcm-sticky-cta {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2147483647; /* Maximum z-index value to ensure it's always on top */
    padding: 12px 16px;
    background: var(--sticky-bg, #ffffff);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    transform: translateY(100%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease, visibility 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.zcm-sticky-cta.visible {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.zcm-sticky-cta-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    /* Background and color are set via inline styles from layer settings */
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    max-width: 400px;
    width: 100%;
}

.zcm-sticky-cta-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.zcm-sticky-cta-icon {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.zcm-sticky-cta-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.zcm-sticky-cta-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 1;
    min-width: 0;
}

.zcm-sticky-cta-label {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
}

.zcm-sticky-cta-sub {
    font-size: 12px;
    opacity: 0.8;
    font-weight: 400;
}

.zcm-sticky-cta-arrow {
    font-size: 20px;
    opacity: 0.8;
    animation: zcm-sticky-arrow-bounce 1.5s ease-in-out infinite;
}

@keyframes zcm-sticky-arrow-bounce {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(4px); }
}

.zcm-sticky-cta-close {
    position: absolute;
    top: -10px;
    right: 10px;
    width: 24px;
    height: 24px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 50%;
    font-size: 16px;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: background 0.2s, color 0.2s;
}

.zcm-sticky-cta-close:hover {
    background: #f3f4f6;
    color: #374151;
}

/* ============================================
   DESKTOP: Cookie-banner style (full-width)
   ============================================ */
@media (min-width: 768px) {
    .zcm-sticky-cta {
        padding: 16px 40px;
        background: var(--sticky-bg, linear-gradient(135deg, #ffffff 0%, #f8fafc 100%));
        border-top: 1px solid rgba(0, 0, 0, 0.06);
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.12);
    }

    .zcm-sticky-cta-btn {
        max-width: none;
        width: auto;
        flex: 0 1 auto;
        padding: 14px 32px;
        border-radius: 50px;
        font-size: 17px;
        gap: 16px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
    }

    .zcm-sticky-cta-btn:hover {
        transform: translateY(-2px) scale(1.01);
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.22);
    }

    .zcm-sticky-cta-icon {
        width: 42px;
        height: 42px;
        font-size: 22px;
    }

    .zcm-sticky-cta-icon img {
        width: 28px;
        height: 28px;
    }

    .zcm-sticky-cta-text {
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }

    .zcm-sticky-cta-label {
        font-size: 17px;
    }

    .zcm-sticky-cta-sub {
        font-size: 14px;
        opacity: 0.75;
    }

    .zcm-sticky-cta-sub::before {
        content: "–";
        margin-right: 8px;
        opacity: 0.5;
    }

    .zcm-sticky-cta-arrow {
        font-size: 22px;
        margin-left: 8px;
    }

    .zcm-sticky-cta-close {
        position: static;
        margin-left: 24px;
        width: 32px;
        height: 32px;
        font-size: 18px;
        background: rgba(0, 0, 0, 0.05);
        border: none;
        color: #9ca3af;
    }

    .zcm-sticky-cta-close:hover {
        background: rgba(0, 0, 0, 0.1);
        color: #4b5563;
    }
}

/* ============================================
   CONFETTI OVERLAY
   ============================================ */
.zcm-confetti-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.zcm-confetti-overlay.active {
    opacity: 1;
    visibility: visible;
}

#zcm-confetti-canvas {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.zcm-confetti-message {
    position: relative;
    z-index: 1;
    background: #fff;
    padding: 40px 50px;
    border-radius: 20px;
    text-align: center;
    max-width: 420px;
    margin: 20px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
    animation: zcm-confetti-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes zcm-confetti-pop {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.zcm-confetti-emoji {
    font-size: 64px;
    margin-bottom: 16px;
    animation: zcm-confetti-bounce 0.6s ease-out;
}

.zcm-confetti-emoji img.zcm-confetti-icon-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

@keyframes zcm-confetti-bounce {
    0% { transform: scale(0) rotate(-15deg); }
    50% { transform: scale(1.2) rotate(5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.zcm-confetti-message h3 {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 12px 0;
}

.zcm-confetti-message p {
    font-size: 16px;
    color: #4b5563;
    margin: 0 0 20px 0;
    line-height: 1.5;
}

.zcm-confetti-countdown {
    font-size: 14px;
    color: #9ca3af;
}

.zcm-confetti-countdown span {
    font-weight: 700;
    color: #10b981;
    font-size: 18px;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .zcm-sticky-cta {
        padding: 10px 12px;
    }

    .zcm-sticky-cta-btn {
        padding: 10px 16px;
        gap: 10px;
    }

    .zcm-sticky-cta-icon {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }

    .zcm-sticky-cta-label {
        font-size: 14px;
    }

    .zcm-confetti-message {
        padding: 30px 24px;
    }

    .zcm-confetti-emoji {
        font-size: 48px;
    }

    .zcm-confetti-message h3 {
        font-size: 20px;
    }

    .zcm-confetti-message p {
        font-size: 14px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    /* Sticky CTA background is set via inline style (--sticky-bg variable), so we don't override it here */
    /* Only apply dark mode styling to close button and other elements */

    .zcm-sticky-cta {
        border-top-color: rgba(255, 255, 255, 0.1);
    }

    .zcm-sticky-cta-close {
        background: #374151;
        border-color: #4b5563;
        color: #9ca3af;
    }

    .zcm-sticky-cta-close:hover {
        background: #4b5563;
        color: #e5e7eb;
    }

    .zcm-confetti-message {
        background: #1f2937;
    }

    .zcm-confetti-message h3 {
        color: #f9fafb;
    }

    .zcm-confetti-message p {
        color: #d1d5db;
    }

    .zcm-confetti-countdown {
        color: #6b7280;
    }
}

/* Dark mode - Desktop specific */
@media (prefers-color-scheme: dark) and (min-width: 768px) {
    .zcm-sticky-cta-close {
        background: rgba(255, 255, 255, 0.1);
        border: none;
    }

    .zcm-sticky-cta-close:hover {
        background: rgba(255, 255, 255, 0.2);
    }
}

/* ============================================
   ARTICLE EXIT INTENT POPUP
   ============================================ */
.zcm-article-exit-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.zcm-article-exit-modal.visible {
    opacity: 1;
    visibility: visible;
}

.zcm-article-exit-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.zcm-article-exit-content {
    position: relative;
    max-width: 420px;
    width: 90%;
    padding: 32px 28px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    z-index: 1;
}

.zcm-article-exit-modal.visible .zcm-article-exit-content {
    transform: scale(1) translateY(0);
}

.zcm-article-exit-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
}

.zcm-article-exit-close:hover {
    background: rgba(0, 0, 0, 0.15);
    transform: scale(1.1);
}

.zcm-article-exit-emoji {
    font-size: 56px;
    line-height: 1;
    margin-bottom: 16px;
    animation: zcm-wave 1.5s ease-in-out infinite;
}

@keyframes zcm-wave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(20deg); }
    75% { transform: rotate(-15deg); }
}

.zcm-article-exit-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 12px;
    line-height: 1.3;
}

.zcm-article-exit-text {
    font-size: 16px;
    line-height: 1.6;
    margin: 0 0 24px;
    opacity: 0.85;
}

.zcm-article-exit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 32px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.zcm-article-exit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.zcm-article-exit-btn:active {
    transform: translateY(0);
}

/* Mobile adjustments for article exit popup */
@media (max-width: 480px) {
    .zcm-article-exit-content {
        padding: 24px 20px;
        width: 94%;
    }

    .zcm-article-exit-emoji {
        font-size: 48px;
    }

    .zcm-article-exit-title {
        font-size: 20px;
    }

    .zcm-article-exit-text {
        font-size: 15px;
    }

    .zcm-article-exit-btn {
        width: 100%;
        padding: 16px 24px;
    }
}

/* Dark mode for article exit popup */
@media (prefers-color-scheme: dark) {
    .zcm-article-exit-close {
        background: rgba(255, 255, 255, 0.15);
    }

    .zcm-article-exit-close:hover {
        background: rgba(255, 255, 255, 0.25);
    }
}
