/**
 * Promo Popup Pro - Frontend Styles
 * Premium, Mobile-Responsive Popup Design
 * Optimized for Performance and UX
 */

/* CSS Variables - Will be overridden by PHP inline styles */
:root {
    --ppp-primary: #f97316;
    --ppp-secondary: #1e3a5f;
    --ppp-accent: #10b981;
    --ppp-text: #1f2937;
    --ppp-text-light: #64748b;
    --ppp-bg: #ffffff;
    --ppp-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --ppp-radius: 16px;
}

/* Overlay */
.ppp-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.ppp-overlay.ppp-visible {
    opacity: 1;
    visibility: visible;
}

/* Main Popup Container */
.ppp-popup {
    position: fixed;
    z-index: 9999999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.ppp-popup.ppp-visible {
    opacity: 1;
    visibility: visible;
}

/* Position: Left */
.ppp-popup.ppp-position-left {
    left: 20px;
    bottom: 20px;
    transform: translateX(-120%);
}

.ppp-popup.ppp-position-left.ppp-visible {
    transform: translateX(0);
}

/* Position: Right */
.ppp-popup.ppp-position-right {
    right: 20px;
    bottom: 20px;
    transform: translateX(120%);
}

.ppp-popup.ppp-position-right.ppp-visible {
    transform: translateX(0);
}

/* Position: Center (Modal) */
.ppp-popup.ppp-position-center {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.8);
}

.ppp-popup.ppp-position-center.ppp-visible {
    transform: translate(-50%, -50%) scale(1);
}

/* Animation: Fade */
.ppp-popup.ppp-anim-fade {
    transform: none;
}

.ppp-popup.ppp-anim-fade.ppp-position-left {
    transform: none;
}

.ppp-popup.ppp-anim-fade.ppp-position-right {
    transform: none;
}

.ppp-popup.ppp-anim-fade.ppp-position-center {
    transform: translate(-50%, -50%);
}

/* Animation: Scale */
.ppp-popup.ppp-anim-scale {
    transform: scale(0.5);
}

.ppp-popup.ppp-anim-scale.ppp-visible {
    transform: scale(1);
}

.ppp-popup.ppp-anim-scale.ppp-position-center {
    transform: translate(-50%, -50%) scale(0.5);
}

.ppp-popup.ppp-anim-scale.ppp-position-center.ppp-visible {
    transform: translate(-50%, -50%) scale(1);
}

/* Animation: Bounce */
.ppp-popup.ppp-anim-bounce {
    animation: none;
}

.ppp-popup.ppp-anim-bounce.ppp-visible {
    animation: pppBounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes pppBounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Popup Content Wrapper */
.ppp-popup-inner {
    background: var(--ppp-bg);
    border-radius: var(--ppp-radius);
    box-shadow: var(--ppp-shadow);
    overflow: hidden;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
}

/* Close Button */
.ppp-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.ppp-close:hover {
    transform: scale(1.1);
    background: #fff;
}

.ppp-close svg {
    width: 16px;
    height: 16px;
    color: #64748b;
    transition: color 0.2s ease;
}

.ppp-close:hover svg {
    color: #1f2937;
}

/* Header Image */
.ppp-header-image {
    position: relative;
    width: 100%;
    height: auto;
    min-height: 120px;
    max-height: 220px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--ppp-secondary) 0%, #2d5a7f 100%);
}

.ppp-header-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
}

.ppp-header-image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 180px;
    color: white;
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--ppp-secondary) 0%, #3d6b8f 50%, var(--ppp-secondary) 100%);
    position: relative;
    overflow: hidden;
}

.ppp-header-image-placeholder::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    pointer-events: none;
}

.ppp-header-greeting {
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.9;
    margin-bottom: 4px;
}

.ppp-header-month {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-style: italic;
    font-size: 32px;
    font-weight: 400;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ppp-header-tagline {
    font-size: 11px;
    margin-top: 10px;
    opacity: 0.8;
    letter-spacing: 0.5px;
    font-weight: 400;
}

/* Content Area */
.ppp-content {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.ppp-subheading {
    font-size: 13px;
    color: var(--ppp-text-light);
    margin-bottom: 6px;
    font-weight: 500;
}

.ppp-heading {
    font-size: 22px;
    font-weight: 700;
    color: var(--ppp-secondary);
    margin: 0 0 12px 0;
    line-height: 1.25;
}

.ppp-offer-text {
    font-size: 14px;
    color: var(--ppp-text);
    line-height: 1.6;
    margin-bottom: 8px;
}

.ppp-offer-text p {
    margin: 0 0 0.8em 0;
    font-size: 14px;
}

.ppp-offer-text p:last-child {
    margin-bottom: 0;
}

.ppp-offer-text br {
    display: block;
    content: "";
    margin-top: 0.5em;
}

.ppp-offer-text ul,
.ppp-offer-text ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

.ppp-offer-text li {
    margin-bottom: 0.3em;
}

.ppp-offer-text strong,
.ppp-offer-text b {
    color: var(--ppp-secondary);
}

.ppp-offer-details {
    font-size: 14px;
    color: var(--ppp-text);
    line-height: 1.6;
    margin-bottom: 16px;
}

.ppp-offer-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 16px;
}

/* Buttons */
.ppp-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.ppp-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-align: left;
}

.ppp-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.ppp-btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    flex-shrink: 0;
}

.ppp-btn-primary .ppp-btn-icon {
    background: rgba(255, 255, 255, 0.2);
}

.ppp-btn-secondary .ppp-btn-icon {
    background: rgba(30, 58, 95, 0.1);
    color: var(--ppp-secondary);
}

.ppp-btn-accent .ppp-btn-icon {
    background: rgba(249, 115, 22, 0.15);
}

.ppp-btn-text {
    flex: 1;
}

.ppp-btn-primary {
    background: var(--ppp-primary);
    color: white;
}

.ppp-btn-primary:hover {
    background: #ea580c;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.35);
}

.ppp-btn-secondary {
    background: #f1f5f9;
    color: var(--ppp-text);
}

.ppp-btn-secondary:hover {
    background: #e2e8f0;
    transform: translateY(-1px);
}

.ppp-btn-accent {
    background: rgba(249, 115, 22, 0.1);
    color: var(--ppp-primary);
}

.ppp-btn-accent:hover {
    background: rgba(249, 115, 22, 0.15);
    transform: translateY(-1px);
}

.ppp-btn-arrow {
    margin-left: auto;
    opacity: 0;
    transform: translateX(-4px);
    transition: all 0.2s ease;
}

.ppp-btn:hover .ppp-btn-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* Social Proof / Share Buttons */
.ppp-social {
    display: flex;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

.ppp-social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f1f5f9;
    color: var(--ppp-text-light);
    text-decoration: none;
    transition: all 0.2s ease;
}

.ppp-social-btn:hover {
    background: var(--ppp-primary);
    color: white;
    transform: scale(1.1);
}

.ppp-social-btn svg {
    width: 18px;
    height: 18px;
}

/* Form Container */
.ppp-form-container {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

.ppp-form-container iframe {
    width: 100%;
    min-height: 200px;
    border: none;
}

/* Footer */
.ppp-footer {
    padding: 12px 24px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.ppp-footer-text {
    font-size: 11px;
    color: var(--ppp-text-light);
}

.ppp-footer-link {
    color: var(--ppp-primary);
    text-decoration: none;
}

.ppp-footer-link:hover {
    text-decoration: underline;
}

/* Don't show again link */
.ppp-dismiss {
    display: block;
    text-align: center;
    font-size: 12px;
    color: var(--ppp-text-light);
    text-decoration: none;
    padding: 8px;
    margin-top: 8px;
    transition: color 0.2s ease;
}

.ppp-dismiss:hover {
    color: var(--ppp-text);
}

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

@media (max-width: 768px) {
    .ppp-popup {
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        transform: translateY(100%) !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .ppp-popup.ppp-visible {
        transform: translateY(0) !important;
    }
    
    .ppp-popup.ppp-position-center {
        top: auto !important;
        left: 0 !important;
        transform: translateY(100%) !important;
    }
    
    .ppp-popup.ppp-position-center.ppp-visible {
        transform: translateY(0) !important;
    }
    
    .ppp-popup-inner {
        border-radius: var(--ppp-radius) var(--ppp-radius) 0 0;
        max-height: 85vh;
    }
    
    .ppp-close {
        top: 16px;
        right: 16px;
        width: 40px;
        height: 40px;
    }
    
    .ppp-close svg {
        width: 20px;
        height: 20px;
    }
    
    .ppp-header-image {
        min-height: 100px;
        max-height: 140px;
    }
    
    .ppp-header-month {
        font-size: 26px;
    }
    
    .ppp-header-greeting {
        font-size: 12px;
    }
    
    .ppp-header-tagline {
        font-size: 10px;
    }
    
    .ppp-content {
        padding: 20px;
    }
    
    .ppp-heading {
        font-size: 20px;
    }
    
    .ppp-btn {
        padding: 5px 12px;
    }

    /* Safe area for iOS devices */
    .ppp-popup-inner {
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
}

@media (max-width: 480px) {
    .ppp-header-image-placeholder {
        height: 110px;
    }
    
    .ppp-header-greeting {
        font-size: 11px;
        letter-spacing: 1.5px;
    }
    
    .ppp-header-month {
        font-size: 24px;
    }
    
    .ppp-header-tagline {
        font-size: 10px;
        margin-top: 6px;
    }
    
    .ppp-content {
        padding: 16px;
    }
    
    .ppp-heading {
        font-size: 18px;
    }
    
    .ppp-offer-text,
    .ppp-offer-details {
        font-size: 13px;
    }
    
    .ppp-btn {
        padding: 5px 10px;
        font-size: 12px;
    }
}

/* ==========================================
   REDUCED MOTION SUPPORT
   ========================================== */

@media (prefers-reduced-motion: reduce) {
    .ppp-popup,
    .ppp-overlay,
    .ppp-btn,
    .ppp-close {
        transition: none !important;
        animation: none !important;
    }
    
    .ppp-popup.ppp-visible {
        transform: none !important;
    }
    
    .ppp-popup.ppp-position-center.ppp-visible {
        transform: translate(-50%, -50%) !important;
    }
}

/* ==========================================
   DARK MODE SUPPORT (Optional)
   ========================================== */

@media (prefers-color-scheme: dark) {
    .ppp-popup.ppp-dark-mode .ppp-popup-inner {
        background: #1e293b;
    }
    
    .ppp-popup.ppp-dark-mode .ppp-heading {
        color: #f1f5f9;
    }
    
    .ppp-popup.ppp-dark-mode .ppp-offer-text,
    .ppp-popup.ppp-dark-mode .ppp-offer-details {
        color: #cbd5e1;
    }
    
    .ppp-popup.ppp-dark-mode .ppp-btn-secondary {
        background: #334155;
        color: #f1f5f9;
    }
    
    .ppp-popup.ppp-dark-mode .ppp-footer {
        background: #0f172a;
        border-color: #334155;
    }
}

/* ==========================================
   PRINT STYLES
   ========================================== */

@media print {
    .ppp-popup,
    .ppp-overlay {
        display: none !important;
    }
}

/* ==========================================
   VIEW SWITCHING (Main View / Form View)
   ========================================== */

.ppp-view {
    display: none;
}

.ppp-view.ppp-view-active {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ppp-view-form {
    background: var(--ppp-bg);
}

.ppp-form-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.ppp-back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--ppp-text-light);
    transition: all 0.2s ease;
}

.ppp-back-btn:hover {
    background: white;
    border-color: var(--ppp-primary);
    color: var(--ppp-primary);
}

.ppp-back-btn svg {
    width: 16px;
    height: 16px;
}

.ppp-form-title {
    flex: 1;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--ppp-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ppp-form-fullview {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.ppp-form-fullview iframe {
    width: 100%;
    min-height: 350px;
    border: none;
}

/* ==========================================
   TEMPLATE STYLES
   ========================================== */

/* ---- MODERN (Default) ---- */
.ppp-template-modern .ppp-popup-inner {
    border-radius: var(--ppp-radius);
}

.ppp-template-modern .ppp-header-image {
    border-radius: 0;
}

/* ---- CLASSIC ---- */
.ppp-template-classic .ppp-popup-inner {
    border-radius: 0;
    border: 3px solid var(--ppp-secondary);
}

.ppp-template-classic .ppp-header-image {
    margin: 12px;
    border-radius: 0;
    border: 1px solid #e2e8f0;
    min-height: 100px;
    max-height: 140px;
}

.ppp-template-classic .ppp-header-image img {
    border-radius: 0;
}

.ppp-template-classic .ppp-header-image-placeholder {
    border-radius: 0;
}

.ppp-template-classic .ppp-content {
    padding-top: 12px;
}

.ppp-template-classic .ppp-btn {
    border-radius: 0;
}

.ppp-template-classic .ppp-close {
    border-radius: 0;
    top: 16px;
    right: 16px;
}

/* ---- MINIMAL ---- */
.ppp-template-minimal .ppp-popup-inner {
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
}

.ppp-template-minimal .ppp-content {
    padding: 32px 28px;
}

.ppp-template-minimal .ppp-heading {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 16px;
}

.ppp-template-minimal .ppp-offer-text {
    font-size: 15px;
    line-height: 1.7;
}

.ppp-template-minimal .ppp-btn {
    justify-content: center;
    text-align: center;
}

.ppp-template-minimal .ppp-btn-icon {
    display: none;
}

.ppp-template-minimal .ppp-btn-arrow {
    display: none;
}

/* ---- BOLD ---- */
.ppp-template-bold .ppp-popup-inner {
    border-radius: 0;
    background: var(--ppp-primary);
}

.ppp-template-bold .ppp-header-image {
    display: none;
}

.ppp-template-bold .ppp-content {
    padding: 32px 24px;
    text-align: center;
}

.ppp-template-bold .ppp-subheading {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ppp-template-bold .ppp-heading {
    color: white;
    font-size: 28px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -0.5px;
}

.ppp-template-bold .ppp-offer-text,
.ppp-template-bold .ppp-offer-details {
    color: rgba(255, 255, 255, 0.9);
}

.ppp-template-bold .ppp-btn {
    justify-content: center;
    background: white;
    color: var(--ppp-primary);
}

.ppp-template-bold .ppp-btn:hover {
    background: #f8fafc;
    transform: scale(1.02);
}

.ppp-template-bold .ppp-btn-icon {
    background: rgba(249, 115, 22, 0.1);
    color: var(--ppp-primary);
}

.ppp-template-bold .ppp-dismiss {
    color: rgba(255, 255, 255, 0.7);
}

.ppp-template-bold .ppp-dismiss:hover {
    color: white;
}

.ppp-template-bold .ppp-close {
    background: rgba(255, 255, 255, 0.2);
}

.ppp-template-bold .ppp-close svg {
    color: white;
}

.ppp-template-bold .ppp-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ---- ELEGANT ---- */
.ppp-template-elegant .ppp-popup-inner {
    border-radius: 20px;
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.2);
    border: none;
}

.ppp-template-elegant .ppp-header-image {
    margin: 16px 16px 0 16px;
    border-radius: 12px;
    overflow: hidden;
}

.ppp-template-elegant .ppp-header-image-placeholder {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.ppp-template-elegant .ppp-content {
    padding: 28px;
}

.ppp-template-elegant .ppp-subheading {
    font-style: italic;
    font-weight: 400;
}

.ppp-template-elegant .ppp-heading {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-weight: 400;
    font-size: 24px;
    letter-spacing: -0.3px;
}

.ppp-template-elegant .ppp-btn {
    border-radius: 50px;
}

.ppp-template-elegant .ppp-btn-icon {
    border-radius: 50%;
}

.ppp-template-elegant .ppp-close {
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(4px);
}

/* ---- COMPACT ---- */
.ppp-template-compact .ppp-popup-inner {
    border-radius: 12px;
    max-width: 340px;
}

.ppp-template-compact .ppp-content {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
}

.ppp-template-compact .ppp-compact-image {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
}

.ppp-template-compact .ppp-compact-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ppp-template-compact .ppp-subheading {
    display: none;
}

.ppp-template-compact .ppp-heading {
    flex: 1;
    min-width: 200px;
    font-size: 16px;
    margin-bottom: 0;
}

.ppp-template-compact .ppp-offer-text {
    width: 100%;
    font-size: 13px;
    margin-bottom: 8px;
}

.ppp-template-compact .ppp-offer-details {
    display: none;
}

.ppp-template-compact .ppp-buttons {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
}

.ppp-template-compact .ppp-btn {
    flex: 1;
    min-width: 120px;
    padding: 10px 14px;
    font-size: 12px;
    justify-content: center;
}

.ppp-template-compact .ppp-btn-icon {
    width: 24px;
    height: 24px;
}

.ppp-template-compact .ppp-btn-arrow {
    display: none;
}

.ppp-template-compact .ppp-dismiss {
    width: 100%;
    font-size: 11px;
    padding: 6px;
    margin-top: 4px;
}

.ppp-template-compact .ppp-close {
    width: 28px;
    height: 28px;
    top: 8px;
    right: 8px;
}

.ppp-template-compact .ppp-close svg {
    width: 14px;
    height: 14px;
}

/* ==========================================
   TEMPLATE MOBILE OVERRIDES
   ========================================== */

@media (max-width: 768px) {
    .ppp-template-bold .ppp-heading {
        font-size: 22px;
    }
    
    .ppp-template-elegant .ppp-header-image {
        margin: 12px 12px 0 12px;
    }
    
    .ppp-template-compact .ppp-buttons {
        flex-direction: column;
    }
    
    .ppp-template-compact .ppp-btn {
        min-width: 100%;
    }
}
