/* --- Estilos para la sección de Exploración --- */
.browse-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

/* Grid Layout */
.browse-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
    width: 100%;
    padding-bottom: 0.5rem;
}

/* Card Base */
.browse-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    text-decoration: none;
    color: var(--text-main);
}

.browse-card:hover {
    transform: translateY(-4px);
    /* ✅ UPDATE: Blue Glow Effect for contrast */
    box-shadow:
        0 20px 25px -5px rgba(0, 0, 0, 0.3),
        0 10px 10px -5px rgba(0, 0, 0, 0.2),
        0 0 15px rgba(56, 189, 248, 0.4);
    /* Sky-400 Glow */
    border-color: rgba(56, 189, 248, 0.5);
    /* Subtle border glow */
}

/* Card Icon Area */
/* Card Icon Area (Default for when no image) */
.browse-card-icon {
    width: 100%;
    height: 140px;
    /* Standardize height for better consistency */
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    /* Larger icon */
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    transition: color 0.2s;
}

/* ✅ NUEVO: Estilos para imágenes de portada de cursos/carreras */
.browse-card-image-container {
    width: 100%;
    height: 160px;
    /* Slightly taller for images 16:9 approx in card width */
    overflow: hidden;
    position: relative;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.browse-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Recortar para llenar */
    transition: transform 0.5s ease;
}

.browse-card:hover .browse-card-image {
    transform: scale(1.05);
    /* Efecto zoom sutil */
}

.browse-card:hover .browse-card-icon {
    color: var(--primary-light);
}

/* Card Content */
.browse-card-content {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.browse-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.4;
    margin: 0;
}

.course-card-code {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    align-self: flex-start;
}

.course-card-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: 0.5rem;
}

/* Variant: Career Card */
.career-card .browse-card-icon {
    background: linear-gradient(to bottom right, var(--bg-tertiary), var(--bg-secondary));
    height: 140px;
    font-size: 3rem;
}

/* Variant: Course Card */
.course-card .browse-card-icon {
    background: var(--bg-secondary);
}

/* Bookmarks ribbon */
.card-bookmark-ribbon {
    position: absolute;
    top: 0;
    right: 12px;
    color: var(--warning);
    font-size: 1.25rem;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3));
}

.browse-card-cta {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.875rem;
    color: var(--primary-light);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s;
}

.browse-card:hover .browse-card-cta {
    color: var(--primary);
}

/* Area Section (for grouping) */
.area-section {
    margin-bottom: 2.5rem;
}

/* ✅ ESTILOS FULL IMAGE CARD (TIPO NETFLIX/POSTER) */
.full-image-card {
    position: relative;
    border: none !important;
    /* Remove border as image covers it */
    min-height: 280px;
    /* Taller look */
    background: #000;
}

.browse-card-image-full {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.19, 1, 0.22, 1);
    z-index: 0;
}

.full-image-card:hover .browse-card-image-full {
    transform: scale(1.1);
}

.browse-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom,
            rgba(0, 0, 0, 0.1) 0%,
            rgba(0, 0, 0, 0.2) 40%,
            rgba(0, 0, 0, 0.8) 80%,
            rgba(0, 0, 0, 0.95) 100%);
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.overlay-content {
    padding: 1.25rem;
    position: relative;
    z-index: 2;
    padding-bottom: 0.5rem;
    /* Less bottom padding as CTA is separate visually */
}

.overlay-cta {
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(4px);
    color: rgba(255, 255, 255, 0.9) !important;
    z-index: 2;
}

.full-image-card:hover .overlay-cta {
    background: rgba(var(--primary-rgb), 0.2);
    color: #fff !important;
}

.text-white {
    color: #fff !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    font-size: 1.1rem;
}

/* Ajuste para el código/badge en modo oscuro */
.full-image-card .course-card-code {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.area-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    padding-left: 0.5rem;
}

/* =========================================
   LIBRARY / ACTIONS STYLES
   ========================================= */

/* Action Buttons Container (Top Right of Card) */
.card-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.action-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    /* Glassmorphism light */
    backdrop-filter: blur(4px);
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

.action-btn i {
    font-size: 1rem;
    transition: all 0.2s ease;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3));
    /* Text shadow for icon */
}

/* Active States */
.action-btn.active.save-btn i {
    color: #FFD700;
    /* Gold for Saved */
    font-weight: 900;
}

.action-btn.active.fav-btn i {
    color: #FF4757;
    /* Red for Favorite */
    font-weight: 900;
}

/* Library Drawer (Side Panel - LEFT SIDE) */
.library-drawer {
    position: fixed;
    top: 0;
    left: -320px;
    /* Hidden default (LEFT) */
    width: 320px;
    height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    /* Border on right */
    box-shadow: 5px 0 25px rgba(0, 0, 0, 0.3);
    /* Shadow to right */
    z-index: 1000;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.library-drawer.open {
    left: 0;
}

.library-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
}

.library-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

.close-drawer-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.5rem;
}

.close-drawer-btn:hover {
    color: var(--text-main);
}

/* Tabs */
.library-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
}

.library-tab {
    flex: 1;
    text-align: center;
    padding: 1rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.library-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--bg-tertiary);
}

/* Content List */
.library-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.library-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.library-item {
    display: flex;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.library-item:hover {
    transform: translateX(4px);
    /* Slide right on hover */
    border-color: var(--primary-light);
}

.library-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}

.library-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.library-item-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.library-item-type {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Floating Toggle Button (LEFT SIDE) */
.library-toggle {
    position: fixed;
    left: 0;
    /* Left side */
    top: 50%;
    transform: translateY(-50%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: none;
    /* No border on edge */
    border-radius: 0 8px 8px 0;
    /* Rounded right corners */
    padding: 1rem 0.6rem;
    cursor: pointer;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    /* Shadow to right */
    z-index: 999;
    color: var(--primary);
    transition: left 0.3s, background 0.2s;
}

.library-toggle:hover {
    background: var(--primary);
    color: #fff;
    padding-left: 0.8rem;
    /* Slide out slightly (right) */
}

/* Move toggle when drawer opens */
.library-drawer.open~.library-toggle {
    left: 320px;
}

.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}