/* Overlay that blocks the page */
.epm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4); /* Darker overlay for better contrast */
    backdrop-filter: blur(4px);    /* Subtle blur effect */
    -webkit-backdrop-filter: blur(4px); /* For Safari support */
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    animation: epmFadeIn 0.3s ease-out;
}

@keyframes epmFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Popup container */
.epm-popup {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    padding: 0;
    max-width: 500px;
    max-height: 80vh;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    border-radius: 12px;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    overflow-x: hidden;
    box-sizing: border-box;
    animation: epmSlideIn 0.4s ease-out;
}

@keyframes epmSlideIn {
    from { 
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Heading - Clean and professional */
.epm-popup h2 {
    margin: 0 auto;
    padding: 10px 25px 10px 25px;
    font-size: 1.4em;
    text-align: center;
    font-weight: 600;
    color: #2c3e50;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    line-height: 1.3;
}
/* Scrollable image container */
.epm-scroll {
    overflow-y: auto;
    max-height: 400px;
    width: 100%;
    padding: 20px 25px;
    text-align: center;
    background: #ffffff;
}

.epm-scroll img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Close button - More visible and prominent */
.epm-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #dc3545;
    font-size: 20px;
    line-height: 1;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    color: #dc3545;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Close button hover state */
.epm-close:hover {
    background: #dc3545;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

/* Prevent background scroll when popup is active */
body.epm-lock-scroll {
    overflow: hidden;
}

/* Single popup mode styles - Clean and compact */
.epm-single-popup {
    max-width: 500px;
    width: 85%;
    max-height: 85vh;
    position: relative;
    z-index: 10000;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    overflow-x: hidden;
    animation: epmSlideIn 0.4s ease-out;
    display: flex;
    flex-direction: column;
}

/* Multi-popup carousel styles */
.epm-multi-popup {
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    position: relative;
    z-index: 10000;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    overflow-x: hidden;
    animation: epmSlideIn 0.4s ease-out;
}

.epm-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px 15px 25px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.epm-popup-header h2 {
    margin: 0;
    font-size: 1.4em;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.3;
}

.epm-event-counter {
    background: #007bff;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 500;
}

.epm-popup-content {
    position: relative;
    height: 450px;
    overflow: hidden;
}

.epm-popup-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.epm-popup-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.4s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.epm-popup-slide.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.epm-slide-content {
    padding: 0;
    text-align: center;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    overflow: hidden;
    overflow-x: hidden;
}

.epm-slide-image {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    flex: 1;
    padding: 0;
}

.epm-slide-title {
    font-size: 1.4em;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
    padding: 20px 25px 15px 25px;
    line-height: 1.3;
    background: linear-gradient(135deg, #4A90E2, #7B68EE);
    border-bottom: 2px solid rgba(255,255,255,0.2);
    width: 100%;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    border-radius: 8px 8px 0 0;
    text-align: center;
    flex-shrink: 0;
}

.epm-slide-image img {
    width: 100%;
    height: auto;
    min-height: 100%;
    object-fit: cover;
    border-radius: 0;
    box-shadow: none;
    transition: transform 0.2s ease;
    display: block;
}

.epm-slide-image img:hover {
    transform: scale(1.01);
}

/* Scrollbar styling for multi-popup images */
.epm-slide-image::-webkit-scrollbar {
    width: 6px;
}

.epm-slide-image::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.epm-slide-image::-webkit-scrollbar-thumb {
    background: #007bff;
    border-radius: 3px;
}

.epm-slide-image::-webkit-scrollbar-thumb:hover {
    background: #0056b3;
}

.epm-navigation {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 15px;
    z-index: 10;
    pointer-events: none;
}

.epm-prev, .epm-next {
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    border: 2px solid #007bff;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0.9;
    pointer-events: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    font-weight: bold;
}

.epm-prev:hover, .epm-next:hover {
    background: #007bff;
    color: white;
    opacity: 1;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.epm-prev:disabled, .epm-next:disabled {
    background: rgba(0, 0, 0, 0.1);
    color: #999;
    border-color: #ccc;
    cursor: not-allowed;
    opacity: 0.5;
}

.epm-prev:disabled:hover, .epm-next:disabled:hover {
    transform: none;
    background: rgba(0, 0, 0, 0.1);
    color: #999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.epm-events-container {
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    background: #ffffff;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.epm-event-title {
    margin: 0 0 15px 0;
    padding: 10px 25px 10px 25px;
    font-size: 1.4em;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #4A90E2, #7B68EE);
    border-bottom: 2px solid rgba(255,255,255,0.2);
    word-wrap: break-word;
    overflow-wrap: break-word;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
    line-height: 1.3;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    border-radius: 8px 8px 0 0;
    flex-shrink: 0;
}

.epm-event-item {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

.epm-event-image {
    text-align: center;
    margin-bottom: 0;
    padding: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.epm-event-image img {
    width: 100%;
    height: auto;
    max-height: none;
    object-fit: cover;
    border-radius: 0;
    box-shadow: none;
    display: block;
    margin: 0;
    transition: transform 0.2s ease;
}

.epm-event-image img:hover {
    transform: scale(1.01);
}

.epm-event-separator {
    border: none;
    border-top: 2px solid #e9ecef;
    margin: 25px 0;
    border-radius: 1px;
}

/* Scrollbar styling */
.epm-events-container::-webkit-scrollbar {
    width: 8px;
}

.epm-events-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.epm-events-container::-webkit-scrollbar-thumb {
    background: #06b6d4;
    border-radius: 4px;
}

.epm-events-container::-webkit-scrollbar-thumb:hover {
    background: #0891b2;
}

/* Desktop optimizations */
@media (min-width: 769px) {
    .epm-single-popup {
        max-width: 450px;
        width: 80%;
        max-height: 85vh;
    }
    
    .epm-events-container {
        max-height: 75vh;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .epm-event-image img {
        width: 100%;
        height: auto;
        max-height: none;
        object-fit: cover;
    }
}

/* Responsive design for single popup */
@media (max-width: 768px) {
    .epm-overlay {
        padding: 10px;
        align-items: center;
        justify-content: center;
    }
    
    .epm-popup, .epm-single-popup, .epm-multi-popup {
        max-width: 95%;
        width: 100%;
        margin: 0;
        max-height: 90vh;
        position: relative;
    }
    
    .epm-events-container {
        max-height: 60vh;
    }
    
    .epm-event-title {
        font-size: 1.1em;
        padding: 15px 20px 12px 20px;
    }
    
    .epm-popup h2 {
        font-size: 1.2em;
        padding: 15px 20px 12px 20px;
    }
    
    .epm-scroll {
        padding: 15px 20px;
    }
    
    .epm-event-image img {
        height: auto;
        max-height: none;
    }
    
    /* Multi-popup responsive styles */
    .epm-popup-header {
        padding: 15px 20px 12px 20px;
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .epm-popup-header h2 {
        font-size: 1.2em;
    }
    
    .epm-popup-content {
        height: 400px;
    }
    
    .epm-slide-content {
        padding: 0;
    }
    
    .epm-slide-title {
        font-size: 1.2em;
        padding: 15px 20px 12px 20px;
    }
    
    .epm-slide-image {
        height: 100%;
    }
    
    .epm-slide-image img {
        height: auto;
        min-height: 100%;
    }
    
    .epm-navigation {
        padding: 0 10px;
    }
    
    .epm-prev, .epm-next {
        width: 40px;
        height: 40px;
    }
    
    /* Ensure proper centering on very small screens */
    @media (max-width: 480px) {
        .epm-overlay {
            padding: 5px;
        }
        
        .epm-popup, .epm-single-popup, .epm-multi-popup {
            max-width: 98%;
            width: 100%;
        }
    }
}

/* ========================================
   DASHBOARD STYLES (UNCHANGED)
======================================== */

/* Dashboard Header */
.epm-dashboard-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.epm-header-content {
    flex: 1;
    min-width: 300px;
}

.epm-main-title {
    font-size: 2.5em;
    margin: 0 0 10px 0;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 15px;
}

.epm-icon {
    font-size: 1.2em;
}

.epm-version {
    background: rgba(255,255,255,0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.4em;
    font-weight: 500;
    margin-left: 10px;
}

.epm-subtitle {
    font-size: 1.1em;
    margin: 0;
    opacity: 0.9;
    font-weight: 300;
}

.epm-header-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.epm-stat-box {
    text-align: center;
    background: rgba(255,255,255,0.15);
    padding: 20px;
    border-radius: 10px;
    min-width: 120px;
    backdrop-filter: blur(10px);
}

.epm-stat-number {
    display: block;
    font-size: 2.5em;
    font-weight: 700;
    margin-bottom: 5px;
}

.epm-stat-label {
    font-size: 0.9em;
    opacity: 0.8;
    font-weight: 500;
}

/* Features Section */
.epm-features-section {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    border: 1px solid #e9ecef;
}

.epm-features-section h2 {
    color: #2c3e50;
    margin-bottom: 25px;
    font-size: 1.8em;
    font-weight: 600;
}

.epm-features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.epm-feature-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
    text-align: center;
}

.epm-feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.epm-feature-icon {
    font-size: 3em;
    margin-bottom: 15px;
    display: block;
}

.epm-feature-card h3 {
    color: #2c3e50;
    margin: 0 0 15px 0;
    font-size: 1.3em;
    font-weight: 600;
}

.epm-feature-card p {
    color: #6c757d;
    margin: 0;
    line-height: 1.6;
    font-size: 0.95em;
}

/* Security Section */
.epm-security-section {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.epm-security-section h2 {
    color: #155724;
    margin-bottom: 20px;
    font-size: 1.6em;
    font-weight: 600;
}

.epm-security-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.epm-security-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #c3e6cb;
}

.epm-security-icon {
    font-size: 1.2em;
}

.epm-security-text {
    font-weight: 500;
    color: #155724;
}

/* Guide Section */
.epm-guide-section {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
}

.epm-guide-section h2 {
    color: #0d47a1;
    margin-bottom: 25px;
    font-size: 1.8em;
    font-weight: 600;
}

.epm-guide-steps {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.epm-guide-step {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    background: white;
    padding: 25px;
    border-radius: 10px;
    border: 1px solid #bbdefb;
}

.epm-step-number {
    background: #2196f3;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2em;
    flex-shrink: 0;
}

.epm-step-content h3 {
    color: #0d47a1;
    margin: 0 0 10px 0;
    font-size: 1.3em;
    font-weight: 600;
}

.epm-step-content p {
    color: #424242;
    margin: 0;
    line-height: 1.6;
}

/* Settings Section */
.epm-settings-section {
    background: white;
    border: 1px solid #dee2e6;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
}

.epm-settings-section h2 {
    color: #495057;
    margin-bottom: 25px;
    font-size: 1.8em;
    font-weight: 600;
}

/* Help Section */
.epm-help-section {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
}

.epm-help-section h2 {
    color: #856404;
    margin-bottom: 25px;
    font-size: 1.8em;
    font-weight: 600;
}

.epm-help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.epm-help-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    border: 1px solid #ffeaa7;
    text-align: center;
}

.epm-help-card h3 {
    color: #856404;
    margin: 0 0 15px 0;
    font-size: 1.2em;
    font-weight: 600;
}

.epm-help-card p {
    color: #6c757d;
    margin: 0 0 20px 0;
    line-height: 1.6;
}

.epm-help-link {
    display: inline-block;
    background: #ffc107;
    color: #212529;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.epm-help-link:hover {
    background: #e0a800;
    color: #212529;
    text-decoration: none;
    transform: translateY(-2px);
}

/* Image Dimensions Section */
.epm-image-dimensions {
    display: flex;
    gap: 15px;
    margin: 10px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    flex-wrap: wrap;
}

.epm-image-dimensions label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
    display: block;
}

.epm-image-dimensions input[type="number"] {
    width: 80px;
    padding: 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

.epm-image-dimensions > div {
    flex: 1;
    min-width: 120px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .epm-dashboard-header {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
    
    .epm-header-stats {
        justify-content: center;
    }
    
    .epm-features-grid {
        grid-template-columns: 1fr;
    }
    
    .epm-security-grid {
        grid-template-columns: 1fr;
    }
    
    .epm-guide-step {
        flex-direction: column;
        text-align: center;
    }
    
    .epm-help-grid {
        grid-template-columns: 1fr;
    }
    
    .epm-main-title {
        font-size: 2em;
        flex-direction: column;
        gap: 10px;
    }
    
    .epm-image-dimensions {
        flex-direction: column;
    }
}

/* Gradient Controls */
.epm-gradient-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 10px 0;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.epm-color-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.epm-color-label {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.epm-color-picker {
    width: 50px;
    height: 40px;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.epm-color-picker:hover {
    border-color: #0073aa;
}

.epm-gradient-preview {
    width: 80px;
    height: 40px;
    border: 2px solid #ddd;
    border-radius: 4px;
    flex-shrink: 0;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

/* Responsive gradient controls */
@media (max-width: 768px) {
    .epm-gradient-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .epm-color-group {
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }
    
    .epm-gradient-preview {
        width: 100%;
        height: 30px;
    }
}