/**
 * PopUp LeadGen - Frontend Styles
 * 
 * Complete Phase 3 implementation with all customization support
 * 
 * @package PopUpLeadGen
 * @since 2.1.0
 */

/* ============================================
   TRIGGER BUTTON
   ============================================ */
.plg-trigger-btn {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    /* Background, color, padding applied inline from settings */
}

.plg-trigger-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    opacity: 0.95;
}

.plg-trigger-btn:active {
    transform: translateY(0);
}

.plg-trigger-btn:focus {
    outline: 2px solid currentColor;
    outline-offset: 3px;
}

/* ============================================
   OVERLAY
   ============================================ */
.plg-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.plg-overlay.plg-active {
    display: flex !important;
}

/* ============================================
   MODAL CONTAINER
   ============================================ */
.plg-modal {
    position: relative;
    width: 90%;
    max-width: 500px; /* Default, overridden by inline style */
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 16px;
    background: #ffffff !important; /* Default, overridden by inline style */
    /* Max-width, background color and shadow applied inline from settings */
}

/* Force background on all child elements to inherit or be transparent */
.plg-modal > * {
    background: transparent;
}

/* ============================================
   CLOSE BUTTON
   ============================================ */
.plg-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    color: #718096;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    padding: 0;
}

.plg-close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: rotate(90deg);
    color: #2d3748;
}

.plg-close-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* ============================================
   MODAL CONTENT
   ============================================ */
.plg-modal-content {
    padding: 50px 40px 40px;
}

/* ============================================
   HEADER
   ============================================ */
.plg-modal-header {
    margin-bottom: 30px;
}

.plg-headline {
    margin: 0 0 12px 0;
    line-height: 1.3;
    /* Font size, color, weight, align applied inline */
}

.plg-subheadline {
    margin: 0 0 0 0;
    line-height: 1.6;
    /* Font size, color, weight, align applied inline */
}

/* ============================================
   FORM CONTAINER
   ============================================ */
.plg-form-container {
    margin: 25px 0;
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
.plg-form {
    width: 100%;
}

.plg-form-group {
    margin-bottom: 20px;
}

.plg-form-group label {
    display: block;
    margin-bottom: 8px;
    /* Font size, color, weight, align applied inline */
}

.plg-required {
    color: #ef4444;
    margin-left: 3px;
}

.plg-form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid;
    border-radius: 8px;
    transition: all 0.3s ease;
    /* Font size, color, border-color applied inline */
}

.plg-form-group input:focus {
    outline: none;
    /* Border color and box-shadow applied inline */
}

.plg-form-group input::placeholder {
    color: #a0aec0;
}

/* ============================================
   SUBMIT BUTTON
   ============================================ */
.plg-submit-btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 10px;
    /* Background, color, font-size, font-weight applied inline */
}

.plg-submit-btn:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.plg-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================================
   EXTERNAL FORM
   ============================================ */
.plg-external-form {
    /* External form code from ConvertKit, Mailchimp, etc. */
}

.plg-external-form form {
    width: 100%;
}

.plg-external-form label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 8px;
}

.plg-external-form input[type="text"],
.plg-external-form input[type="email"],
.plg-external-form input[type="tel"] {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 15px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    background: #ffffff;
}

.plg-external-form input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.plg-external-form button,
.plg-external-form input[type="submit"] {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 8px;
    background: #3b82f6;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.plg-external-form button:hover,
.plg-external-form input[type="submit"]:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* ============================================
   FOOTER
   ============================================ */
.plg-footer {
    margin: 20px 0 0 0;
    line-height: 1.5;
    /* Font size, color, weight, align applied inline */
}

/* ============================================
   NO FORM FALLBACK
   ============================================ */
.plg-no-form {
    text-align: center;
    padding: 40px 20px;
    border-radius: 8px;
    color: #718096;
}

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

/* Fade Animation */
.plg-anim-fade .plg-modal {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.plg-anim-fade.plg-active .plg-modal {
    opacity: 1;
}

/* Slide Animation */
.plg-anim-slide .plg-modal {
    transform: translateY(-50px);
    opacity: 0;
    transition: all 0.4s ease;
}

.plg-anim-slide.plg-active .plg-modal {
    transform: translateY(0);
    opacity: 1;
}

/* Zoom Animation */
.plg-anim-zoom .plg-modal {
    transform: scale(0.7);
    opacity: 0;
    transition: all 0.3s ease;
}

.plg-anim-zoom.plg-active .plg-modal {
    transform: scale(1);
    opacity: 1;
}

/* No Animation */
.plg-anim-none .plg-modal {
    transition: none;
}

/* ============================================
   FORM VALIDATION STATES
   ============================================ */
.plg-form-group input.plg-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.plg-form-group input.plg-success {
    border-color: #10b981 !important;
}

.plg-error-message {
    display: block;
    color: #ef4444;
    font-size: 13px;
    margin-top: 5px;
}

/* ============================================
   LOADING STATE
   ============================================ */
.plg-submit-btn.plg-loading {
    position: relative;
    color: transparent !important;
}

.plg-submit-btn.plg-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: plg-spin 0.6s linear infinite;
    color: white;
}

@keyframes plg-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   SUCCESS MESSAGE
   ============================================ */
.plg-success-message {
    display: none;
    text-align: center;
    padding: 40px 20px;
    background: #d1fae5;
    border: 2px solid #10b981;
    border-radius: 12px;
    color: #065f46;
}

.plg-success-message.plg-show {
    display: block;
}

.plg-success-message h3 {
    margin: 0 0 10px 0;
    font-size: 24px;
    color: #065f46;
}

.plg-success-message p {
    margin: 0;
    color: #059669;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .plg-overlay {
        padding: 10px;
    }
    
    .plg-modal-content {
        padding: 40px 25px 30px;
    }
    
    .plg-close-btn {
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
    
    .plg-headline {
        font-size: 22px !important;
    }
    
    .plg-subheadline {
        font-size: 14px !important;
    }
    
    .plg-form-group input {
        padding: 12px 14px;
        font-size: 14px !important;
    }
    
    .plg-submit-btn {
        padding: 14px;
        font-size: 14px !important;
    }
}

@media (max-width: 480px) {
    .plg-modal {
        max-width: 100% !important;
        border-radius: 12px;
    }
    
    .plg-modal-content {
        padding: 35px 20px 25px;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
.plg-overlay:focus {
    outline: none;
}

.plg-modal:focus {
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
}

/* Screen reader only */
.plg-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ============================================
   PRINT
   ============================================ */
@media print {
    .plg-overlay {
        display: none !important;
    }
}

/* ============================================
   HIGH CONTRAST MODE
   ============================================ */
@media (prefers-contrast: high) {
    .plg-form-group input {
        border-width: 3px;
    }
    
    .plg-submit-btn {
        border: 2px solid currentColor;
    }
    
    .plg-close-btn {
        border: 2px solid currentColor;
        background: white;
    }
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .plg-overlay,
    .plg-modal,
    .plg-close-btn,
    .plg-submit-btn,
    .plg-form-group input {
        transition: none !important;
        animation: none !important;
    }
}
