/**
 * Topscore Extra - Popup Widget Styles
 * Comprehensive styles for popup modals with Bootstrap integration
 */

/* ===========================================
   BASE STYLES
   =========================================== */
.topscore-popup-widget {
    position: relative;
}

/* ===========================================
   MODAL OVERLAY
   =========================================== */
.topscore-popup-modal {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 99999;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    outline: 0;
    display: none;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.topscore-popup-modal.show {
    display: flex !important;
    opacity: 1;
}

/* ===========================================
   MODAL DIALOG
   =========================================== */
.topscore-popup-modal .modal-dialog {
    position: relative;
    width: auto;
    margin: 1.75rem auto;
    pointer-events: none;
    max-width: 70vw;
    display: flex;
    align-items: center;
    min-height: calc(100% - 3.5rem);
}

.topscore-popup-modal .modal-dialog-centered {
    display: flex;
    align-items: center;
    min-height: calc(100% - 3.5rem);
}

.topscore-popup-modal .modal-dialog-top {
    align-items: flex-start;
    margin-top: 2rem;
}

.topscore-popup-modal .modal-dialog-bottom {
    align-items: flex-end;
    margin-bottom: 2rem;
}

/* ===========================================
   MODAL CONTENT
   =========================================== */
.topscore-popup-modal .modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    pointer-events: auto;
    background-color: rgba(255, 255, 255, 0.56);
    background-clip: padding-box;
    border: none;
    border-radius: 8px;
    outline: 0;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
}

.topscore-popup-modal .modal-body {
    position: relative;
    flex: 1 1 auto;
    padding: 20px;
}

/* ===========================================
   CLOSE BUTTON
   =========================================== */
.topscore-popup-close {
    position: absolute;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background-color: #fff;
    color: #333;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
}

.topscore-popup-close:hover {
    background-color: #dc3232;
    color: #fff;
    transform: scale(1.1);
}

.topscore-popup-close:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

/* Close button positions */
.topscore-popup-close.close-inside-top-right {
    top: 10px;
    right: 10px;
}

.topscore-popup-close.close-inside-top-left {
    top: 10px;
    left: 10px;
}

.topscore-popup-close.close-outside-top-right {
    top: -15px;
    right: -15px;
}

.topscore-popup-close .close-text {
    font-size: 12px;
    font-weight: 500;
    margin-right: 5px;
}

.topscore-popup-close .close-icon {
    line-height: 1;
}

/* ===========================================
   POPUP CONTAINER LAYOUTS
   =========================================== */
.topscore-popup-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    width: 100%;
}

/* Horizontal Layout - Side by Side */
.topscore-popup-horizontal {
    flex-direction: row;
    flex-wrap: nowrap !important;
    justify-content: center;
    align-items: center;
}

.topscore-popup-horizontal .topscore-popup-image {
    flex: 0 1 auto;
    max-width: 45%;
}

/* Vertical Layout - Stacked */
.topscore-popup-vertical {
    flex-direction: column;
    align-items: center;
}

.topscore-popup-vertical .topscore-popup-image {
    max-width: 80%;
    width: 100%;
}

/* Grid Layout */
.topscore-popup-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

/* Single Layout - One at a time */
.topscore-popup-single {
    position: relative;
}

.topscore-popup-single .topscore-popup-image {
    display: none;
    max-width: 100%;
}

.topscore-popup-single .topscore-popup-image.active {
    display: flex;
}

/* Carousel Layout */
.topscore-popup-carousel-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.topscore-popup-carousel {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    transition: transform 0.4s ease-in-out;
    width: 100%;
}

.topscore-popup-carousel .topscore-popup-image {
    flex: 0 0 100%;
    max-width: 100%;
    justify-content: center;
}

/* Carousel Navigation */
.topscore-popup-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #333;
    z-index: 5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
}

.topscore-popup-nav:hover {
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.topscore-popup-prev {
    left: 10px;
}

.topscore-popup-next {
    right: 10px;
}

.topscore-popup-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Carousel Dots/Indicators */
.topscore-popup-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
    padding: 5px 0;
}

.topscore-popup-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.topscore-popup-dot:hover {
    background: rgba(0, 0, 0, 0.5);
}

.topscore-popup-dot.active {
    background: #333;
    transform: scale(1.2);
}

/* Single Layout Navigation */
.topscore-popup-single .topscore-popup-nav {
    position: absolute;
    top: 50%;
}

/* ===========================================
   POPUP IMAGE
   =========================================== */
.topscore-popup-image {
    flex: 0 0 auto;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 35vw;
    overflow: hidden;
}

.topscore-popup-image img {
    max-width: 100%;
    max-height: 70vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.topscore-popup-image a {
    display: block;
    line-height: 0;
}

/* Image hover effects */
.topscore-popup-image.hover-zoom img:hover {
    transform: scale(1.05);
}

.topscore-popup-image.hover-brighten img:hover {
    filter: brightness(1.15);
}

.topscore-popup-image.hover-darken img:hover {
    filter: brightness(0.85);
}

.topscore-popup-image.hover-grayscale img {
    filter: grayscale(100%);
}

.topscore-popup-image.hover-grayscale img:hover {
    filter: grayscale(0%);
}

.topscore-popup-image.has-link {
    cursor: pointer;
}

.topscore-popup-image.has-link img:hover {
    opacity: 0.9;
}

/* ===========================================
   ENTRANCE ANIMATIONS
   =========================================== */

/* Fade */
.topscore-animation-fade .modal-dialog {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.topscore-animation-fade.show .modal-dialog {
    opacity: 1;
    transform: scale(1);
}

/* Zoom */
.topscore-animation-zoom .modal-dialog {
    opacity: 0;
    transform: scale(0.7);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.topscore-animation-zoom.show .modal-dialog {
    opacity: 1;
    transform: scale(1);
}

/* Slide Down */
.topscore-animation-slide-down .modal-dialog {
    opacity: 0;
    transform: translateY(-100px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.topscore-animation-slide-down.show .modal-dialog {
    opacity: 1;
    transform: translateY(0);
}

/* Slide Up */
.topscore-animation-slide-up .modal-dialog {
    opacity: 0;
    transform: translateY(100px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.topscore-animation-slide-up.show .modal-dialog {
    opacity: 1;
    transform: translateY(0);
}

/* Slide Left */
.topscore-animation-slide-left .modal-dialog {
    opacity: 0;
    transform: translateX(100px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.topscore-animation-slide-left.show .modal-dialog {
    opacity: 1;
    transform: translateX(0);
}

/* Slide Right */
.topscore-animation-slide-right .modal-dialog {
    opacity: 0;
    transform: translateX(-100px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.topscore-animation-slide-right.show .modal-dialog {
    opacity: 1;
    transform: translateX(0);
}

/* Bounce */
.topscore-animation-bounce .modal-dialog {
    opacity: 0;
    transform: scale(0.3);
    transition: opacity 0.3s ease, transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.topscore-animation-bounce.show .modal-dialog {
    opacity: 1;
    transform: scale(1);
}

/* No animation */
.topscore-animation-none .modal-dialog {
    transition: none;
}

/* ===========================================
   RESPONSIVE STYLES
   =========================================== */

/* Tablet */
@media (max-width: 1024px) {
    .topscore-popup-modal .modal-dialog {
        max-width: 85vw;
        margin: 1rem auto;
    }

    .topscore-popup-image {
        max-width: 40vw;
    }

    .topscore-popup-horizontal .topscore-popup-image {
        max-width: 45%;
    }

    .topscore-popup-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .topscore-popup-container {
        gap: 15px;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .topscore-popup-modal .modal-dialog {
        max-width: 95vw;
        margin: 0.5rem auto;
    }

    .topscore-popup-container {
        gap: 10px;
    }

    /* Horizontal stacks on mobile */
    .topscore-popup-horizontal {
        flex-direction: column !important;
        flex-wrap: wrap !important;
    }

    .topscore-popup-horizontal .topscore-popup-image {
        max-width: 90%;
    }

    .topscore-popup-grid {
        grid-template-columns: 1fr;
    }

    .topscore-popup-image {
        max-width: 90vw;
    }

    .topscore-popup-image img {
        max-height: 50vh;
    }

    .topscore-popup-modal .modal-body {
        padding: 15px;
    }

    .topscore-popup-close {
        width: 28px;
        height: 28px;
        font-size: 18px;
    }

    .topscore-popup-close.close-inside-top-right {
        top: 8px;
        right: 8px;
    }

    .topscore-popup-nav {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
}

/* ===========================================
   EDITOR PREVIEW STYLES
   =========================================== */
.topscore-popup-preview {
    min-height: 100px;
}

.topscore-popup-preview-notice {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 20px 25px;
    border-radius: 8px;
    text-align: center;
}

.topscore-popup-preview-notice p {
    margin: 0 0 10px;
    color: #fff;
}

.topscore-popup-preview-notice p:last-child {
    margin-bottom: 0;
}

.topscore-popup-preview-notice small {
    opacity: 0.85;
}

.device-visibility {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.device-badge {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.device-badge.active {
    background: rgba(255, 255, 255, 0.95);
    color: #667eea;
    font-weight: 600;
}

/* ===========================================
   NOTICE STYLES (No Popups)
   =========================================== */
.topscore-popup-notice {
    padding: 30px;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    text-align: center;
    border-radius: 8px;
}

.topscore-popup-notice p {
    margin: 0;
    color: #6c757d;
}

/* ===========================================
   BODY SCROLL LOCK
   =========================================== */
body.topscore-popup-open {
    overflow: hidden;
    padding-right: var(--scrollbar-width, 0px);
}

/* ===========================================
   PRINT STYLES
   =========================================== */
@media print {
    .topscore-popup-modal {
        display: none !important;
    }
}

/* ===========================================
   HIGH CONTRAST MODE
   =========================================== */
@media (prefers-contrast: high) {
    .topscore-popup-modal .modal-content {
        border: 2px solid #000;
    }

    .topscore-popup-close {
        border: 2px solid #000;
    }
}

/* ===========================================
   REDUCED MOTION
   =========================================== */
@media (prefers-reduced-motion: reduce) {
    .topscore-popup-modal .modal-dialog,
    .topscore-popup-image img,
    .topscore-popup-close {
        transition: none !important;
    }
}

/* ===========================================
   ELEMENTOR EDITOR PREVIEW STYLES
   =========================================== */
.topscore-popup-editor-preview {
    background: #f7f7f7;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Settings Summary Bar */
.topscore-popup-settings-bar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 12px 15px;
    font-size: 12px;
}

.topscore-popup-settings-bar .settings-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.topscore-popup-settings-bar .settings-row.device-row {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.topscore-popup-settings-bar .setting-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.topscore-popup-settings-bar .setting-value {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: capitalize;
}

.topscore-popup-settings-bar .device-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    opacity: 0.5;
    transition: all 0.2s ease;
}

.topscore-popup-settings-bar .device-badge.active {
    background: rgba(255, 255, 255, 0.3);
    opacity: 1;
}

.topscore-popup-settings-bar .device-badge svg {
    width: 16px;
    height: 16px;
}

.topscore-popup-settings-bar .auto-open-badge {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.15);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
}

.topscore-popup-settings-bar .auto-open-badge.active {
    background: rgba(76, 175, 80, 0.5);
}

/* Visual Preview Area */
.topscore-popup-visual-preview {
    position: relative;
    min-height: 300px;
    background: #1a1a2e;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.topscore-popup-visual-preview .preview-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
}

.topscore-popup-visual-preview .preview-modal {
    position: relative;
    z-index: 1;
    max-width: 90%;
    width: auto;
}

.topscore-popup-visual-preview .preview-modal.modal-dialog-centered {
    display: flex;
    align-items: center;
}

.topscore-popup-visual-preview .preview-modal.modal-dialog-top {
    align-self: flex-start;
    margin-top: 10px;
}

.topscore-popup-visual-preview .preview-modal.modal-dialog-bottom {
    align-self: flex-end;
    margin-bottom: 10px;
}

.topscore-popup-visual-preview .preview-modal-content {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    padding: 15px;
    min-width: 300px;
}

/* Animation previews */
.topscore-popup-visual-preview .preview-modal-content.animate-fade {
    animation: previewFadeIn 0.5s ease;
}

.topscore-popup-visual-preview .preview-modal-content.animate-slide-down {
    animation: previewSlideDown 0.5s ease;
}

.topscore-popup-visual-preview .preview-modal-content.animate-slide-up {
    animation: previewSlideUp 0.5s ease;
}

.topscore-popup-visual-preview .preview-modal-content.animate-zoom {
    animation: previewZoom 0.5s ease;
}

.topscore-popup-visual-preview .preview-modal-content.animate-flip {
    animation: previewFlip 0.5s ease;
}

@keyframes previewFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes previewSlideDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes previewZoom {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes previewFlip {
    from { opacity: 0; transform: perspective(400px) rotateX(-20deg); }
    to { opacity: 1; transform: perspective(400px) rotateX(0); }
}

/* Preview close button */
.topscore-popup-visual-preview .topscore-popup-close {
    position: absolute;
    z-index: 10;
    background: #333;
    color: #fff;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
}

.topscore-popup-visual-preview .topscore-popup-close.close-inside-right {
    top: -10px;
    right: -10px;
}

.topscore-popup-visual-preview .topscore-popup-close.close-inside-left {
    top: -10px;
    left: -10px;
}

.topscore-popup-visual-preview .topscore-popup-close.close-outside-right {
    top: -15px;
    right: -35px;
}

.topscore-popup-visual-preview .topscore-popup-close.close-outside-left {
    top: -15px;
    left: -35px;
}

/* Preview modal body */
.topscore-popup-visual-preview .preview-modal-body {
    position: relative;
}

/* Preview container layouts */
.topscore-popup-visual-preview .topscore-popup-container {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

.topscore-popup-visual-preview .topscore-popup-horizontal {
    flex-direction: row;
    flex-wrap: nowrap;
}

.topscore-popup-visual-preview .topscore-popup-vertical {
    flex-direction: column;
}

.topscore-popup-visual-preview .topscore-popup-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.topscore-popup-visual-preview .topscore-popup-carousel,
.topscore-popup-visual-preview .topscore-popup-single {
    flex-direction: row;
}

/* Placeholder images */
.topscore-popup-visual-preview .topscore-popup-image {
    flex: 0 0 auto;
}

.topscore-popup-visual-preview .preview-placeholder-image {
    width: 120px;
    height: 90px;
    background: linear-gradient(135deg, #e0e0e0 0%, #f5f5f5 100%);
    border: 2px dashed #ccc;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    color: #999;
}

.topscore-popup-visual-preview .preview-placeholder-image svg {
    color: #bbb;
}

.topscore-popup-visual-preview .preview-placeholder-image .placeholder-text {
    font-size: 10px;
    text-align: center;
}

/* Single/Carousel specific */
.topscore-popup-visual-preview .topscore-popup-single .topscore-popup-image,
.topscore-popup-visual-preview .topscore-popup-carousel .topscore-popup-image {
    display: none;
}

.topscore-popup-visual-preview .topscore-popup-single .topscore-popup-image.active,
.topscore-popup-visual-preview .topscore-popup-carousel .topscore-popup-image.active {
    display: flex;
}

/* Preview navigation */
.topscore-popup-visual-preview .topscore-popup-carousel-wrapper {
    position: relative;
}

.topscore-popup-visual-preview .topscore-popup-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    z-index: 5;
}

.topscore-popup-visual-preview .topscore-popup-prev {
    left: -30px;
}

.topscore-popup-visual-preview .topscore-popup-next {
    right: -30px;
}

.topscore-popup-visual-preview .topscore-popup-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
}

.topscore-popup-visual-preview .topscore-popup-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.2);
    border: none;
    cursor: pointer;
    padding: 0;
}

.topscore-popup-visual-preview .topscore-popup-dot.active {
    background: #667eea;
}

/* Image hover effect previews */
.topscore-popup-visual-preview .topscore-popup-image.hover-zoom .preview-placeholder-image {
    transition: transform 0.3s ease;
}

.topscore-popup-visual-preview .topscore-popup-image.hover-zoom:hover .preview-placeholder-image {
    transform: scale(1.05);
}

.topscore-popup-visual-preview .topscore-popup-image.hover-brighten .preview-placeholder-image {
    transition: filter 0.3s ease;
}

.topscore-popup-visual-preview .topscore-popup-image.hover-brighten:hover .preview-placeholder-image {
    filter: brightness(1.15);
}

/* Info Notice */
.topscore-popup-info-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: #fff8e1;
    border-top: 1px solid #ffe082;
    font-size: 11px;
    color: #795548;
}

.topscore-popup-info-notice svg {
    flex-shrink: 0;
    color: #ffa000;
}
