/**
 * Promio Sync Frontend Styles
 * 
 * Styles for displaying ads on the frontend
 * 
 * @package Promio_Sync
 * @since 1.0.0
 */

/* ==========================================================================
   Variables (set via inline styles from PHP)
   ========================================================================== */

.ps-ad {
    --ps-primary: #00843D;
    --ps-secondary: #FFFFFF;
    --ps-accent: #FFD100;
    --ps-text: #FFFFFF;
}

/* ==========================================================================
   Single Ad Styles
   ========================================================================== */

.ps-ad {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background-color: var(--ps-primary);
    background-size: cover;
    background-position: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    box-sizing: border-box;
}

.ps-ad *,
.ps-ad *::before,
.ps-ad *::after {
    box-sizing: border-box;
}

.ps-ad__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* Default fallback - overridden by inline styles */
    background-color: #000000;
    opacity: 0.4;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.ps-ad__content {
    position: relative;
    z-index: 1;
    padding: 50px 60px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    min-height: 280px;
}

@media (max-width: 992px) {
    .ps-ad__content {
        padding: 40px;
        gap: 30px;
    }
}

@media (max-width: 768px) {
    .ps-ad__content {
        flex-direction: column;
        text-align: center;
        padding: 30px 20px;
        min-height: auto;
    }
}

/* Logo */
.ps-ad__logo {
    flex-shrink: 0;
    margin-bottom: 10px;
}

.ps-ad__logo img {
    max-height: 100px;
    max-width: 280px;
    width: auto;
    height: auto;
}

@media (max-width: 768px) {
    .ps-ad__logo img {
        max-height: 80px;
        max-width: 220px;
    }
}

/* Text Content */
.ps-ad__text {
    flex: 1;
    min-width: 280px;
}

.ps-ad__title {
    margin: 0 0 15px;
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
    font-style: italic;
}

@media (max-width: 992px) {
    .ps-ad__title {
        font-size: 26px;
    }
}

@media (max-width: 768px) {
    .ps-ad__title {
        font-size: 22px;
    }
}

.ps-ad__offer {
    margin-bottom: 15px;
}

.ps-ad__percentage {
    font-size: 72px;
    font-weight: 800;
    line-height: 1;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.4);
    letter-spacing: -2px;
    display: block;
}

@media (max-width: 992px) {
    .ps-ad__percentage {
        font-size: 56px;
    }
}

@media (max-width: 768px) {
    .ps-ad__percentage {
        font-size: 42px;
    }
}

.ps-ad__description {
    font-size: 18px;
    line-height: 1.5;
    margin-bottom: 12px;
}

.ps-ad__description p {
    margin: 0 0 8px;
}

.ps-ad__description p:last-child {
    margin-bottom: 0;
}

/* Preserve HTML formatting from WYSIWYG */
.ps-ad__description strong,
.ps-ad__description b {
    font-weight: 700;
}

.ps-ad__description em,
.ps-ad__description i {
    font-style: italic;
}

.ps-ad__description u {
    text-decoration: underline;
}

.ps-ad__fine-print {
    font-size: 12px;
    opacity: 0.85;
    line-height: 1.5;
    max-width: 700px;
}

/* CTA Section */
.ps-ad__cta {
    flex-shrink: 0;
    text-align: center;
    min-width: 200px;
}

.ps-ad__phone {
    margin-bottom: 20px;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ps-ad__phone-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    opacity: 0.9;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.ps-ad__phone a {
    font-size: 32px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
    display: block;
}

.ps-ad__phone a:hover {
    opacity: 0.85;
    transform: scale(1.02);
}

@media (max-width: 992px) {
    .ps-ad__phone a {
        font-size: 26px;
    }
}

@media (max-width: 768px) {
    .ps-ad__phone a {
        font-size: 22px;
    }
    
    .ps-ad__cta {
        min-width: auto;
        width: 100%;
    }
}

/* Button Styles */
.ps-ad__button {
    display: inline-block;
    padding: 16px 40px;
    font-size: 18px;
    font-weight: 700;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    min-width: 160px;
    text-align: center;
}

.ps-ad__button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    text-decoration: none;
}

.ps-ad__button:active {
    transform: translateY(-1px);
}

.ps-ad__button--default {
    border-radius: 4px;
}

.ps-ad__button--rounded {
    border-radius: 10px;
}

.ps-ad__button--pill {
    border-radius: 50px;
}

.ps-ad__button--outline {
    background: transparent !important;
    border: 3px solid currentColor;
}

.ps-ad__button--outline:hover {
    background: rgba(255, 255, 255, 0.15) !important;
}

.ps-ad__button--gradient {
    position: relative;
    overflow: hidden;
}

.ps-ad__button--gradient::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.ps-ad__button--gradient:hover::before {
    left: 100%;
}

.ps-ad__button--shadow {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.ps-ad__button--shadow:hover {
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

.ps-ad__button--glow {
    box-shadow: 0 0 25px currentColor;
}

.ps-ad__button--glow:hover {
    box-shadow: 0 0 35px currentColor, 0 0 50px currentColor;
}

@media (max-width: 768px) {
    .ps-ad__button {
        padding: 14px 30px;
        font-size: 16px;
        min-width: 140px;
    }
}

/* ==========================================================================
   Ad Style Variations
   ========================================================================== */

/* Banner Style (default) */
.ps-ad--banner {
    min-height: 200px;
}

/* Card Style */
.ps-ad--card {
    max-width: 400px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.ps-ad--card .ps-ad__content {
    flex-direction: column;
    text-align: center;
    padding: 30px;
}

.ps-ad--card .ps-ad__text {
    min-width: auto;
}

/* Minimal Style */
.ps-ad--minimal {
    background: transparent;
    border: 2px solid var(--ps-primary);
}

.ps-ad--minimal .ps-ad__overlay {
    display: none;
}

.ps-ad--minimal .ps-ad__content {
    padding: 20px;
}

.ps-ad--minimal .ps-ad__title,
.ps-ad--minimal .ps-ad__description,
.ps-ad--minimal .ps-ad__phone {
    color: var(--ps-primary) !important;
}

/* ==========================================================================
   Slider Styles
   ========================================================================== */

.ps-ads-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 8px;
}

.ps-ads-slider .ps-ad {
    border-radius: 0;
}

.ps-ads-slider .swiper-slide {
    height: auto;
}

.ps-ads-slider .swiper-pagination {
    bottom: 20px;
}

.ps-ads-slider .swiper-pagination-bullet {
    background: rgba(255, 255, 255, 0.5);
    opacity: 1;
    width: 12px;
    height: 12px;
    margin: 0 6px;
    transition: all 0.3s ease;
}

.ps-ads-slider .swiper-pagination-bullet-active {
    background: #fff;
    transform: scale(1.2);
}

.ps-ads-slider .swiper-button-prev,
.ps-ads-slider .swiper-button-next {
    color: #fff;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.ps-ads-slider .swiper-button-prev:hover,
.ps-ads-slider .swiper-button-next:hover {
    background: rgba(0, 0, 0, 0.5);
}

.ps-ads-slider .swiper-button-prev::after,
.ps-ads-slider .swiper-button-next::after {
    font-size: 20px;
    font-weight: 700;
}

@media (max-width: 768px) {
    .ps-ads-slider .swiper-button-prev,
    .ps-ads-slider .swiper-button-next {
        width: 40px;
        height: 40px;
    }
    
    .ps-ads-slider .swiper-button-prev::after,
    .ps-ads-slider .swiper-button-next::after {
        font-size: 16px;
    }
    
    .ps-ads-slider .swiper-pagination-bullet {
        width: 10px;
        height: 10px;
        margin: 0 4px;
    }
}

/* ==========================================================================
   Grid Styles
   ========================================================================== */

.ps-ads-grid {
    display: grid;
    gap: 20px;
}

.ps-ads-grid--2-cols {
    grid-template-columns: repeat(2, 1fr);
}

.ps-ads-grid--3-cols {
    grid-template-columns: repeat(3, 1fr);
}

.ps-ads-grid--4-cols {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 992px) {
    .ps-ads-grid--3-cols,
    .ps-ads-grid--4-cols {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .ps-ads-grid--2-cols,
    .ps-ads-grid--3-cols,
    .ps-ads-grid--4-cols {
        grid-template-columns: 1fr;
    }
}

.ps-ads-grid__item .ps-ad {
    height: 100%;
}

/* ==========================================================================
   Stack Styles
   ========================================================================== */

.ps-ads-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ==========================================================================
   No Ads Message
   ========================================================================== */

.ps-no-ads {
    padding: 40px;
    text-align: center;
    background: #f5f5f5;
    border-radius: 8px;
    color: #666;
    font-size: 14px;
}

/* ==========================================================================
   Loading States
   ========================================================================== */

/* Default state before image loads */
.ps-ad:not(.ps-ad--loaded) {
    background-color: var(--ps-primary, #00843D);
}

/* Loading animation placeholder */
.ps-ad:not(.ps-ad--loaded)::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 100%
    );
    animation: ps-shimmer 1.5s infinite;
    z-index: 0;
}

@keyframes ps-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* When image is loaded */
.ps-ad--loaded::before {
    display: none;
}

/* Image error fallback */
.ps-ad--image-error {
    background: linear-gradient(135deg, var(--ps-primary, #00843D) 0%, #005528 100%);
}

/* ==========================================================================
   Animation
   ========================================================================== */

.ps-ad--loaded {
    animation: ps-fade-in 0.4s ease;
}

@keyframes ps-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hover effects */
.ps-ad:hover .ps-ad__overlay {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.35) 100%);
    transition: background 0.3s ease;
}

/* ==========================================================================
   Responsive Classes (added by JS)
   ========================================================================== */

.ps-ad--mobile .ps-ad__content {
    padding: 25px 20px;
}

.ps-ad--mobile .ps-ad__percentage {
    font-size: 36px;
}

.ps-ad--mobile .ps-ad__title {
    font-size: 20px;
}

.ps-ad--tablet .ps-ad__content {
    padding: 35px 30px;
}

.ps-ad--tablet .ps-ad__percentage {
    font-size: 52px;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .ps-ad {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    .ps-ad__button {
        display: none;
    }
}

/* ==========================================================================
   Builder Layout Styles
   ========================================================================== */

.ps-promo--builder {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    box-sizing: border-box;
}

.ps-promo--builder *,
.ps-promo--builder *::before,
.ps-promo--builder *::after {
    box-sizing: border-box;
}

.ps-promo--builder .ps-promo__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 0;
}

.ps-promo--builder .ps-promo__builder-content {
    position: relative;
    z-index: 1;
    padding: 40px;
}

.ps-promo--builder .ps-promo__row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.ps-promo--builder .ps-promo__row:last-child {
    margin-bottom: 0;
}

.ps-promo--builder .ps-promo__col {
    min-width: 0;
}

/* Module spacing */
.ps-promo--builder .ps-promo__heading,
.ps-promo--builder .ps-promo__text,
.ps-promo--builder .ps-promo__image,
.ps-promo--builder .ps-promo__button-wrap,
.ps-promo--builder .ps-promo__logo,
.ps-promo--builder .ps-promo__phone,
.ps-promo--builder .ps-promo__percentage,
.ps-promo--builder .ps-promo__icon,
.ps-promo--builder .ps-promo__html {
    margin-bottom: 15px;
}

.ps-promo--builder .ps-promo__col > *:last-child {
    margin-bottom: 0;
}

/* Heading styles */
.ps-promo--builder .ps-promo__heading {
    margin: 0 0 15px;
    line-height: 1.2;
}

/* Text styles */
.ps-promo--builder .ps-promo__text p {
    margin: 0 0 10px;
}

.ps-promo--builder .ps-promo__text p:last-child {
    margin-bottom: 0;
}

/* Image styles */
.ps-promo--builder .ps-promo__image img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Button styles */
.ps-promo--builder .ps-promo__button {
    transition: all 0.2s ease;
}

.ps-promo--builder .ps-promo__button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Logo styles */
.ps-promo--builder .ps-promo__logo img {
    display: inline-block;
}

/* Phone styles */
.ps-promo--builder .ps-promo__phone a:hover {
    text-decoration: underline !important;
}

/* Percentage styles */
.ps-promo--builder .ps-promo__percentage {
    line-height: 1;
}

/* Icon styles */
.ps-promo--builder .ps-promo__icon .dashicons {
    display: inline-block;
    vertical-align: middle;
}

/* Responsive Builder Layout */
@media (max-width: 768px) {
    .ps-promo--builder .ps-promo__builder-content {
        padding: 25px 20px;
    }
    
    .ps-promo--builder .ps-promo__row {
        flex-direction: column;
    }
    
    .ps-promo--builder .ps-promo__col {
        flex: 1 0 100% !important;
    }
    
    .ps-promo--builder .ps-promo__heading {
        font-size: clamp(20px, 5vw, 32px) !important;
    }
    
    .ps-promo--builder .ps-promo__percentage {
        font-size: clamp(32px, 8vw, 48px) !important;
    }
}

