/**
 * TREJKA AdStack - Frontend Styles
 * @package WPAdStack
 */

.wpas-ad {
    display: block;
    margin: 20px 0;
    text-align: center;
    clear: both;
}

.wpas-ad img {
    max-width: 100%;
    height: auto;
    display: inline-block;
}

.wpas-ad-link {
    display: inline-block;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.wpas-ad-link:hover {
    opacity: 0.9;
}

.wpas-ad-custom_code {
    line-height: 0;
}

.wpas-ad-custom_code > * {
    line-height: normal;
}

.wpas-ad-rich_text {
    line-height: 1.6;
    text-align: left;
}

.wpas-ad-rich_text p:first-child { margin-top: 0; }
.wpas-ad-rich_text p:last-child { margin-bottom: 0; }

/* ==========================================
   POPUP STYLES
   ========================================== */

.wpas-popup-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
}

.wpas-popup-wrapper.wpas-popup-active {
    display: flex;
}

/* Overlay */
.wpas-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.wpas-popup-no-overlay .wpas-popup-overlay {
    display: none;
}

/* Popup Container */
.wpas-popup {
    position: relative;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-height: 90vh;
    overflow: auto;
    z-index: 1;
}

/* Popup Sizes */
.wpas-popup-small {
    width: 100%;
    max-width: 400px;
}

.wpas-popup-medium {
    width: 100%;
    max-width: 600px;
}

.wpas-popup-large {
    width: 100%;
    max-width: 800px;
}

.wpas-popup-fullscreen {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
}

/* Popup Positions */
.wpas-popup-pos-center {
    /* Default - already centered by flexbox */
}

.wpas-popup-pos-top {
    align-self: flex-start;
    margin-top: 40px;
}

.wpas-popup-pos-bottom {
    align-self: flex-end;
    margin-bottom: 40px;
}

.wpas-popup-wrapper:has(.wpas-popup-pos-bottom-right) {
    align-items: flex-end;
    justify-content: flex-end;
}

.wpas-popup-pos-bottom-right {
    margin: 0 20px 20px 0;
    border-radius: 12px;
}

.wpas-popup-wrapper:has(.wpas-popup-pos-bottom-left) {
    align-items: flex-end;
    justify-content: flex-start;
}

.wpas-popup-pos-bottom-left {
    margin: 0 0 20px 20px;
    border-radius: 12px;
}

/* Close Button */
.wpas-popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.wpas-popup-close:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.wpas-popup-close.wpas-close-hidden {
    opacity: 0;
    pointer-events: none;
}

/* Popup Content */
.wpas-popup-content {
    padding: 24px;
}

.wpas-popup-content img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ==========================================
   POPUP ANIMATIONS
   ========================================== */

/* Fade */
.wpas-popup-anim-fade {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.wpas-popup-active .wpas-popup-anim-fade {
    opacity: 1;
}

/* Slide Up */
.wpas-popup-anim-slide-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.wpas-popup-active .wpas-popup-anim-slide-up {
    opacity: 1;
    transform: translateY(0);
}

/* Slide Down */
.wpas-popup-anim-slide-down {
    opacity: 0;
    transform: translateY(-30px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.wpas-popup-active .wpas-popup-anim-slide-down {
    opacity: 1;
    transform: translateY(0);
}

/* Scale / Zoom */
.wpas-popup-anim-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.wpas-popup-active .wpas-popup-anim-scale {
    opacity: 1;
    transform: scale(1);
}

/* No animation */
.wpas-popup-anim-none {
    opacity: 1;
}

/* Overlay animation */
.wpas-popup-overlay {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.wpas-popup-active .wpas-popup-overlay {
    opacity: 1;
}

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

@media screen and (max-width: 768px) {
    .wpas-ad { margin: 15px 0; }
    
    .wpas-popup-wrapper {
        padding: 15px;
    }
    
    .wpas-popup {
        max-width: 100% !important;
        max-height: 85vh;
    }
    
    .wpas-popup-pos-top,
    .wpas-popup-pos-bottom {
        margin: 0;
    }
    
    .wpas-popup-pos-bottom-right,
    .wpas-popup-pos-bottom-left {
        margin: 0;
    }
    
    .wpas-popup-content {
        padding: 16px;
    }
    
    .wpas-popup-close {
        top: 8px;
        right: 8px;
        width: 28px;
        height: 28px;
        font-size: 20px;
    }
}

@media print {
    .wpas-ad { display: none !important; }
    .wpas-popup-wrapper { display: none !important; }
    .wpas-bar { display: none !important; }
    .wpas-sticky { display: none !important; }
}

/* ==========================================
   ANNOUNCEMENT BARS
   ========================================== */

.wpas-bar {
    position: relative;
    width: 100%;
    z-index: 99990;
    font-size: 14px;
    line-height: 1.5;
}

.wpas-bar-sticky {
    position: fixed;
    left: 0;
    right: 0;
}

.wpas-bar-top.wpas-bar-sticky {
    top: 0;
}

.wpas-bar-bottom.wpas-bar-sticky {
    bottom: 0;
}

.wpas-bar-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 12px 50px 12px 20px;
    flex-wrap: wrap;
}

.wpas-bar-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.wpas-bar-content {
    text-align: center;
}

.wpas-bar-content a {
    color: inherit;
    text-decoration: underline;
}

.wpas-bar-countdown {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.wpas-bar-countdown .wpas-countdown-item {
    display: flex;
    align-items: baseline;
}

.wpas-bar-countdown .wpas-countdown-value {
    font-size: 16px;
}

.wpas-bar-countdown .wpas-countdown-label {
    font-size: 11px;
    opacity: 0.8;
    margin-left: 1px;
}

.wpas-bar-countdown .wpas-countdown-sep {
    opacity: 0.6;
}

.wpas-bar-button {
    display: inline-flex;
    align-items: center;
    padding: 6px 16px;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    color: inherit;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.wpas-bar-button:hover {
    background: rgba(255,255,255,0.3);
    color: inherit;
}

.wpas-bar-close {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: inherit;
    opacity: 0.7;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    transition: opacity 0.2s ease;
}

.wpas-bar-close:hover {
    opacity: 1;
}

.wpas-bar-close .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Bar Styles */
.wpas-bar-style-info {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: #fff;
}

.wpas-bar-style-sale {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    color: #fff;
}

.wpas-bar-style-success {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: #fff;
}

.wpas-bar-style-warning {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    color: #fff;
}

.wpas-bar-style-dark {
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
    color: #fff;
}

/* Bar Animations */
.wpas-bar-anim-slide {
    transform: translateY(-100%);
    transition: transform 0.4s ease;
}

.wpas-bar-bottom.wpas-bar-anim-slide {
    transform: translateY(100%);
}

.wpas-bar-anim-slide.wpas-bar-visible {
    transform: translateY(0);
}

.wpas-bar-anim-fade {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.wpas-bar-anim-fade.wpas-bar-visible {
    opacity: 1;
}

.wpas-bar-anim-none.wpas-bar-visible {
    opacity: 1;
}

.wpas-bar-hidden {
    display: none !important;
}

/* ==========================================
   COUNTDOWN TIMERS
   ========================================== */

.wpas-timer {
    display: inline-flex;
    align-items: center;
    font-family: inherit;
}

.wpas-timer-units {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wpas-timer-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 50px;
}

.wpas-timer-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    color: var(--wpas-timer-text, #fff);
}

.wpas-timer-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
    color: var(--wpas-timer-label, #94a3b8);
}

.wpas-timer-sep {
    font-size: 24px;
    font-weight: 700;
    color: var(--wpas-timer-text, #fff);
    opacity: 0.5;
    margin: 0 -2px;
}

/* Timer Styles */
.wpas-timer-style-boxes .wpas-timer-unit {
    background: var(--wpas-timer-bg, #1E293B);
    padding: 12px 8px;
    border-radius: 8px;
    min-width: 60px;
}

.wpas-timer-style-boxes .wpas-timer-sep {
    background: none;
    padding: 0;
}

.wpas-timer-style-flip .wpas-timer-unit {
    background: var(--wpas-timer-bg, #1E293B);
    padding: 15px 10px;
    border-radius: 6px;
    min-width: 65px;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.wpas-timer-style-flip .wpas-timer-unit::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: rgba(0,0,0,0.2);
    transform: translateY(-4px);
}

.wpas-timer-style-flip .wpas-timer-value {
    font-size: 32px;
}

.wpas-timer-style-minimal .wpas-timer-unit {
    min-width: auto;
    padding: 0 4px;
    background: none;
}

.wpas-timer-style-minimal .wpas-timer-value {
    font-size: 20px;
    color: inherit;
}

.wpas-timer-style-minimal .wpas-timer-label {
    display: none;
}

.wpas-timer-style-minimal .wpas-timer-sep {
    font-size: 18px;
    color: inherit;
}

.wpas-timer-style-inline .wpas-timer-inline {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.wpas-timer-expired {
    font-size: 16px;
    font-weight: 600;
    color: #EF4444;
}

/* ==========================================
   STICKY SIDE ELEMENTS
   ========================================== */

.wpas-sticky {
    position: fixed;
    z-index: 99980;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.wpas-sticky-hidden {
    opacity: 0;
    pointer-events: none;
}

.wpas-sticky-left {
    left: 0;
}

.wpas-sticky-right {
    right: 0;
}

.wpas-sticky-align-top {
    top: 100px;
}

.wpas-sticky-align-middle {
    top: 50%;
    transform: translateY(-50%);
}

.wpas-sticky-align-middle.wpas-sticky-hidden {
    transform: translateY(-50%) translateX(-20px);
}

.wpas-sticky-right.wpas-sticky-align-middle.wpas-sticky-hidden {
    transform: translateY(-50%) translateX(20px);
}

.wpas-sticky-align-bottom {
    bottom: 100px;
}

.wpas-sticky-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    text-decoration: none;
    transition: all 0.2s ease;
    overflow: hidden;
}

.wpas-sticky-left .wpas-sticky-item {
    border-radius: 0 8px 8px 0;
}

.wpas-sticky-right .wpas-sticky-item {
    border-radius: 8px 0 0 8px;
}

.wpas-sticky-icon {
    font-size: 22px;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.wpas-sticky-text {
    display: none;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 500;
    margin-left: 8px;
}

/* Expand on hover */
.wpas-sticky-expand .wpas-sticky-item:hover {
    width: auto;
    padding: 0 16px;
}

.wpas-sticky-expand .wpas-sticky-item:hover .wpas-sticky-text {
    display: inline;
}

/* Button Styles */
.wpas-sticky-style-square .wpas-sticky-item,
.wpas-sticky-style-square.wpas-sticky-left .wpas-sticky-item,
.wpas-sticky-style-square.wpas-sticky-right .wpas-sticky-item {
    border-radius: 0;
}

.wpas-sticky-style-pill .wpas-sticky-item {
    border-radius: 24px;
    margin: 0 8px;
}

/* Type-specific colors (defaults) */
.wpas-sticky-item-phone { background: #03D424; color: #fff; }
.wpas-sticky-item-email { background: #2196F3; color: #fff; }
.wpas-sticky-item-whatsapp { background: #25D366; color: #fff; }
.wpas-sticky-item-messenger { background: #0084FF; color: #fff; }
.wpas-sticky-item-scroll_top { background: #1E293B; color: #fff; }
.wpas-sticky-item-cta { background: #EF4444; color: #fff; }
.wpas-sticky-item-custom { background: #6366F1; color: #fff; }

.wpas-sticky-item:hover {
    filter: brightness(1.1);
    transform: scale(1.05);
}

/* ==========================================
   RESPONSIVE - NEW MODULES
   ========================================== */

@media screen and (max-width: 768px) {
    /* Bars */
    .wpas-bar-inner {
        padding: 10px 40px 10px 15px;
        gap: 10px;
        font-size: 13px;
    }
    
    .wpas-bar-button {
        padding: 5px 12px;
        font-size: 12px;
    }
    
    .wpas-bar-countdown .wpas-countdown-value {
        font-size: 14px;
    }
    
    /* Timers */
    .wpas-timer-value {
        font-size: 22px;
    }
    
    .wpas-timer-unit {
        min-width: 45px;
    }
    
    .wpas-timer-style-boxes .wpas-timer-unit {
        padding: 10px 6px;
        min-width: 50px;
    }
    
    /* Sticky */
    .wpas-sticky-hide-mobile {
        display: none !important;
    }
    
    .wpas-sticky-item {
        width: 44px;
        height: 44px;
    }
    
    .wpas-sticky-icon {
        font-size: 20px;
        width: 20px;
        height: 20px;
    }
}
