/**
 * Caly-Quiz IRVE - Catalogue de Cours Premium
 * Design moderne avec animations et effets visuels
 * Version 2.0 - Habilec Light Theme
 */

/* ============================================
   CONTAINER PRINCIPAL
   ============================================ */
.catalog-container {
    background: #f5f5f5;
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ============================================
   HERO SECTION
   ============================================ */
.catalog-hero {
    position: relative;
    padding: 1rem 1.5rem 1.5rem;
    overflow: hidden;
    border-bottom: 1px solid rgba(245, 158, 11, 0.1);
}

.hero-bg-gradient {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(245, 158, 11, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 50%, rgba(139, 92, 246, 0.07) 0%, transparent 50%);
    animation: hero-pulse 8s ease-in-out infinite;
}

@keyframes hero-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.hero-bg-pattern {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(245, 158, 11, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(245, 158, 11, 0.04) 1px, transparent 1px);
    background-size: 50px 50px;
}

.btn-back-floating {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid #e5e7eb;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    z-index: 10;
}

.btn-back-floating:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #1f2937;
    border-color: #d1d5db;
    transform: translateX(-3px);
}

.hero-content {
    position: relative;
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
    z-index: 1;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(139, 92, 246, 0.1) 100%);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #92400e;
    margin-bottom: 0.5rem;
    animation: badge-glow 3s ease-in-out infinite;
}

@keyframes badge-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(245, 158, 11, 0.08); }
    50% { box-shadow: 0 0 30px rgba(245, 158, 11, 0.15); }
}

.catalog-hero h1 {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(1.4rem, 3vw, 1.8rem);
    font-weight: 700;
    background: linear-gradient(135deg, #1e3a5f 0%, #4b5563 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 0.25rem 0;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: 0.9rem;
    color: #6b7280;
    margin: 0;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.9rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.stat-card:hover {
    background: #f8f9fa;
    border-color: rgba(245, 158, 11, 0.3);
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 1.2rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1;
}

.stat-label {
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================
   TOOLBAR / BARRE DE CONTROLE
   ============================================ */
.catalog-toolbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid #e5e7eb;
    padding: 1rem 1.5rem;
}

.toolbar-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 1400px;
    margin: 0 auto;
    flex-wrap: wrap;
}

/* Search Box */
.search-box {
    flex: 1;
    min-width: 280px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-box .search-icon {
    position: absolute;
    left: 14px;
    width: 18px;
    height: 18px;
    color: #9ca3af;
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 2.75rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    color: #1f2937;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.search-box input:focus {
    outline: none;
    background: #ffffff;
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.search-box input::placeholder {
    color: #9ca3af;
}

.search-box .clear-btn {
    position: absolute;
    right: 10px;
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 6px;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
}

.search-box .clear-btn svg {
    width: 14px;
    height: 14px;
}

.search-box input:not(:placeholder-shown) ~ .clear-btn {
    opacity: 1;
}

.search-box .clear-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Dropdown */
.dropdown-wrapper {
    position: relative;
}

.dropdown-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    color: #1f2937;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 200px;
}

.dropdown-btn:hover {
    background: #f8f9fa;
    border-color: #d1d5db;
}

.dropdown-btn.open {
    background: #ffffff;
    border-color: #f59e0b;
}

.dropdown-icon {
    font-size: 1.1rem;
}

.dropdown-text {
    flex: 1;
    text-align: left;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-arrow {
    width: 16px;
    height: 16px;
    color: #6b7280;
    transition: transform 0.2s ease;
}

.dropdown-btn.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    min-width: 250px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    max-height: 400px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.dropdown-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    cursor: pointer;
    transition: all 0.15s ease;
    border-bottom: 1px solid #f3f4f6;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: rgba(245, 158, 11, 0.06);
}

.dropdown-item.active {
    background: rgba(245, 158, 11, 0.1);
}

.dropdown-item .item-label {
    font-size: 0.9rem;
    color: #1f2937;
}

.dropdown-item.active .item-label {
    color: #92400e;
    font-weight: 500;
}

.dropdown-item .item-count {
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
    background: #f3f4f6;
    border-radius: 20px;
    color: #6b7280;
}

.dropdown-item.active .item-count {
    background: #f59e0b;
    color: white;
}

/* Toolbar Divider */
.toolbar-divider {
    width: 1px;
    height: 32px;
    background: #e5e7eb;
}

/* Sort Box */
.sort-box {
    position: relative;
    display: flex;
    align-items: center;
}

.sort-box .sort-icon {
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    color: #9ca3af;
    pointer-events: none;
}

.sort-box select {
    padding: 0.75rem 2rem 0.75rem 2.5rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    color: #1f2937;
    font-size: 0.9rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: all 0.2s ease;
}

.sort-box select:hover {
    background-color: #f8f9fa;
    border-color: #d1d5db;
}

.sort-box select:focus {
    outline: none;
    border-color: #f59e0b;
}

/* View Switcher */
.view-switcher {
    display: flex;
    background: #ffffff;
    border-radius: 10px;
    padding: 4px;
    border: 1px solid #e5e7eb;
}

.view-btn {
    width: 38px;
    height: 38px;
    border: none;
    background: transparent;
    border-radius: 8px;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.view-btn svg {
    width: 18px;
    height: 18px;
}

.view-btn:hover {
    color: #1f2937;
    background: #f3f4f6;
}

.view-btn.active {
    background: #f59e0b;
    color: white;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

/* ============================================
   QUICK FILTERS (Tags)
   ============================================ */
.quick-filters {
    padding: 1rem 1.5rem;
    background: #fffdf7;
    border-bottom: 1px solid #f3f4f6;
}

.filters-scroll {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

.cat-tab {
    flex-shrink: 0;
    padding: 0.5rem 1rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #6b7280;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.cat-tab:hover {
    background: #f8f9fa;
    color: #1f2937;
    border-color: #d1d5db;
}

.cat-tab.active {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-color: transparent;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

/* ============================================
   RESULTS INFO
   ============================================ */
.results-info {
    padding: 1rem 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

.results-count {
    font-size: 0.9rem;
    color: #6b7280;
}

.results-count strong {
    color: #1f2937;
}

/* ============================================
   COURSES GRID
   ============================================ */
.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.5rem;
    padding: 0 1.5rem 3rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Loading State */
.loading-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    color: #6b7280;
}

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(245, 158, 11, 0.15);
    border-top-color: #f59e0b;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

/* ============================================
   COURSE CARD - Design Premium
   ============================================ */
.course-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.course-card:hover {
    transform: translateY(-6px);
    border-color: rgba(245, 158, 11, 0.3);
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(245, 158, 11, 0.1);
}

.course-thumb {
    height: 110px;
    background: linear-gradient(135deg, #fffdf7 0%, #f5f5f5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.course-thumb::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 30% 30%, rgba(245, 158, 11, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 70% 70%, rgba(139, 92, 246, 0.05) 0%, transparent 50%);
}

.course-thumb .initials {
    font-size: 2.2rem;
    font-weight: 700;
    color: rgba(0, 0, 0, 0.06);
    letter-spacing: 0.05em;
    position: relative;
}

.course-thumb .category-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 0.3rem 0.7rem;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 6px;
    font-size: 0.7rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid #e5e7eb;
}

.course-thumb .slide-count {
    position: absolute;
    bottom: 12px;
    right: 12px;
    padding: 0.3rem 0.6rem;
    background: rgba(245, 158, 11, 0.9);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.course-info {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.course-title {
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e3a5f;
    margin-bottom: 0.4rem;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.course-desc {
    font-size: 0.8rem;
    color: #6b7280;
    line-height: 1.45;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.course-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag-badge {
    padding: 0.25rem 0.6rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 6px;
    font-size: 0.7rem;
    color: #92400e;
    font-weight: 500;
}

.course-card:hover .tag-badge {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
}

/* ============================================
   LIST VIEW
   ============================================ */
.courses-grid.list-view {
    grid-template-columns: 1fr;
    gap: 1rem;
}

.courses-grid.list-view .course-card {
    flex-direction: row;
    height: auto;
}

.courses-grid.list-view .course-thumb {
    width: 180px;
    height: 120px;
    flex-shrink: 0;
}

.courses-grid.list-view .course-thumb .initials {
    font-size: 2rem;
}

.courses-grid.list-view .course-info {
    padding: 1rem 1.25rem;
    justify-content: center;
}

.courses-grid.list-view .course-title {
    font-size: 1rem;
    -webkit-line-clamp: 1;
}

.courses-grid.list-view .course-desc {
    -webkit-line-clamp: 1;
    margin-bottom: 0.5rem;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
}

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

.empty-state-title {
    font-size: 1.25rem;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.empty-state-text {
    color: #6b7280;
    font-size: 0.9rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .catalog-hero {
        padding: 1.5rem 1rem 2rem;
    }

    .catalog-hero h1 {
        font-size: 1.75rem;
    }

    .hero-stats {
        gap: 0.75rem;
    }

    .stat-card {
        padding: 0.5rem 0.75rem;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    .catalog-toolbar {
        padding: 0.75rem 1rem;
    }

    .toolbar-inner {
        gap: 0.75rem;
    }

    .search-box {
        min-width: 100%;
        order: -1;
    }

    .toolbar-divider {
        display: none;
    }

    .dropdown-wrapper {
        flex: 1;
    }

    .dropdown-btn {
        min-width: auto;
        width: 100%;
    }

    .courses-grid {
        grid-template-columns: 1fr;
        padding: 0 1rem 2rem;
    }

    .courses-grid.list-view .course-card {
        flex-direction: column;
    }

    .courses-grid.list-view .course-thumb {
        width: 100%;
        height: 120px;
    }
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */
.catalog-container::-webkit-scrollbar,
.dropdown-menu::-webkit-scrollbar,
.filters-scroll::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.catalog-container::-webkit-scrollbar-track,
.dropdown-menu::-webkit-scrollbar-track,
.filters-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.catalog-container::-webkit-scrollbar-thumb,
.dropdown-menu::-webkit-scrollbar-thumb,
.filters-scroll::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.catalog-container::-webkit-scrollbar-thumb:hover,
.dropdown-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}
