/**
 * Frontend CSS for Breastfeeding Infographics Widget
 */

/* Widget Container */
.bfiw-widget {
    text-align: center;
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
}

.bfiw-title {
    font-size: 2em;
    margin-bottom: 15px;
    color: #333;
    font-weight: 600;
}

.bfiw-description {
    font-size: 1.1em;
    margin-bottom: 25px;
    color: #666;
    line-height: 1.6;
}

.bfiw-trigger-btn {
    display: inline-block;
    padding: 15px 30px;
    font-size: 1.1em;
    font-weight: 600;
    text-decoration: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #007cba;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.bfiw-trigger-btn:hover {
    background-color: #005a87;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

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

/* Modal Styles */
.bfiw-modal,
.bfiw-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
}

.bfiw-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.bfiw-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    animation: bfiw-modal-fade-in 0.3s ease-out;
}

@keyframes bfiw-modal-fade-in {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.bfiw-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 25px;
    border-bottom: 1px solid #e0e0e0;
    background-color: #f8f9fa;
}

.bfiw-modal-title {
    margin: 0;
    font-size: 1.5em;
    font-weight: 600;
    color: #333;
}

.bfiw-modal-close {
    background: none;
    border: none;
    font-size: 2em;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.bfiw-modal-close:hover {
    background-color: #e0e0e0;
    color: #333;
}

.bfiw-modal-body {
    padding: 25px;
    max-height: 70vh;
    overflow-y: auto;
}

/* Gallery Grid */
.bfiw-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.bfiw-infographic-card {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.bfiw-infographic-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #007cba;
}

.bfiw-card-image {
    position: relative;
    height: 200px;
    overflow: hidden;
    background-color: #f8f9fa;
}

.bfiw-card-image img {
    /* width: 100%; */
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.bfiw-infographic-card:hover .bfiw-card-image img {
    transform: scale(1.05);
}

.bfiw-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    font-size: 3em;
}

.bfiw-card-content {
    padding: 20px;
}

.bfiw-card-title {
    margin: 0 0 10px 0;
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
}

.bfiw-card-excerpt {
    margin: 0 0 20px 0;
    color: #666;
    font-size: 0.9em;
    line-height: 1.5;
}

.bfiw-card-actions {
    display: flex;
    justify-content: center;
}

.bfiw-view-btn,
.bfiw-download-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    min-width: 120px;
}

.bfiw-view-btn {
    background-color: #2e3092;
    color: #ffffff;
}

.bfiw-view-btn:hover {
    background-color: #005a87;
}

.bfiw-download-btn {
    background-color: #28a745;
    color: #ffffff;
}

.bfiw-download-btn:hover {
    background-color: #1e7e34;
}

/* Preview Modal Specific Styles */
.bfiw-preview-content {
    max-width: 800px;
    width: 90vw;
}

.bfiw-preview-content .bfiw-modal-header {
    flex-wrap: wrap;
    gap: 15px;
}

.bfiw-preview-title {
    flex: 1;
    min-width: 200px;
    margin: 0;
    font-size: 1.3em;
    font-weight: 600;
    color: #333;
}

.bfiw-preview-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.bfiw-language-selector {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9em;
    background-color: #ffffff;
    min-width: 150px;
}

.bfiw-preview-download {
    padding: 8px 16px;
    background-color: #28a745;
    color: #ffffff;
    border: none;
    border-radius: 3px;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.bfiw-preview-download:hover {
    background-color: #1e7e34;
}

.bfiw-preview-nav {
    background: none;
    border: none;
    font-size: 1.5em;
    color: #666;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.bfiw-preview-nav:hover {
    background-color: #e0e0e0;
    color: #333;
}

.bfiw-preview-image {
    text-align: center;
    margin-bottom: 20px;
}

.bfiw-preview-img {
    max-width: 100%;
    max-height: 60vh;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.bfiw-preview-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .bfiw-gallery-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .bfiw-modal-content {
        max-width: 95vw;
        max-height: 95vh;
        width: 100%;
    }
    
    .bfiw-modal-header {
        padding: 15px 20px;
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .bfiw-preview-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .bfiw-language-selector {
        width: 100%;
    }
    
    .bfiw-preview-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .bfiw-card-actions {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .bfiw-widget {
        padding: 15px;
    }
    
    .bfiw-title {
        font-size: 1.5em;
    }
    
    .bfiw-description {
        font-size: 1em;
    }
    
    .bfiw-trigger-btn {
        padding: 12px 24px;
        font-size: 1em;
    }
    
    .bfiw-modal-body {
        padding: 20px;
    }
}

/* Body scroll prevention */
body.bfiw-modal-open {
    overflow: hidden;
}

/* Loading states */
.bfiw-loading {
    opacity: 0.6;
    pointer-events: none;
}

.bfiw-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 #007cba;
    border-radius: 50%;
    animation: bfiw-spin 1s linear infinite;
}

@keyframes bfiw-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility improvements */
.bfiw-modal:focus {
    outline: none;
}

.bfiw-modal *:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .bfiw-modal-overlay {
        background-color: rgba(0, 0, 0, 0.9);
    }
    
    .bfiw-modal-content {
        border: 2px solid #000000;
    }
    
    .bfiw-infographic-card {
        border: 2px solid #000000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .bfiw-modal-content,
    .bfiw-infographic-card,
    .bfiw-trigger-btn,
    .bfiw-card-image img {
        animation: none;
        transition: none;
    }
}
