/* Frontend CSS for Aragon Popup Creator - All Display Types */

/* Variables */
:root {
    --aragon-z-banners: 9999995;
    --aragon-z-widgets: 9999997;
    --aragon-z-popups: 9999999;
    --aragon-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    --aragon-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --aragon-border-radius: 8px;
}

/* ===========================================
   POPUP STYLES (Modal Overlays)
   =========================================== */

/* Popup Overlays */
.aragon-popup-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: var(--aragon-z-popups);
    backdrop-filter: blur(2px);
    animation: aragon-fade-in 0.3s ease-out;
}

.aragon-popup-overlay.aragon-popup-center {
    justify-content: center;
    align-items: center;
}

.aragon-popup-overlay.aragon-popup-top-center {
    justify-content: center;
    align-items: flex-start;
    padding-top: 10vh;
}

.aragon-popup-overlay.aragon-popup-bottom-center {
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 10vh;
}

/* Popup Container */
.aragon-popup {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    background: transparent;
    padding: 0;
    border-radius: 0;
    text-align: center;
    animation: aragon-scale-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Popup Images */
.aragon-popup img {
    border: 5px solid #fff;
    border-radius: var(--aragon-border-radius);
    max-width: 100%;
    height: auto;
    box-shadow: var(--aragon-shadow);
    transition: var(--aragon-transition);
}

.aragon-popup a:hover img {
    transform: scale(1.02);
}

/* Popup Close Button */
.aragon-popup-close {
    position: absolute;
    padding: 5px 10px;
    top: 5px;
    right: 5px;
    background: #ffffff;
    border: 2px solid #ccc;
    border-radius: 50%;
    font-size: 20px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    z-index: 10000;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-family: Arial, sans-serif;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: var(--aragon-transition);
}

.aragon-popup-close:hover {
    color: #ff0000;
    background-color: #f8f8f8;
    border-color: #ff0000;
    transform: scale(1.1);
}

.aragon-popup-close:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* ===========================================
   WIDGET STYLES (Fixed Corner Elements)
   =========================================== */

/* Widget Base */
.aragon-widget {
    position: fixed;
    width: 280px;
    max-height: 150px;
    z-index: var(--aragon-z-widgets);
    border-radius: var(--aragon-border-radius);
    box-shadow: var(--aragon-shadow);
    overflow: hidden;
    transition: var(--aragon-transition);
    cursor: pointer;
    background: white;
}

/* Remove pointer cursor for widgets without links */
.aragon-widget.aragon-widget-no-link {
    cursor: default;
}

/* Reduce hover effects for widgets without links */
.aragon-widget.aragon-widget-no-link:hover {
    transform: none;
    box-shadow: var(--aragon-shadow);
}

.aragon-widget.aragon-widget-no-link:hover .aragon-widget-image {
    transform: none;
}

.aragon-widget:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* Special hover effects for centered widgets to preserve centering */
.aragon-widget-right-center:hover,
.aragon-widget-left-center:hover {
    transform: translateY(-50%) translateY(-2px) scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* Override for centered widgets without links */
.aragon-widget.aragon-widget-no-link.aragon-widget-right-center:hover,
.aragon-widget.aragon-widget-no-link.aragon-widget-left-center:hover {
    transform: translateY(-50%);
    box-shadow: var(--aragon-shadow);
}

/* Widget Positioning */
.aragon-widget-top-right {
    top: 20px;
    right: 20px;
}

.aragon-widget-top-left {
    top: 20px;
    left: 20px;
}

.aragon-widget-right-center {
    top: 40%;
    right: 20px;
    transform: translateY(-50%);
}

.aragon-widget-left-center {
    top: 40%;
    left: 20px;
    transform: translateY(-50%);
}

.aragon-widget-bottom-right {
    bottom: 20px;
    right: 20px;
}

.aragon-widget-bottom-left {
    bottom: 20px;
    left: 20px;
}

/* Widget Stacking - Multiple widgets in same corner/edge */
.aragon-widget-top-right:nth-of-type(n+2) {
    top: calc(20px + (160px * var(--stack-index, 1)));
}

.aragon-widget-top-left:nth-of-type(n+2) {
    top: calc(20px + (160px * var(--stack-index, 1)));
}

.aragon-widget-right-center:nth-of-type(n+2) {
    top: calc(40% + (160px * var(--stack-index, 1)));
    transform: translateY(-50%);
}

.aragon-widget-right-center:nth-of-type(n+2):hover {
    transform: translateY(-50%) translateY(-2px) scale(1.02);
}

.aragon-widget-left-center:nth-of-type(n+2) {
    top: calc(40% + (160px * var(--stack-index, 1)));
    transform: translateY(-50%);
}

.aragon-widget-left-center:nth-of-type(n+2):hover {
    transform: translateY(-50%) translateY(-2px) scale(1.02);
}

.aragon-widget-bottom-right:nth-of-type(n+2) {
    bottom: calc(20px + (160px * var(--stack-index, 1)));
}

.aragon-widget-bottom-left:nth-of-type(n+2) {
    bottom: calc(20px + (160px * var(--stack-index, 1)));
}

/* Widget Images */
.aragon-widget-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: var(--aragon-transition);
}

.aragon-widget:hover .aragon-widget-image {
    transform: scale(1.05);
}

/* Widget Links */
.aragon-widget-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
}

/* Widget Close Button */
.aragon-widget-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    font-size: 14px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    z-index: 10001;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-family: Arial, sans-serif;
    transition: var(--aragon-transition);
    backdrop-filter: blur(4px);
}

.aragon-widget-close:hover {
    color: #ff0000;
    background-color: rgba(255, 255, 255, 1);
    border-color: #ff0000;
    transform: scale(1.1);
}

/* ===========================================
   BANNER STYLES (Top/Bottom Bars)
   =========================================== */

/* Banner Base */
.aragon-banner {
    position: relative;
    width: 100%;
    z-index: var(--aragon-z-banners);
    background: white;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: var(--aragon-transition);
    animation: aragon-slide-down 0.5s ease-out;
}

.aragon-banner-top {
    position: relative;
    top: 0;
    margin-bottom: 0;
}

.aragon-banner-bottom {
    position: relative;
    bottom: 0;
    margin-top: 0;
    border-bottom: none;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    animation: aragon-slide-up 0.5s ease-out;
}

/* Sticky Banners */
.aragon-banner-sticky.aragon-banner-top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--aragon-z-banners);
}

.aragon-banner-sticky.aragon-banner-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: var(--aragon-z-banners);
}

/* Push content down for sticky top banners */
body:has(.aragon-banner-sticky.aragon-banner-top) {
    padding-top: 80px; /* Adjust based on typical banner height */
}

body:has(.aragon-banner-sticky.aragon-banner-bottom) {
    padding-bottom: 80px; /* Adjust based on typical banner height */
}

/* Banner Images */
.aragon-banner-image {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: cover;
    display: block;
    transition: var(--aragon-transition);
}

.aragon-banner:hover .aragon-banner-image {
    transform: scale(1.01);
}

/* Banner Links */
.aragon-banner-link {
    display: block;
    width: 100%;
    text-decoration: none;
}

/* Banner Close Button */
.aragon-banner-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    font-size: 16px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    z-index: 10001;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-family: Arial, sans-serif;
    transition: var(--aragon-transition);
    backdrop-filter: blur(4px);
}

.aragon-banner-close:hover {
    color: #ff0000;
    background-color: rgba(255, 255, 255, 1);
    border-color: #ff0000;
    transform: scale(1.1);
}

/* Banner text and marquee styles */
.aragon-banner-text {
    font-size: 16px;
    line-height: 1.4;
    color: #333;
    font-family: inherit;
}

.aragon-banner-marquee .aragon-marquee-content {
    display: inline-block;
    animation: aragon-marquee 15s linear infinite;
    padding-left: 100%;
    white-space: nowrap;
}

@keyframes aragon-marquee {
    0% {
        transform: translate3d(0, 0, 0);
    }
    100% {
        transform: translate3d(-100%, 0, 0);
    }
}

/* ===========================================
   RESPONSIVE DESIGN
   =========================================== */

/* Tablet adjustments */
@media (max-width: 768px) {
    .aragon-popup {
        max-width: 95vw;
        max-height: 95vh;
    }
    
    .aragon-widget {
        width: 240px;
        max-height: 120px;
    }
    
    .aragon-widget-top-right,
    .aragon-widget-bottom-right {
        right: 15px;
    }
    
    .aragon-widget-top-left,
    .aragon-widget-bottom-left {
        left: 15px;
    }
    
    .aragon-widget-top-right,
    .aragon-widget-top-left {
        top: 15px;
    }
    
    .aragon-widget-bottom-right,
    .aragon-widget-bottom-left {
        bottom: 15px;
    }
    
    .aragon-banner-image {
        max-height: 150px;
    }
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .aragon-popup {
        max-width: 98vw;
        max-height: 98vh;
    }
    
    .aragon-popup img {
        border-width: 3px;
    }
    
    .aragon-widget {
        width: 200px;
        max-height: 100px;
    }
    
    .aragon-widget-top-right,
    .aragon-widget-bottom-right {
        right: 10px;
    }
    
    .aragon-widget-top-left,
    .aragon-widget-bottom-left {
        left: 10px;
    }
    
    .aragon-widget-top-right,
    .aragon-widget-top-left {
        top: 10px;
    }
    
    .aragon-widget-bottom-right,
    .aragon-widget-bottom-left {
        bottom: 10px;
    }
    
    .aragon-widget-close {
        width: 28px;
        height: 28px;
        font-size: 16px;
        top: 5px;
        right: 5px;
    }
    
    /* Reduce widget stacking spacing on mobile */
    .aragon-widget-top-right:nth-of-type(n+2) {
        top: calc(10px + (110px * var(--stack-index, 1)));
    }
    
    .aragon-widget-top-left:nth-of-type(n+2) {
        top: calc(10px + (110px * var(--stack-index, 1)));
    }
    
    .aragon-widget-bottom-right:nth-of-type(n+2) {
        bottom: calc(10px + (110px * var(--stack-index, 1)));
    }
    
    .aragon-widget-bottom-left:nth-of-type(n+2) {
        bottom: calc(10px + (110px * var(--stack-index, 1)));
    }
    
    .aragon-widget-right-center:nth-of-type(n+2) {
        top: calc(40% + (110px * var(--stack-index, 1)));
        transform: translateY(-50%);
    }
    
    .aragon-widget-left-center:nth-of-type(n+2) {
        top: calc(40% + (110px * var(--stack-index, 1)));
        transform: translateY(-50%);
    }
    
    .aragon-widget-right-center:nth-of-type(n+2):hover {
        transform: translateY(-50%) translateY(-2px) scale(1.02);
    }
    
    .aragon-widget-left-center:nth-of-type(n+2):hover {
        transform: translateY(-50%) translateY(-2px) scale(1.02);
    }
    
    .aragon-banner-close {
        width: 24px;
        height: 24px;
        font-size: 14px;
        top: 8px;
        right: 8px;
    }
    
    .aragon-banner-image {
        max-height: 120px;
    }
}

/* ===========================================
   ANIMATIONS
   =========================================== */

@keyframes aragon-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes aragon-scale-in {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes aragon-slide-down {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes aragon-slide-up {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes aragon-widget-bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

@keyframes aragon-widget-bounce-centered {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(-50%);
    }
    40% {
        transform: translateY(-50%) translateY(-10px);
    }
    60% {
        transform: translateY(-50%) translateY(-5px);
    }
}

/* Widget entrance animation */
.aragon-widget {
    animation: aragon-scale-in 0.5s ease-out, aragon-widget-bounce 1s ease-in-out 0.5s;
}

/* Centered widgets use different bounce animation */
.aragon-widget-right-center,
.aragon-widget-left-center {
    animation: aragon-scale-in 0.5s ease-out, aragon-widget-bounce-centered 1s ease-in-out 0.5s;
}

/* ===========================================
   ACCESSIBILITY
   =========================================== */

/* Screen reader text */
.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
}

/* Focus indicators */
.aragon-popup-close:focus,
.aragon-widget-close:focus,
.aragon-banner-close:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .aragon-popup img {
        border-color: #000;
    }
    
    .aragon-widget {
        border-color: #000;
    }
    
    .aragon-banner {
        border-color: #000;
    }
    
    .aragon-popup-close,
    .aragon-widget-close,
    .aragon-banner-close {
        border-color: #000;
        background: #fff;
        color: #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .aragon-popup-overlay,
    .aragon-popup,
    .aragon-widget,
    .aragon-banner,
    .aragon-popup img,
    .aragon-widget-image,
    .aragon-banner-image {
        animation: none;
        transition: none;
    }
    
    .aragon-popup-close:hover,
    .aragon-widget-close:hover,
    .aragon-banner-close:hover {
        transform: none;
    }
}

/* ===========================================
   PRINT STYLES
   =========================================== */

@media print {
    .aragon-popup-overlay,
    .aragon-widget,
    .aragon-banner {
        display: none !important;
    }
}