/* =========================================
   Repositorio de Podcast CSS
========================================= */

:root {
    --primary-blue: #164081; /* Default brand blue */
    --hover-blue: #113063;
    --text-dark: #333333;
    --text-muted: #666666;
    --bg-light: #f9f9f9;
    --white: #ffffff;
    --border-color: #dddddd;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 10px 20px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
    --radius-md: 8px;
    --radius-lg: 12px;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
}

.podcast-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Header */
.podcast-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.header-logo img {
    height: 60px;
    width: auto;
}

.header-title {
    font-size: 2rem;
    color: var(--primary-blue);
    font-weight: 600;
    margin: 0;
    flex-grow: 1;
    text-align: center;
}

.btn-volver {
    background-color: var(--primary-blue);
    color: var(--white);
    padding: 0.6rem 1.2rem;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: var(--transition);
}

.btn-volver:hover {
    background-color: var(--hover-blue);
    box-shadow: var(--shadow-md);
}

/* Filters Layout */
.podcast-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    flex: 1 1 200px;
}

.filter-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-blue);
    margin-bottom: 0.5rem;
}

.filter-select {
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    background-color: var(--white);
    color: var(--text-dark);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    appearance: none;
    /* Custom simple arrow for select */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
}

.filter-select:hover, .filter-select:focus {
    border-color: var(--primary-blue);
    outline: none;
}

.filter-search-group {
    display: flex;
    flex: 2 1 300px;
    position: relative;
}

.filter-search {
    width: 100%;
    padding: 0.8rem 3rem 0.8rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 30px;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.filter-search:focus {
    border-color: var(--primary-blue);
    outline: none;
    box-shadow: var(--shadow-md);
}

.btn-search {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
}

.btn-search:hover {
    color: var(--primary-blue);
}

/* Grid Layout */
.podcast-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

/* Cards */
.podcast-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.podcast-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card-thumbnail-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
    background-color: #000;
}

.card-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.9;
    transition: var(--transition);
}

.podcast-card:hover .card-thumbnail {
    opacity: 0.7;
    transform: scale(1.05);
}

.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(220, 38, 38, 0.9); /* A red color for the play button as seen in mock */
    width: 50px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.podcast-card:hover .play-overlay {
    transform: translate(-50%, -50%) scale(1.1);
    background: rgba(220, 38, 38, 1);
}

.play-icon {
    width: 24px;
    height: 24px;
    fill: var(--white);
}

.card-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.75);
    color: var(--white);
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.card-content {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-blue);
    margin: 0 0 0.5rem 0;
    line-height: 1.3;
    /* Truncate multi-line */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-description {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
    /* Truncate multi-line */
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.page-link {
    text-decoration: none;
    color: var(--primary-blue);
    font-weight: 600;
    font-size: 1.2rem;
    padding: 0.5rem 0.8rem;
    transition: var(--transition);
}

.page-link:hover, .page-link.active {
    background-color: var(--primary-blue);
    color: var(--white);
    border-radius: var(--radius-md);
}

.page-separator {
    color: var(--primary-blue);
    font-weight: 600;
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

/* Responsive */
@media (max-width: 768px) {
    .podcast-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .podcast-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group, .filter-search-group {
        flex: 1 1 100%;
    }
    
    .header-logo img {
        height: 50px;
    }
}

/* =========================================
   Modal Player Styles & Animations
========================================= */
.media-modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    background-color: rgba(0, 0, 0, 0.85); /* Darker backdrop for focus */
    backdrop-filter: blur(8px); /* Deeper blur for modern look */
    overflow: hidden; /* Avoid body scroll, manage in flex/grid */
    /* Flexbox centering for modal */
    justify-content: center;
    align-items: center;
    opacity: 0; 
    transition: opacity 0.3s ease-out;
}

.media-modal.show {
    display: flex; /* Activate display flex */
    opacity: 1; /* Fade in */
}

.media-modal-content {
    background-color: var(--white);
    padding: 1.5rem;
    width: 100%;
    max-width: 900px; /* Slightly wider */
    max-height: 90vh; /* Max height to avoid overflow */
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); /* Prominent shadow */
    position: relative;
    display: flex;
    flex-direction: column;
    /* Transformation for bottom-up entry animation */
    transform: translateY(30px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    overflow-y: auto; /* Internal scrolling if content is too long */
}

.media-modal.show .media-modal-content {
    transform: translateY(0); /* Final state of animation */
}

/* Modal header layout */
.media-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

#mediaPlayerTitle {
    margin: 0;
    font-size: 1.5rem;
    color: var(--primary-blue);
    font-weight: 600;
    line-height: 1.3;
    padding-right: 1.5rem; /* Space for close button */
    word-break: break-word; /* Ensure long words wrap */
}

.media-modal-close {
    background: var(--bg-light);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0; /* Prevents button from shrinking */
}

.media-modal-close:hover,
.media-modal-close:focus {
    background-color: #ffeaea;
    color: #dc2626; /* Red hover for close action */
    outline: none;
}

#mediaPlayerContainer {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
    min-height: 300px;
    background-color: #000; /* Black background to frame media */
    border-radius: var(--radius-md);
    overflow: hidden; /* Hide anything outside border radius */
}

#mediaPlayerContainer iframe {
    width: 100%;
    aspect-ratio: 16/9;
    border: none;
}

#mediaPlayerContainer video {
    width: 100%;
    max-height: 70vh;
    outline: none;
}

/* Audio wrapper requires less space and white background */
.audio-mode {
    background-color: var(--bg-light) !important;
    min-height: auto !important;
    padding: 2rem 1rem;
}

#mediaPlayerContainer audio {
    width: 90%;
    max-width: 500px;
    outline: none;
}
