/**
 * WELLCOSTA Popup Manager - Frontend Stílusok
 * 
 * @package Wellcosta_Popup
 * @author Kostyál Árpád - WELLCOSTA.DEV
 */

/* CSS Variables (felülírhatók inline stílusokkal) */
.wellcosta-popup-overlay {
    --popup-bg: #ffffff;
    --popup-text: #333333;
    --popup-btn-bg: #2c5530;
    --popup-btn-text: #ffffff;
    --popup-overlay: rgba(0, 0, 0, 0.7);
    --popup-radius: 16px;
}

/* Overlay */
.wellcosta-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--popup-overlay);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.wellcosta-popup-overlay.wellcosta-popup-visible {
    opacity: 1;
    visibility: visible;
}

/* Position Variants */
.wellcosta-popup-position-top {
    align-items: flex-start;
    padding-top: 60px;
}

.wellcosta-popup-position-bottom {
    align-items: flex-end;
    padding-bottom: 60px;
}

.wellcosta-popup-position-bottom-right {
    align-items: flex-end;
    justify-content: flex-end;
    padding: 30px;
}

.wellcosta-popup-position-bottom-left {
    align-items: flex-end;
    justify-content: flex-start;
    padding: 30px;
}

/* Container */
.wellcosta-popup-container {
    background: var(--popup-bg);
    border-radius: var(--popup-radius);
    max-width: 440px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
    position: relative;
}

/* Animation States */
.wellcosta-popup-container {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

/* Fade Scale Animation */
.wellcosta-popup-overlay[data-animation="fade-scale"] .wellcosta-popup-container {
    transform: scale(0.8);
    opacity: 0;
}

.wellcosta-popup-overlay[data-animation="fade-scale"].wellcosta-popup-visible .wellcosta-popup-container {
    transform: scale(1);
    opacity: 1;
}

/* Slide Up Animation */
.wellcosta-popup-overlay[data-animation="slide-up"] .wellcosta-popup-container {
    transform: translateY(50px);
    opacity: 0;
}

.wellcosta-popup-overlay[data-animation="slide-up"].wellcosta-popup-visible .wellcosta-popup-container {
    transform: translateY(0);
    opacity: 1;
}

/* Slide Down Animation */
.wellcosta-popup-overlay[data-animation="slide-down"] .wellcosta-popup-container {
    transform: translateY(-50px);
    opacity: 0;
}

.wellcosta-popup-overlay[data-animation="slide-down"].wellcosta-popup-visible .wellcosta-popup-container {
    transform: translateY(0);
    opacity: 1;
}

/* Bounce Animation */
.wellcosta-popup-overlay[data-animation="bounce"] .wellcosta-popup-container {
    transform: scale(0.5);
    opacity: 0;
}

.wellcosta-popup-overlay[data-animation="bounce"].wellcosta-popup-visible .wellcosta-popup-container {
    transform: scale(1);
    opacity: 1;
    animation: wellcostaPopupBounce 0.5s ease;
}

@keyframes wellcostaPopupBounce {
    0% { transform: scale(0.5); }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

/* Content Wrapper */
.wellcosta-popup-content-wrapper {
    padding: 40px;
    overflow-y: auto;
    max-height: 90vh;
    position: relative;
}

/* Close Button */
.wellcosta-popup-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--popup-text);
    opacity: 0.6;
    transition: all 0.2s ease;
    z-index: 10;
    padding: 0;
}

.wellcosta-popup-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.1);
    transform: rotate(90deg);
}

.wellcosta-popup-close svg {
    width: 18px;
    height: 18px;
}

/* Image */
.wellcosta-popup-image {
    margin: -40px -40px 24px -40px;
    overflow: hidden;
}

.wellcosta-popup-image img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 200px;
    object-fit: cover;
}

/* Icon */
.wellcosta-popup-icon {
    text-align: center;
    margin-bottom: 20px;
}

.wellcosta-popup-icon svg {
    color: var(--popup-btn-bg);
    stroke: var(--popup-btn-bg);
}

/* Title */
.wellcosta-popup-title {
    margin: 0 0 12px 0;
    font-size: 26px;
    font-weight: 700;
    text-align: center;
    color: var(--popup-text);
    line-height: 1.3;
}

/* Description */
.wellcosta-popup-description {
    margin: 0 0 28px 0;
    font-size: 15px;
    text-align: center;
    color: var(--popup-text);
    opacity: 0.75;
    line-height: 1.6;
}

/* Form */
.wellcosta-popup-form {
    width: 100%;
}

/* Form Fields */
.wellcosta-popup-field {
    margin-bottom: 14px;
}

.wellcosta-popup-field:last-child {
    margin-bottom: 0;
}

/* Input */
.wellcosta-popup-input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    font-size: 15px;
    color: var(--popup-text);
    background: rgba(0, 0, 0, 0.02);
    transition: all 0.2s ease;
    box-sizing: border-box;
    font-family: inherit;
}

.wellcosta-popup-input:focus {
    outline: none;
    border-color: var(--popup-btn-bg);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(44, 85, 48, 0.1);
}

.wellcosta-popup-input::placeholder {
    color: var(--popup-text);
    opacity: 0.4;
}

.wellcosta-popup-input.wellcosta-popup-error-field {
    border-color: #dc3545;
    animation: wellcostaPopupShake 0.4s ease;
}

@keyframes wellcostaPopupShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

/* GDPR Checkbox */
.wellcosta-popup-gdpr {
    margin-top: 16px;
    margin-bottom: 16px;
}

.wellcosta-popup-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-size: 13px;
    color: var(--popup-text);
    line-height: 1.5;
    user-select: none;
}

.wellcosta-popup-checkbox input[type="checkbox"] {
    display: none;
}

.wellcosta-popup-checkmark {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-top: 1px;
}

.wellcosta-popup-checkbox input[type="checkbox"]:checked + .wellcosta-popup-checkmark {
    background: var(--popup-btn-bg);
    border-color: var(--popup-btn-bg);
}

.wellcosta-popup-checkbox input[type="checkbox"]:checked + .wellcosta-popup-checkmark::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -2px;
}

.wellcosta-popup-gdpr-text {
    flex: 1;
    opacity: 0.8;
}

.wellcosta-popup-gdpr-text a {
    color: var(--popup-btn-bg);
    text-decoration: underline;
}

.wellcosta-popup-gdpr-text a:hover {
    text-decoration: none;
}

.wellcosta-popup-gdpr.wellcosta-popup-error-field .wellcosta-popup-checkmark {
    border-color: #dc3545;
}

/* Button */
.wellcosta-popup-button {
    width: 100%;
    padding: 16px 28px;
    background: var(--popup-btn-bg);
    color: var(--popup-btn-text);
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: inherit;
    text-transform: none;
    letter-spacing: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.wellcosta-popup-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    filter: brightness(1.05);
}

.wellcosta-popup-button:active {
    transform: translateY(0);
}

.wellcosta-popup-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Spinner */
.wellcosta-popup-spinner {
    animation: wellcostaPopupSpin 1s linear infinite;
}

@keyframes wellcostaPopupSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Error Message */
.wellcosta-popup-error {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    text-align: center;
    margin-top: 14px;
    animation: wellcostaPopupFadeIn 0.3s ease;
}

@keyframes wellcostaPopupFadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Success State */
.wellcosta-popup-success-wrapper {
    text-align: center;
    animation: wellcostaPopupFadeIn 0.4s ease;
}

.wellcosta-popup-success-icon {
    margin-bottom: 24px;
}

.wellcosta-popup-success-icon svg {
    color: #28a745;
    stroke: #28a745;
    animation: wellcostaPopupSuccessCheck 0.5s ease 0.2s both;
}

@keyframes wellcostaPopupSuccessCheck {
    from { 
        stroke-dasharray: 100;
        stroke-dashoffset: 100;
        opacity: 0;
        transform: scale(0.8);
    }
    to { 
        stroke-dashoffset: 0;
        opacity: 1;
        transform: scale(1);
    }
}

.wellcosta-popup-success-title {
    margin: 0 0 12px 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--popup-text);
}

.wellcosta-popup-success-message {
    margin: 0 0 28px 0;
    font-size: 15px;
    color: var(--popup-text);
    opacity: 0.75;
    line-height: 1.6;
}

.wellcosta-popup-close-success {
    background: rgba(0, 0, 0, 0.06);
    color: var(--popup-text);
    opacity: 0.8;
}

.wellcosta-popup-close-success:hover {
    background: rgba(0, 0, 0, 0.1);
    opacity: 1;
}

/* Responsive */
@media (max-width: 480px) {
    .wellcosta-popup-overlay {
        padding: 12px;
    }
    
    .wellcosta-popup-container {
        max-width: 100%;
    }
    
    .wellcosta-popup-content-wrapper {
        padding: 30px 24px;
    }
    
    .wellcosta-popup-title {
        font-size: 22px;
    }
    
    .wellcosta-popup-description {
        font-size: 14px;
    }
    
    .wellcosta-popup-input {
        padding: 12px 16px;
        font-size: 16px; /* Prevents iOS zoom */
    }
    
    .wellcosta-popup-button {
        padding: 14px 24px;
        font-size: 15px;
    }
    
    .wellcosta-popup-image {
        margin: -30px -24px 20px -24px;
    }
    
    .wellcosta-popup-close {
        top: 12px;
        right: 12px;
        width: 32px;
        height: 32px;
    }
    
    .wellcosta-popup-position-bottom-right,
    .wellcosta-popup-position-bottom-left {
        justify-content: center;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .wellcosta-popup-input {
        border-width: 3px;
    }
    
    .wellcosta-popup-button {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .wellcosta-popup-overlay,
    .wellcosta-popup-container,
    .wellcosta-popup-close,
    .wellcosta-popup-input,
    .wellcosta-popup-button {
        transition: none;
    }
    
    .wellcosta-popup-container {
        animation: none;
    }
    
    .wellcosta-popup-spinner {
        animation: none;
    }
}

/* Dark mode support (optional - if theme supports) */
@media (prefers-color-scheme: dark) {
    .wellcosta-popup-overlay.wellcosta-popup-auto-theme {
        --popup-bg: #1a1a2e;
        --popup-text: #eaeaea;
        --popup-overlay: rgba(0, 0, 0, 0.85);
    }
}

/* Print styles */
@media print {
    .wellcosta-popup-overlay {
        display: none !important;
    }
}

