/**
 * Hetra Live Sales Notification - Frontend Stylesheet
 * 
 * @package Hetra_Bildirim
 * @author Hetra.com.tr
 * @link https://hetra.com.tr
 */

:root {
    --hetra-primary: #e11d48;
    --hetra-primary-hover: #be123c;
    --hetra-font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Base Wrapper */
.hetra-popup-wrapper {
    position: fixed;
    z-index: 999999;
    pointer-events: none;
    font-family: var(--hetra-font-stack);
    box-sizing: border-box;
}

.hetra-popup-wrapper * {
    box-sizing: border-box;
}

/* Positions */
.hetra-popup-wrapper.hetra-pos-bottom-right {
    bottom: 24px;
    right: 24px;
}

.hetra-popup-wrapper.hetra-pos-bottom-left {
    bottom: 24px;
    left: 24px;
}

/* Card Container */
.hetra-popup-card {
    position: relative;
    pointer-events: auto;
    width: 390px;
    max-width: 90vw;
    border-radius: 16px;
    padding: 14px 16px 16px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    overflow: hidden !important;
    transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.35s ease;
    cursor: pointer;
    will-change: transform, opacity;
}

/* Themes */
.hetra-popup-card.hetra-theme-light {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: 0 16px 36px -6px rgba(15, 23, 42, 0.16), 0 4px 14px rgba(15, 23, 42, 0.05);
    color: #1e293b;
}

.hetra-popup-card.hetra-theme-dark {
    background: rgba(24, 24, 27, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(63, 63, 70, 0.8);
    box-shadow: 0 20px 40px -8px rgba(0, 0, 0, 0.6);
    color: #f4f4f5;
}

/* Layout Variations: Image on Right (Default) or Left */
.hetra-popup-card.hetra-img-right {
    flex-direction: row;
}

.hetra-popup-card.hetra-img-left {
    flex-direction: row-reverse;
}

.hetra-popup-card.hetra-img-left .hetra-popup-content-area {
    padding-right: 18px;
}

/* Content Area */
.hetra-popup-content-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Badge Row */
.hetra-popup-badge-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    margin-bottom: 5px !important;
    width: 100% !important;
}

.hetra-popup-badge-info {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-wrap: wrap !important;
    min-width: 0 !important;
}

.hetra-popup-badge {
    display: inline-flex !important;
    align-items: center !important;
    font-size: 10.5px !important;
    font-weight: 700 !important;
    letter-spacing: 0.2px !important;
    text-transform: uppercase !important;
    color: #15803d !important;
    background: #dcfce7 !important;
    padding: 2px 7px !important;
    border-radius: 9999px !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
}

.hetra-theme-dark .hetra-popup-badge {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.hetra-popup-time {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
}

/* Message Text */
.hetra-popup-message {
    font-size: 13px;
    line-height: 1.42;
    color: #334155;
    margin: 4px 0 10px 0;
    word-break: break-word;
}

.hetra-theme-dark .hetra-popup-message {
    color: #e2e8f0;
}

.hetra-popup-message strong,
.hetra-popup-message .hetra-product-name {
    color: #0f172a;
    font-weight: 600;
}

.hetra-theme-dark .hetra-popup-message strong,
.hetra-theme-dark .hetra-popup-message .hetra-product-name {
    color: #ffffff;
}

.hetra-popup-message .hetra-user-name {
    font-weight: 700;
    color: #0f172a;
}

.hetra-theme-dark .hetra-popup-message .hetra-user-name {
    color: #f8fafc;
}

.hetra-popup-message .hetra-user-city {
    color: #64748b;
    font-weight: 500;
}

.hetra-theme-dark .hetra-popup-message .hetra-user-city {
    color: #94a3b8;
}

.hetra-popup-message .hetra-product-variant {
    display: inline-block;
    background: #f1f5f9;
    color: #475569;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 5px;
    border: 1px solid #e2e8f0;
    margin: 0 2px;
    vertical-align: baseline;
}

.hetra-theme-dark .hetra-popup-message .hetra-product-variant {
    background: #27272a;
    border-color: #3f3f46;
    color: #e4e4e7;
}

/* Action Button */
.hetra-popup-action-row {
    display: flex;
    align-items: center;
}

.hetra-popup-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--hetra-primary, #e11d48);
    color: #ffffff !important;
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none !important;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    box-shadow: var(--hetra-btn-shadow, 0 4px 10px -2px rgba(225, 29, 72, 0.35));
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    line-height: 1.2;
}

.hetra-popup-btn:hover {
    background: var(--hetra-primary-hover, #be123c);
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: var(--hetra-btn-shadow-hover, 0 6px 14px -2px rgba(225, 29, 72, 0.5));
}

.hetra-popup-btn:active {
    transform: translateY(0);
}

.hetra-btn-icon {
    transition: transform 0.2s ease;
}

.hetra-popup-btn:hover .hetra-btn-icon {
    transform: translateX(2px);
}

/* Right-side (or Left) Product Image Box */
.hetra-popup-image-box {
    width: 78px;
    height: 78px;
    flex-shrink: 0;
    border-radius: 12px;
    overflow: hidden;
    background: #f8fafc;
    border: 1px solid rgba(0, 0, 0, 0.06);
    position: relative;
    box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.08);
}

.hetra-theme-dark .hetra-popup-image-box {
    background: #27272a;
    border-color: rgba(255, 255, 255, 0.1);
}

.hetra-popup-image-box a {
    display: block;
    width: 100%;
    height: 100%;
}

.hetra-popup-image-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.hetra-popup-card:hover .hetra-popup-image-box img {
    transform: scale(1.08);
}

/* Close Button (X) - Positioned at top-right of popup card */
.hetra-popup-close {
    all: unset !important;
    box-sizing: border-box !important;
    position: absolute !important;
    top: 9px !important;
    right: 9px !important;
    width: 22px !important;
    height: 22px !important;
    min-width: 22px !important;
    min-height: 22px !important;
    max-width: 22px !important;
    max-height: 22px !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid rgba(226, 232, 240, 0.9) !important;
    color: #64748b !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    padding: 0 !important;
    margin: 0 !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    flex-shrink: 0 !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1) !important;
    line-height: 1 !important;
    z-index: 30 !important;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.hetra-popup-close svg {
    width: 10px !important;
    height: 10px !important;
    display: block !important;
    stroke: currentColor !important;
    transition: transform 0.2s ease !important;
    pointer-events: none !important;
    flex-shrink: 0 !important;
}

.hetra-popup-close:hover {
    background: #fee2e2 !important;
    border-color: #fca5a5 !important;
    color: #ef4444 !important;
    transform: scale(1.12) !important;
    box-shadow: 0 3px 8px rgba(239, 68, 68, 0.25) !important;
}

.hetra-popup-close:hover svg {
    transform: rotate(90deg) !important;
}

.hetra-popup-close:active {
    transform: scale(0.95) !important;
}

.hetra-theme-dark .hetra-popup-close {
    background: rgba(39, 39, 42, 0.95) !important;
    border-color: rgba(63, 63, 70, 0.9) !important;
    color: #a1a1aa !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4) !important;
}

.hetra-theme-dark .hetra-popup-close:hover {
    background: rgba(239, 68, 68, 0.25) !important;
    border-color: #ef4444 !important;
    color: #f87171 !important;
}

/* Progress Countdown Bar */
.hetra-popup-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.04);
    overflow: hidden;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
}

.hetra-theme-dark .hetra-popup-progress {
    background: rgba(255, 255, 255, 0.06);
}

.hetra-popup-progress-bar {
    height: 100%;
    width: 100%;
    background: var(--hetra-primary, #e11d48);
    transform-origin: left;
    transform: scaleX(1);
}

/* Animations */
.hetra-anim-slide-in-right {
    animation: hetraSlideInRight 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hetra-anim-slide-out-right {
    animation: hetraSlideOutRight 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hetra-anim-slide-in-left {
    animation: hetraSlideInLeft 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hetra-anim-slide-out-left {
    animation: hetraSlideOutLeft 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes hetraSlideInRight {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.94);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes hetraSlideOutRight {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
}

@keyframes hetraSlideInLeft {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.94);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes hetraSlideOutLeft {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
}

/* Responsive: Tablet Layout (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .hetra-popup-wrapper.hetra-pos-bottom-right {
        right: 14px !important;
        bottom: 14px !important;
    }

    .hetra-popup-wrapper.hetra-pos-bottom-left {
        left: 14px !important;
        bottom: 14px !important;
    }

    .hetra-popup-card {
        max-width: 290px !important;
        padding: 6px 10px !important;
        gap: 8px !important;
        border-radius: 12px !important;
    }

    .hetra-popup-image-box {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        max-width: 44px !important;
        min-height: 44px !important;
        max-height: 44px !important;
        border-radius: 8px !important;
    }

    .hetra-popup-message {
        font-size: 11px !important;
        line-height: 1.25 !important;
    }

    .hetra-popup-btn {
        font-size: 10px !important;
        padding: 3px 8px !important;
    }

    .hetra-popup-close {
        width: 16px !important;
        height: 16px !important;
        min-width: 16px !important;
        min-height: 16px !important;
        top: 4px !important;
        right: 4px !important;
    }
}

/* Responsive: Ultra-Minimal Mobile Layout (767px and below) */
@media (max-width: 767px) {
    .hetra-popup-wrapper.hetra-pos-bottom-right {
        left: auto !important;
        right: 8px !important;
        bottom: 8px !important;
        width: auto !important;
        max-width: calc(100vw - 16px) !important;
        display: flex !important;
        justify-content: flex-end !important;
    }

    .hetra-popup-wrapper.hetra-pos-bottom-left {
        right: auto !important;
        left: 8px !important;
        bottom: 8px !important;
        width: auto !important;
        max-width: calc(100vw - 16px) !important;
        display: flex !important;
        justify-content: flex-start !important;
    }

    /* Ultra-Minimal Featherweight Card */
    .hetra-popup-card {
        width: auto !important;
        max-width: 240px !important;
        padding: 4px 7px !important;
        gap: 6px !important;
        border-radius: 8px !important;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14) !important;
        border-width: 1px !important;
    }

    /* Micro Product Thumbnail */
    .hetra-popup-image-box {
        width: 34px !important;
        height: 34px !important;
        min-width: 34px !important;
        max-width: 34px !important;
        min-height: 34px !important;
        max-height: 34px !important;
        border-radius: 6px !important;
    }

    .hetra-popup-img {
        border-radius: 5px !important;
    }

    /* Micro Badge & Time Row */
    .hetra-popup-badge-row {
        margin-bottom: 1px !important;
        gap: 3px !important;
    }

    .hetra-popup-badge {
        font-size: 7.5px !important;
        padding: 0 4px !important;
        border-radius: 3px !important;
        line-height: 1.2 !important;
    }

    .hetra-popup-time {
        font-size: 8px !important;
        line-height: 1.2 !important;
    }

    /* Concise Typography (Max 2 lines) */
    .hetra-popup-message {
        font-size: 9.5px !important;
        line-height: 1.22 !important;
        margin-bottom: 2px !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
    }

    .hetra-popup-message .hetra-product-variant {
        font-size: 8px !important;
        padding: 0 3px !important;
        border-radius: 3px !important;
        margin: 0 1px !important;
    }

    /* Tiny CTA Button */
    .hetra-popup-action-row {
        margin-top: 2px !important;
    }

    .hetra-popup-btn {
        font-size: 8.5px !important;
        padding: 2px 6px !important;
        gap: 3px !important;
        border-radius: 4px !important;
        line-height: 1.2 !important;
    }

    .hetra-popup-btn .hetra-btn-icon {
        width: 8px !important;
        height: 8px !important;
    }

    /* Micro Close Button */
    .hetra-popup-close {
        width: 14px !important;
        height: 14px !important;
        min-width: 14px !important;
        min-height: 14px !important;
        top: 2px !important;
        right: 2px !important;
        border-radius: 50% !important;
    }

    .hetra-popup-close svg {
        width: 6.5px !important;
        height: 6.5px !important;
    }

    /* Thin Progress Bar */
    .hetra-popup-progress {
        height: 2px !important;
    }
}
