/**
 * Pangoleads 3 Elementor Modal Styles
 * Estilos para o widget Modal do Elementor
 */

/* ============================================================
   Modal Container
============================================================ */

.pango-elementor-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}

.pango-elementor-modal.pango-elementor-modal-closed {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.pango-elementor-modal.pango-elementor-modal-open {
    display: flex;
    opacity: 1;
    pointer-events: all;
}

/* ============================================================
   Overlay
============================================================ */

.pango-elementor-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.pango-elementor-modal-overlay:hover {
    background-color: rgba(0, 0, 0, 0.6);
}

/* ============================================================
   Modal Content
============================================================ */

.pango-elementor-modal-content {
    position: relative;
    z-index: 1;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: pango-slide-in 0.3s ease;
    padding: 30px;
}

/* ============================================================
   Close Button
============================================================ */

.pango-elementor-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    font-weight: 300;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    z-index: 10;
}

.pango-elementor-modal-close:hover {
    color: #333;
}

.pango-elementor-modal-close:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* ============================================================
   Modal Body (Title, Subtitle, Description)
============================================================ */

.pango-elementor-modal-body {
    padding: 0;
}

.pango-elementor-modal-title {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 600;
    color: #1d2327;
    line-height: 1.3;
}

.pango-elementor-modal-subtitle {
    margin: 0 0 16px 0;
    font-size: 14px;
    color: #646970;
    line-height: 1.4;
}

.pango-elementor-modal-description {
    margin: 0 0 20px 0;
    font-size: 14px;
    color: #50575e;
    line-height: 1.5;
}

/* ============================================================
   Modal Form
============================================================ */

.pango-elementor-modal-form {
    margin-top: 0;
}

.pango-elementor-modal-form .pangoleads-form {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
}

.pango-elementor-modal-form .pangoleads-form-group {
    margin-bottom: 20px;
}

.pango-elementor-modal-form .pangoleads-form-group:last-child {
    margin-bottom: 0;
}

/* ============================================================
   Trigger Button
============================================================ */

.pango-elementor-modal-trigger {
    display: inline-block;
    padding: 12px 24px;
    background-color: #0073aa;
    color: white;
    border: 1px solid #005a87;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.pango-elementor-modal-trigger:hover {
    background-color: #005a87;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

.pango-elementor-modal-trigger:active {
    transform: translateY(0);
}

.pango-elementor-modal-trigger:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* ============================================================
   Animations
============================================================ */

@keyframes pango-slide-in {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pango-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ============================================================
   Sidebar Modal
============================================================ */

.pango-elementor-modal[data-modal-type="sidebar"] {
    align-items: stretch;
    justify-content: flex-end;
}

.pango-elementor-modal[data-modal-type="sidebar"] .pango-elementor-modal-content {
    width: 400px;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    animation: pango-slide-in-right 0.3s ease;
}

@keyframes pango-slide-in-right {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

/* ============================================================
   Inline Form
============================================================ */

.pango-elementor-form-inline {
    width: 100%;
}

.pango-elementor-form-inline .pangoleads-form {
    background: transparent;
}

/* ============================================================
   Responsive
============================================================ */

@media (max-width: 768px) {
    .pango-elementor-modal-content {
        width: 95%;
        max-height: 90vh;
        padding: 20px;
    }

    .pango-elementor-modal[data-modal-type="sidebar"] .pango-elementor-modal-content {
        width: 100%;
    }

    .pango-elementor-modal-close {
        top: 10px;
        right: 10px;
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .pango-elementor-modal-content {
        width: 100%;
        max-height: 100%;
        border-radius: 12px 12px 0 0;
        position: fixed;
        bottom: 0;
        top: auto;
    }

    .pango-elementor-modal {
        align-items: flex-end;
    }

    .pango-elementor-modal-trigger {
        width: 100%;
    }

    .pango-elementor-form-inline {
        max-width: 100%;
    }
}

/* ============================================================
   Loading State
============================================================ */

.pango-elementor-modal.loading .pango-elementor-modal-content {
    opacity: 0.6;
    pointer-events: none;
}

.pango-elementor-modal.loading .pango-elementor-modal-content::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 115, 170, 0.2);
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* ============================================================
   Accessibility
============================================================ */

.pango-elementor-modal-close:focus-visible,
.pango-elementor-modal-trigger:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Melhorar contraste para modo escuro */
@media (prefers-color-scheme: dark) {
    .pango-elementor-modal-content {
        background-color: #2a2a2a;
        color: #fff;
    }

    .pango-elementor-modal-title {
        color: #e2e4e7;
    }

    .pango-elementor-modal-subtitle {
        color: #b5bcc2;
    }

    .pango-elementor-modal-description {
        color: #c3c9cf;
    }

    .pango-elementor-modal-close {
        color: #ccc;
    }

    .pango-elementor-modal-close:hover {
        color: #fff;
    }

    .pango-elementor-modal-overlay {
        background-color: rgba(0, 0, 0, 0.7);
    }
}

/* Suporte a reduce motion */
@media (prefers-reduced-motion: reduce) {
    .pango-elementor-modal-content,
    .pango-elementor-modal-trigger,
    .pango-elementor-modal-close,
    .pango-elementor-modal-overlay {
        animation: none;
        transition: none;
    }
}

/* ============================================================
   Elementor Editor Canvas Mode Integration
============================================================ */

.pango-elementor-modal.pango-elementor-modal-in-editor {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    min-height: 250px !important;
    z-index: 99 !important;
    padding: 24px !important;
    background: #f7fafc !important;
    border: 2px dashed #0073aa !important;
    border-radius: 8px !important;
    display: flex !important;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05) !important;
}

.pango-elementor-modal.pango-elementor-modal-in-editor::before {
    content: "Pangoleads 3: Prévia da Modal no Editor";
    position: absolute;
    top: -12px;
    left: 20px;
    background: #0073aa;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.pango-elementor-modal.pango-elementor-modal-in-editor .pango-elementor-modal-overlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0, 0, 0, 0.04) !important;
    pointer-events: none !important;
    z-index: 0 !important;
    border-radius: 6px !important;
}

.pango-elementor-modal.pango-elementor-modal-in-editor .pango-elementor-modal-content {
    position: relative !important;
    z-index: 2 !important;
    background-color: #ffffff;
    border: 1px solid #dce3ec !important;
    border-radius: 6px !important;
    max-width: 100% !important;
    width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
    padding: 24px !important;
    margin: 12px 0 0 0 !important;
    animation: none !important;
}

.pango-elementor-modal.pango-elementor-modal-in-editor .pango-elementor-modal-close {
    display: block !important;
    color: #999 !important;
    font-size: 24px !important;
    top: 10px !important;
    right: 10px !important;
    width: 28px !important;
    height: 28px !important;
    cursor: default !important;
    opacity: 0.4 !important;
}
