/**
 * Public Styles - Improved Version
 * 
 * Modern, full-width archive page with infinite scroll
 * 
 * @package SAC_Simple_Podcast
 * @since 1.0.0
 */

/* ===========================
   CSS Variables for easy theming
   =========================== */
   :root {
    --primary-color: #1a1a1a;
    --secondary-color: #666;
    --accent-color: #0066cc;
    --border-color: #e0e0e0;
    --hover-bg: #f8f9fa;
    --card-bg: #ffffff;
    --transition-speed: 0.3s;
    --border-radius: 12px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
}

/* ===========================
   Podcast Feed (Archive/List) - FULL WIDTH
   =========================== */

.sac-podcast-feed {
    margin: 0;
    padding: 0;
    width: 100%;
    background: #ffffff;
}

/* Header Section (optional) */
.sac-feed-header-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, #2d2d2d 100%);
    color: white;
    padding: 60px 20px;
    text-align: center;
}

.sac-feed-header-section h1 {
    font-size: 48px;
    font-weight: 800;
    margin: 0 0 16px 0;
    letter-spacing: -1px;
}

.sac-feed-header-section p {
    font-size: 18px;
    opacity: 0.9;
    margin: 0;
}

/* Grid Container */
.sac-feed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 32px;
    padding: 0px 0px;
    max-width: 1600px;
    margin: 0 auto;
}

/* Episode Card */
.sac-feed-episode {
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    position: relative;
}

.sac-feed-episode:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.sac-feed-episode:active {
    transform: translateY(-4px);
}

/* Image Container */
.sac-feed-image {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.sac-feed-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.sac-feed-episode:hover .sac-feed-image img {
    transform: scale(1.08);
}

/* Preview Button - Modernized */
.sac-preview-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.sac-preview-btn:hover {
    transform: translate(-50%, -50%) scale(1.15);
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.sac-preview-btn:active {
    transform: translate(-50%, -50%) scale(1.05);
}

.sac-preview-btn.playing {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.sac-preview-btn.playing svg {
    fill: white;
}

.sac-preview-btn svg {
    fill: var(--primary-color);
    transition: fill var(--transition-speed);
}

/* Episode Badge - Modernized */
.sac-episode-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 5;
}

/* Content Area */
.sac-feed-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
}

.sac-feed-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sac-feed-title {
    margin: 0;
    font-size: 22px;
    line-height: 1.4;
    font-weight: 700;
    color: var(--primary-color);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color var(--transition-speed);
}

.sac-feed-episode:hover .sac-feed-title {
    color: var(--accent-color);
}

/* Meta Information */
.sac-feed-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    color: var(--secondary-color);
    font-size: 14px;
    font-weight: 500;
}

.sac-feed-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sac-feed-meta svg {
    opacity: 0.7;
    flex-shrink: 0;
}

/* Excerpt */
.sac-feed-excerpt {
    color: var(--secondary-color);
    line-height: 1.6;
    font-size: 15px;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===========================
   Infinite Scroll Loader
   =========================== */

.sac-feed-loader {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 60px 20px;
    min-height: 200px;
}

.sac-feed-loader.loading {
    display: flex;
}

.sac-loader-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin-loader 0.8s linear infinite;
}

@keyframes spin-loader {
    to { 
        transform: rotate(360deg); 
    }
}

.sac-loader-text {
    color: var(--secondary-color);
    font-size: 16px;
    font-weight: 500;
}

/* Load More Button */
.sac-load-more-container {
    text-align: center;
    padding: 40px 20px;
}

.sac-load-more-btn {
    color: #ffffff !important;
    background-color: #a00000 !important;
    border: 0 !important;
    border-radius: 100px;
    font-size: 18px !important;
    font-weight: 700 !important;
    text-transform: none !important;
    text-decoration: none;
    display: inline-block;
    line-height: 1.1;
    padding: 16px 24px !important;
    height: auto !important;
    transform-origin: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sac-load-more-btn:hover {
    background-color: #8a0000 !important;
    transform: translateY(-2px);
}

.sac-load-more-btn:active {
    transform: translateY(0);
}

.sac-load-more-btn:disabled {
    background-color: #ccc !important;
    cursor: not-allowed;
    transform: none;
}

.sac-load-more-btn.loading {
    pointer-events: none;
}

.sac-load-more-btn .spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin-loader 0.6s linear infinite;
}

.sac-load-more-btn.loading .spinner {
    display: inline-block;
}

/* End of content message */
.sac-feed-end {
    text-align: center;
    padding: 60px 20px;
    color: var(--secondary-color);
    font-size: 16px;
}

.sac-feed-end::before {
    content: "🎙️";
    display: block;
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* ===========================
   Hidden Preview Audio
   =========================== */

#sac-preview-audio {
    display: none;
}

/* ===========================
   Alternative List Layout (Optional)
   =========================== */

.sac-feed-grid.list-layout {
    grid-template-columns: 1fr;
    max-width: 1200px;
}

.sac-feed-grid.list-layout .sac-feed-episode {
    flex-direction: row;
}

.sac-feed-grid.list-layout .sac-feed-image {
    width: 280px;
    flex-shrink: 0;
    aspect-ratio: 1;
}

/* ===========================
   Loading Skeleton (Optional)
   =========================== */

.sac-episode-skeleton {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    animation: pulse 1.5s ease-in-out infinite;
}

.sac-episode-skeleton .skeleton-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.sac-episode-skeleton .skeleton-content {
    padding: 24px;
}

.sac-episode-skeleton .skeleton-line {
    height: 12px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
    margin-bottom: 12px;
}

.sac-episode-skeleton .skeleton-line:last-child {
    width: 60%;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ===========================
   Responsive Design
   =========================== */

@media (max-width: 1400px) {
    .sac-feed-grid {
        grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
        gap: 28px;
        padding: 0px 0px;
    }
}

@media (max-width: 1024px) {
    .sac-feed-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 24px;
        padding: 0px 0px;
    }
    
    .sac-feed-header-section h1 {
        font-size: 40px;
    }
    
    .sac-feed-title {
        font-size: 20px;
    }
}

@media (max-width: 768px) {
    .sac-feed-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 0px 0px;
    }
    
    .sac-feed-header-section {
        padding: 40px 20px;
    }
    
    .sac-feed-header-section h1 {
        font-size: 32px;
    }
    
    .sac-feed-header-section p {
        font-size: 16px;
    }
    
    .sac-feed-title {
        font-size: 19px;
    }
    
    .sac-feed-excerpt {
        font-size: 14px;
    }
    
    .sac-feed-meta {
        font-size: 13px;
        gap: 16px;
    }
    
    .sac-preview-btn {
        width: 56px;
        height: 56px;
    }
    
    .sac-preview-btn svg {
        width: 24px;
        height: 24px;
    }
    
    .sac-episode-badge {
        top: 12px;
        left: 12px;
        padding: 5px 12px;
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .sac-feed-content {
        padding: 20px;
        gap: 14px;
    }
    
    .sac-feed-loader {
        padding: 40px 20px;
    }
}

/* ===========================
   Accessibility
   =========================== */

.sac-feed-episode:focus {
    outline: 3px solid #a00000;
    outline-offset: 4px;
}

.sac-preview-btn:focus {
    outline: 3px solid var(--accent-color);
    outline-offset: 4px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===========================
   Print Styles
   =========================== */

@media print {
    .sac-preview-btn,
    .sac-feed-loader {
        display: none !important;
    }
    
    .sac-feed-episode {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
}

/* ===========================
   Old Compatibility Styles
   =========================== */

/* Old list style - keeping for backward compatibility */
.sac-podcast-list .sac-podcast-episode {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.3s ease;
}

.sac-podcast-list .sac-podcast-episode:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.sac-episode-image img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 6px;
}