/**
 * Elementor Mobile Popup - Dynamic Styles
 * Version: 2.0
 */

/* Enhanced Mobile Popup Trigger Buttons */
.emp-trigger-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 25px;
    color: white;
    cursor: pointer;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    font-weight: 600;
    padding: 12px 24px;
    position: relative;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    overflow: hidden;
}

.emp-trigger-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.emp-trigger-button:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.emp-trigger-button:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.emp-trigger-button:hover:before {
    left: 100%;
}

/* Mobile-specific enhancements */
@media (max-width: 768px) {
    .emp-trigger-button {
        font-size: 18px;
        padding: 15px 30px;
        min-height: 48px; /* Touch-friendly */
        width: 100%;
        max-width: 280px;
    }
}

/* Enhanced popup animations for mobile */
@media (max-width: 768px) {
    .elementor-popup-modal {
        transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    }
    
    .elementor-popup-modal--show {
        animation: empSlideInUp 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    }
    
    .elementor-popup-modal--hide {
        animation: empSlideOutDown 0.3s ease-in;
    }
}

@keyframes empSlideInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 100%, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes empSlideOutDown {
    from {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
    to {
        opacity: 0;
        transform: translate3d(0, 100%, 0);
    }
}

/* Improved mobile popup positioning */
@media (max-width: 768px) {
    .elementor-popup-modal .dialog-widget-content {
        max-height: 90vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Ensure popups don't interfere with mobile navigation */
    .elementor-popup-modal--show {
        z-index: 999999;
    }
    
    /* Better backdrop on mobile */
    .elementor-popup-modal .dialog-backdrop {
        background: rgba(0, 0, 0, 0.7);
        backdrop-filter: blur(4px);
    }
}

/* Touch-friendly close buttons */
/* Debug mode styles */
.emp-debug-info {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px;
    border-radius: 5px;
    font-family: monospace;
    font-size: 12px;
    z-index: 1000000;
    max-width: 300px;
    white-space: pre-wrap;
}

.emp-debug-toggle {
    position: fixed;
    top: 10px;
    right: 10px;
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 11px;
    cursor: pointer;
    z-index: 1000001;
}

/* Loading states */
.emp-popup-loading {
    opacity: 0.7;
    pointer-events: none;
}

.emp-popup-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: empSpin 1s linear infinite;
}

@keyframes empSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Admin interface enhancements */
.emp-popup-card {
    background: #fff;
    border: 1px solid #e2e4e7;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s ease;
}

.emp-popup-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.emp-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e2e4e7;
}

.emp-popup-header h3 {
    margin: 0;
    color: #1e1e1e;
}

.emp-popup-header small {
    color: #757575;
    font-weight: normal;
}

.emp-status-active {
    color: #00a32a;
    font-weight: 600;
}

.emp-status-inactive {
    color: #d63638;
    font-weight: 600;
}

.emp-status-testing {
    color: #dba617;
    font-weight: 600;
}

.emp-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .emp-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

.emp-field-group {
    margin-bottom: 15px;
}

.emp-field-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #1e1e1e;
}

.emp-field-group input[type="text"],
.emp-field-group input[type="number"],
.emp-field-group select {
    width: 100%;
    max-width: 300px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.emp-field-group input[type="checkbox"] {
    margin-right: 8px;
}

.emp-help-text {
    font-style: italic;
    color: #666;
    font-size: 13px;
    margin-top: 5px;
}

/* Statistics and analytics */
.emp-stats-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
    text-align: center;
}

.emp-stat-number {
    font-size: 2.5em;
    font-weight: bold;
    color: #2c3e50;
    display: block;
}

.emp-stat-label {
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9em;
}

.emp-mini-chart {
    height: 30px;
    background: linear-gradient(90deg, #e3f2fd, #bbdefb, #90caf9);
    border-radius: 15px;
    position: relative;
    overflow: hidden;
}

.emp-mini-chart::after {
    content: 'Loading...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    color: #666;
}

/* Responsive improvements */
@media (max-width: 480px) {
    .emp-popup-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .emp-popup-header > div:last-child {
        display: flex;
        gap: 5px;
        flex-wrap: wrap;
    }
    
    .emp-popup-header button {
        font-size: 12px;
        padding: 6px 12px;
    }
}

/* Accessibility improvements */
.emp-trigger-button:focus,
.emp-field-group input:focus,
.emp-field-group select:focus {
    outline: 2px solid #005cee;
    outline-offset: 2px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .emp-popup-card {
        background: #2c2c2c;
        border-color: #444;
        color: #e0e0e0;
    }
    
    .emp-popup-header {
        border-bottom-color: #444;
    }
    
    .emp-popup-header h3 {
        color: #e0e0e0;
    }
    
    .emp-field-group label {
        color: #e0e0e0;
    }
    
    .emp-field-group input,
    .emp-field-group select {
        background: #3c3c3c;
        border-color: #555;
        color: #e0e0e0;
    }
    
    .emp-help-text {
        color: #aaa;
    }
}

/* Print styles */
@media print {
    .emp-trigger-button,
    .emp-debug-info,
    .emp-debug-toggle,
    .elementor-popup-modal {
        display: none !important;
    }
}