/**
 * Frontend Styles for BF Church Messages
 */

/* Shortcode Styles */
.bf-message-player {
    margin: 1rem 0;
}

.bf-message-meta {
    margin: 1rem 0;
}

.bf-message-meta--list .bf-meta-item {
    display: block;
    margin-bottom: 0.5rem;
}

.bf-message-meta--inline {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.bf-message-icons {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
}

.bf-message-icons--small .bf-media-icon {
    width: 24px;
    height: 24px;
}

.bf-message-icons--medium .bf-media-icon {
    width: 32px;
    height: 32px;
}

.bf-message-icons--large .bf-media-icon {
    width: 40px;
    height: 40px;
}

/* Player Interface */
.bf-full-player {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    margin: 1rem 0;
}

.bf-full-player--compact {
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.bf-player-section {
    border-bottom: 1px solid #eee;
}

.bf-player-section:last-child {
    border-bottom: none;
}

/* PDF section special handling - no additional styling needed */
.bf-pdf-section {
    border: none;
    padding: 0;
}

.bf-pdf-section .bf-player-content,
.bf-pdf-section .bf-pdf-player-body {
    padding: 0;
}

/* YouTube and Audio section special handling */
.bf-youtube-section,
.bf-audio-section {
    border: none;
    padding: 0;
    margin-bottom: 1rem;
}

.bf-youtube-section .bf-player-content,
.bf-audio-section .bf-player-content {
    padding: 1rem;
    margin: 0;
}

.bf-pdf-player-body {
    border: 1px solid #ddd;
    border-radius: 0 0 8px 8px;
    overflow: visible;
    background: #fff;
    margin: 0;
}

.bf-player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.bf-player-header h4 {
    margin: 0;
    font-size: 1rem;
    color: #333;
}

.bf-toggle-player {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

.bf-toggle-player:hover {
    background: #005a87;
}

.bf-toggle-player .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.bf-player-content {
    padding: 1rem;
}

.bf-pdf-controls {
    display: flex;
    gap: 0.5rem;
}

/* Modal Enhancements */
.bf-modal {
    animation: fadeIn 0.2s ease-out;
}

.bf-modal-content {
    animation: slideIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Archive Page - Respect theme structure */
.page-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid #e1e1e1;
}

.page-title {
    margin-bottom: 1rem;
}

.archive-description {
    font-size: 1.1rem;
    color: #666;
    margin: 0 0 2rem 0;
    line-height: 1.6;
}

.archive-description p {
    margin-bottom: 1rem;
}

.archive-description p:last-child {
    margin-bottom: 0;
}

/* Messages Grid - Single Column Layout */
.bf-messages-grid {
    display: flex;
    flex-direction: column;
    gap: 3rem;
    margin-bottom: 3rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* Message Card - Single Column Style */
.bf-message-card {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
    transition: none;
    padding: 0;
    margin-bottom: 3rem;
}

.bf-message-card:hover {
    transform: none;
    box-shadow: none;
}

/* Thumbnail */
.bf-message-thumbnail {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.bf-message-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.bf-message-card:hover .bf-message-thumbnail img {
    transform: scale(1.05);
}

.bf-media-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 20px;
    padding: 5px;
}

/* Media Icons */
.bf-media-icons {
    display: flex;
    gap: 8px;
}

.bf-media-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: #fff;
    text-decoration: none;
    transition: transform 0.2s ease;
    border: none;
    outline: none;
    cursor: pointer;
    background-clip: padding-box;
}

.bf-media-icon:hover {
    transform: scale(1.1);
    text-decoration: none;
}

.bf-media-icon:focus {
    outline: none;
    box-shadow: none;
    border: none;
}

.bf-media-youtube {
    background: #ff0000;
}

.bf-media-audio {
    background: #ff6b35;
}

.bf-media-pdf {
    background: #dc3545;
}

.bf-media-icon .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.bf-media-icons-bottom {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e1e1e1;
}

/* Message Content */
.bf-message-content {
    padding: 0;
    margin-top: 2rem;
}

.bf-message-card .bf-message-header {
    margin-bottom: 2rem;
    padding-bottom: 0;
    border-bottom: none;
}

.bf-message-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    line-height: 1.3;
}

.bf-message-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.bf-message-title a:hover {
    color: #0073aa;
}

/* Meta Information */
.bf-message-meta {
    margin-bottom: 2rem;
    font-size: 1rem;
    color: #666;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.bf-meta-item {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.bf-meta-label {
    font-weight: 600;
    color: #333;
}

.bf-meta-value {
    color: #666;
}

.bf-bible-passage .bf-meta-value {
    font-style: italic;
    color: #0073aa;
}

/* Description and Excerpt */
.bf-message-description,
.bf-message-excerpt {
    margin-bottom: 1rem;
    line-height: 1.6;
    color: #555;
}

.bf-message-description p:last-child,
.bf-message-excerpt p:last-child {
    margin-bottom: 0;
}

/* Footer */
.bf-message-footer {
    padding-top: 1rem;
    border-top: none;
}

.bf-read-more {
    display: inline-block;
    background: #0073aa;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

.bf-read-more:hover {
    background: #005a87;
    color: #fff;
    text-decoration: none;
}

/* Single Page Styles - Respect theme structure */
.bf-message-single .bf-message-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid #e1e1e1;
}

.bf-message-single .bf-message-meta {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    font-size: 1rem;
}

/* Media Section */
.bf-media-section {
    margin-bottom: 2rem;
}

.bf-youtube-embed {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    margin-bottom: 2rem;
}

.bf-youtube-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

.bf-message-single .bf-message-thumbnail {
    text-align: center;
    margin-bottom: 2rem;
}

.bf-message-single .bf-message-thumbnail img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Audio Player */
.bf-audio-player {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.bf-audio-player h3 {
    margin-bottom: 1rem;
    color: #333;
}

.bf-audio-player audio {
    width: 100%;
}

/* PDF Download */
.bf-pdf-download {
    text-align: center;
    margin-bottom: 2rem;
}

.bf-download-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #dc3545;
    color: #fff;
    padding: 1rem 1.5rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.bf-download-button:hover {
    background: #c82333;
    color: #fff;
    text-decoration: none;
}

.bf-download-button .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

/* PDF Viewer */
.bf-pdf-viewer {
    margin-bottom: 2rem;
}

.bf-pdf-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
}

.bf-pdf-header h4 {
    margin: 0;
    color: #333;
}

.bf-pdf-controls {
    display: flex;
    gap: 0.5rem;
}

.bf-toggle-pdf,
.bf-download-pdf {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.bf-toggle-pdf {
    background: #0073aa;
    color: #fff;
}

.bf-toggle-pdf:hover {
    background: #005a87;
    color: #fff;
}

.bf-download-pdf {
    background: #dc3545;
    color: #fff;
}

.bf-download-pdf:hover {
    background: #c82333;
    color: #fff;
    text-decoration: none;
}

.bf-pdf-controls .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.bf-pdf-embed {
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    margin-top: 1rem;
    background: #fff;
}

/* PDF Navigation */
.bf-pdf-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    flex-wrap: wrap;
    gap: 1rem;
}

.bf-pdf-page-info {
    font-weight: 600;
    color: #333;
    font-size: 0.75rem;
}

.bf-pdf-prev,
.bf-pdf-next {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.3rem 0.6rem;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.bf-pdf-prev:hover:not(:disabled),
.bf-pdf-next:hover:not(:disabled) {
    background: #005a87;
}

.bf-pdf-prev:disabled,
.bf-pdf-next:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.bf-pdf-zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
}

.bf-pdf-zoom-in,
.bf-pdf-zoom-out,
.bf-pdf-fit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #666;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.bf-pdf-zoom-in:hover,
.bf-pdf-zoom-out:hover,
.bf-pdf-fit:hover {
    background: #333;
}

.bf-pdf-fit {
    background: #46b450; /* Green color for fit button */
    margin-left: 8px; /* Add some space before fit button */
}

.bf-pdf-fit:hover {
    background: #00a32a;
}

.bf-pdf-zoom-level {
    font-size: 0.75rem;
    font-weight: 600;
    color: #333;
    min-width: 35px;
    text-align: center;
}

/* PDF Player - Single unified container */
.bf-pdf-player {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    margin: 1rem 0;
}

/* PDF Controls at top */
.bf-pdf-controls {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px 8px 0 0;
    padding: 0.75rem 1rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-end;
    margin: 0;
}

/* YouTube and Audio Controls */
.bf-youtube-controls,
.bf-audio-controls {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px 8px 0 0;
    padding: 0.75rem 1rem;
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    justify-content: flex-end;
    margin: 0;
}

/* When content is visible, add bottom border */
.bf-youtube-controls + .bf-player-content:not([style*="display: none"]),
.bf-audio-controls + .bf-player-content:not([style*="display: none"]) {
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    border-radius: 0 0 8px 8px;
}

/* When PDF body is visible, remove bottom border radius */
.bf-pdf-player-body:not([style*="display: none"]) + .bf-pdf-controls,
.bf-pdf-controls + .bf-pdf-player-body:not([style*="display: none"]) {
    border-bottom: 1px solid #ddd;
}

/* PDF Container - no separate border */
.bf-pdf-container {
    position: relative;
    text-align: center;
    padding: 0;
    min-height: 200px;
    background: #fff;
    overflow: auto;
    margin: 0;
}

/* PDF Navigation at bottom */
.bf-pdf-navigation {
    background: #f9f9f9;
    border-top: 1px solid #ddd;
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0;
    flex-wrap: nowrap;
}

.bf-pdf-nav-controls {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.bf-pdf-canvas {
    background: #fff;
    display: block;
    margin: 0 auto;
}

.bf-pdf-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 2rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 6px;
    font-weight: 600;
    color: #333;
}

.bf-pdf-navigation .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Content */
.bf-message-description {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.bf-message-description h3 {
    margin-bottom: 1rem;
    color: #333;
}

.bf-message-main-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #333;
}

/* Navigation */
.bf-message-navigation {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding: 1rem 0;
    border-top: 1px solid #e1e1e1;
    border-bottom: 1px solid #e1e1e1;
}

.bf-nav-previous,
.bf-nav-next {
    flex: 1;
}

.bf-nav-next {
    text-align: right;
}

.bf-nav-previous a,
.bf-nav-next a {
    color: #0073aa;
    text-decoration: none;
    padding: 0.5rem;
    display: block;
}

.bf-nav-previous a:hover,
.bf-nav-next a:hover {
    color: #005a87;
    text-decoration: underline;
}

.bf-back-to-archive {
    text-align: center;
}

.bf-back-to-archive a {
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
}

.bf-back-to-archive a:hover {
    color: #333;
    text-decoration: underline;
}

/* No Posts Found */
.no-posts-found {
    text-align: center;
    padding: 3rem 2rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.no-posts-found h2 {
    margin-bottom: 1rem;
    color: #333;
}

.no-posts-found p {
    color: #666;
    font-size: 1.1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .bf-messages-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .bf-message-single .bf-message-meta {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .bf-meta-item {
        justify-content: center;
    }
    
    .bf-message-navigation {
        flex-direction: column;
        gap: 1rem;
    }
    
    .bf-nav-next {
        text-align: left;
    }
    
    .bf-message-content {
        padding: 1rem;
    }
    
    .bf-audio-player,
    .bf-message-description {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .page-header,
    .bf-message-single .bf-message-header {
        margin-bottom: 2rem;
        padding-bottom: 1rem;
    }
    
    .bf-messages-grid {
        gap: 1rem;
    }
    
    .bf-message-card {
        border-radius: 0;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .bf-message-card {
        border: none;
    }
    
    .bf-media-icon {
        border: 2px solid #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .bf-message-card,
    .bf-message-thumbnail img,
    .bf-media-icon,
    .bf-read-more,
    .bf-download-button {
        transition: none;
    }
    
    .bf-message-card:hover {
        transform: none;
    }
    
    .bf-message-card:hover .bf-message-thumbnail img {
        transform: none;
    }
    
    .bf-media-icon:hover {
        transform: none;
    }
}