/*
Additional styles for custom post types
*/

/* Tutorial chapters box */
.tutorial-chapters {
    margin-top: calc(var(--spacing-unit) * 2);
    background-color: var(--color-surface);
    border-radius: var(--border-radius);
    border: 2px solid var(--color-primary);
    overflow: hidden;
}

.tutorial-chapters__header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1.25rem;
    background-color: var(--color-primary);
    color: #fff;
}

.tutorial-chapters__icon {
    font-size: 1.1rem;
    line-height: 1;
    flex-shrink: 0;
}

.tutorial-chapters__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex: 1;
    color: #fff;
}

.tutorial-chapters__count {
    font-size: 0.8rem;
    opacity: 0.85;
    white-space: nowrap;
}

.chapters-list {
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
}

.chapters-list__item {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.65rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    transition: background-color 0.15s;
}

.chapters-list__item:last-child {
    border-bottom: none;
}

.chapters-list__item:hover {
    background-color: color-mix(in srgb, var(--color-primary) 6%, transparent);
}

.chapters-list__num {
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    background-color: var(--color-primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    margin-top: 0.1rem;
}

/* Badge de número en la cabecera del capítulo individual */
.chapter-number-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background-color: var(--color-primary);
    color: #fff;
    border-radius: 50%;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
    margin-right: 0.6rem;
    vertical-align: middle;
}

.chapter-title-row {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    flex-wrap: wrap;
    position: relative;
}

.chapter-title-group {
    flex: 1;
    min-width: 0;
}

.chapters-list__body {
    flex: 1;
    min-width: 0;
}

.chapters-list__link {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
    line-height: 1.4;
}

.chapters-list__link:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.chapters-list__excerpt {
    margin: 0.2rem 0 0;
    color: var(--color-text-light);
    font-size: 0.85rem;
    line-height: 1.5;
}

/* Tutorial breadcrumb */
.tutorial-breadcrumb {
    margin-top: 0.3rem;
    margin-bottom: 0.5rem;
}

.tutorial-breadcrumb a {
    display: inline;
    color: var(--color-primary);
    text-decoration: none;
    font-size: 1rem;
    text-transform: uppercase;
    transition: opacity var(--transition);
}

.tutorial-breadcrumb a:hover {
    opacity: 0.75;
    text-decoration: underline;
}

/* Chapter navigation */
.chapter-navigation {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: calc(var(--spacing-unit) * 2);
    padding-top: calc(var(--spacing-unit) * 1);
    border-top: 2px solid var(--color-border);
}

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

.chapter-navigation .nav-next {
    text-align: right;
}

.chapter-navigation a {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    color: var(--color-text);
    text-decoration: none;
    transition: all var(--transition);
}

.chapter-navigation a:hover {
    background-color: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    transform: translateY(-2px);
}

/* App/Software actions */
.app-actions,
.software-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: var(--spacing-unit);
}

.btn-primary,
.btn-secondary {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition);
    border: 2px solid;
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.btn-primary:hover {
    background-color: var(--color-primary-700);
    border-color: var(--color-primary-700);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: transparent;
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.btn-secondary:hover {
    background-color: var(--color-primary);
    color: white;
    transform: translateY(-2px);
}

/* Podcast player */
.podcast-player {
    margin: calc(var(--spacing-unit) * 1.5) 0;
    padding: var(--spacing-unit);
    background-color: var(--color-surface);
    border-radius: var(--border-radius);
    border: 1px solid var(--color-border);
}

.podcast-player audio {
    width: 100%;
    outline: none;
}

/* Imágenes responsive en custom post types */
.post-thumbnail {
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius);
    background-color: var(--color-surface);
}

.post-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    aspect-ratio: 16 / 9;
}

/* Diferentes aspect ratios para diferentes CPT */
.type-tutorial .post-thumbnail img,
.type-chapter .post-thumbnail img {
    aspect-ratio: 16 / 9;
}

.type-application .post-thumbnail img,
.type-software .post-thumbnail img {
    aspect-ratio: 1 / 1;
}

.type-podcast .post-thumbnail img {
    aspect-ratio: 1 / 1;
}

/* Imagen destacada en la vista individual del podcast */
/* Hover effect en thumbnails */
article:hover .post-thumbnail img {
    transform: scale(1.02);
    transition: transform 0.3s ease;
}

/* Featured images en single posts */
.single .post-thumbnail {
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.single .post-thumbnail img {
    width: 100%;
    height: auto;
    aspect-ratio: auto;
    max-height: 600px;
    object-fit: cover;
}

/* Override single for single-podcast (float layout) */
.single-podcast .post-thumbnail {
    float: left;
    width: 320px;
    height: auto;
    margin: 0 calc(var(--spacing-unit) * 0.7) calc(var(--spacing-unit) * 0.7) 0;
    border-radius: var(--border-radius);
    overflow: hidden;
    flex-shrink: 0;
}

.single-podcast .post-thumbnail img {
    width: 320px;
    height: auto;
    max-height: none;
    aspect-ratio: auto;
}

.single-podcast .entry-footer {
    clear: both;
}

/* Post type label (for search results) */
.post-type-label {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: var(--color-primary);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: calc(var(--border-radius) / 2);
    margin-bottom: 0.5rem;
}

/* Entry meta improvements for CPTs */
.entry-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--color-text-light);
}

.entry-meta > * {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.entry-meta strong {
    font-weight: 600;
    color: var(--color-text);
}

.entry-meta .version,
.entry-meta .duration,
.entry-meta .difficulty,
.entry-meta .platforms {
    padding: 0.25rem 0.75rem;
    background-color: var(--color-surface);
    border-radius: calc(var(--border-radius) / 2);
    border: 1px solid var(--color-border);
}

/* Search form styles */
.search-form {
    display: flex;
    gap: 0.5rem;
    max-width: 600px;
    margin: var(--spacing-unit) 0;
}

.search-form label {
    flex: 1;
    margin: 0;
}

.search-field {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    font-size: 1rem;
    background-color: var(--color-background);
    color: var(--color-text);
    transition: border-color var(--transition);
}

.search-field:focus {
    outline: none;
    border-color: var(--color-primary);
}

.search-submit {
    padding: 0.75rem 1.5rem;
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-submit:hover {
    background-color: var(--color-primary-700);
    transform: translateY(-1px);
}

/* 404 page */
.error-404 {
    text-align: center;
    padding: calc(var(--spacing-unit) * 3) var(--spacing-unit);
}

.error-404 .page-title {
    font-size: 2rem;
    margin-bottom: var(--spacing-unit);
}

.error-404-links {
    text-align: left;
    max-width: 600px;
    margin: 0 auto;
}

.error-404-links ul {
    list-style: none;
    padding: 0;
}

.error-404-links li {
    margin-bottom: 0.5rem;
}

.error-404-links a {
    display: inline-block;
    padding: 0.5rem 1rem;
    color: var(--color-primary);
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: all var(--transition);
}

.error-404-links a:hover {
    background-color: var(--color-surface);
}

/* Page header for archives */
.page-header {
    margin-bottom: calc(var(--spacing-unit) * 2);
    padding-bottom: var(--spacing-unit);
    border-bottom: 2px solid var(--color-border);
}

.page-title {
    font-size: 2rem;
    margin: 0;
}

.archive-description,
.taxonomy-description {
    margin-top: 0.5rem;
    color: var(--color-text-light);
    font-size: 1.125rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .chapters-list__item {
        padding: 0.55rem 0.9rem;
        gap: 0.65rem;
    }

    .chapters-list__num {
        width: 1.5rem;
        height: 1.5rem;
        font-size: 0.75rem;
    }
    
    .chapter-navigation {
        flex-direction: column;
    }
    
    .chapter-navigation .nav-next {
        text-align: left;
    }
    
    .app-actions,
    .software-actions {
        flex-direction: column;
    }
    
    .app-actions a,
    .software-actions a {
        width: 100%;
        text-align: center;
    }
    
    /* Imágenes responsive en móvil */
    .post-thumbnail {
        margin-bottom: var(--spacing-unit);
    }
    
    .post-thumbnail img {
        width: 100%;
        height: auto;
    }
    
    /* Aspect ratios más cuadrados en móvil */
    .type-tutorial .post-thumbnail img,
    .type-chapter .post-thumbnail img {
        aspect-ratio: 4 / 3;
    }
    
    .single .post-thumbnail img {
        max-height: 300px;
    }
    
    /* Imágenes en el contenido */
    .entry-content img {
        width: 100% !important;
        height: auto !important;
        max-width: 100%;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    .alignleft,
    .alignright {
        float: none;
        max-width: 100%;
        margin: 0 0 var(--spacing-unit) 0;
    }
    
    /* Gallery stack en móvil */
    .wp-block-gallery,
    .gallery {
        grid-template-columns: 1fr;
    }
}
