/* Learn Page Styles - Premium Professional Look */

body {
    font-family: 'Poppins', sans-serif;
    color: #1f2937;
    background-color: #f8fafc;
    /* Lighter, cleaner background */
    margin: 0;
}

/* Intro Hero Section */
.intro-section {
    text-align: center;
    margin-bottom: 4rem;
    padding: 60px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    margin-top: -40px;
    /* Counteract container padding top */
}

.intro-section h1 {
    font-size: 3rem;
    font-weight: 800;
    color: #1e40af;
    margin-bottom: 1rem;
    letter-spacing: -0.025em;
}

.intro-section p {
    color: #4b5563;
    font-size: 1.25rem;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Content Sections */
.content-section {
    margin-bottom: 5rem;
    position: relative;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.section-header {
    display: flex;
    flex-direction: column;
    margin-bottom: 2rem;
    border-bottom: none;
    padding-bottom: 0;
    position: relative;
    padding-left: 16px;
}

.section-header::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 4px;
    background: #3b82f6;
    border-radius: 4px;
}

.section-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-header h2 i {
    color: #3b82f6;
}

.section-header p {
    font-size: 1.1rem;
    color: #6b7280;
}

/* Grid Layout */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    grid-auto-rows: 1fr;
    gap: 24px;
}

/* Card Styling - Premium Glassy/Elevated Look */
.card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 32px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.03);
    border-color: #bfdbfe;
}

/* Header inside card */
.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.card-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: #eff6ff;
    /* Light blue tint */
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Poppins', monospace;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.8), 0 2px 4px rgba(59, 130, 246, 0.05);
}

.card.algorithm .card-icon {
    background: #ecfdf5;
    /* Light green tint */
    color: #059669;
}

.tag {
    background: #f1f5f9;
    color: #475569;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid #e2e8f0;
}

/* Dark mode tag variants based on context if we needed them, 
   but simplistic distinct colors work best here */
/* Large Gate Symbol Display */
.gate-symbol-large {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background: #4F46E5;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 800;
    font-family: 'Poppins', sans-serif;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Category Color Coding (Sync with Lab) */
.gate-symbol-large.basis-h {
    background: #FA4D56;
    color: white;
}

/* IBM Red */
.gate-symbol-large.pauli {
    background: #198038;
    color: white;
}

/* IBM Green */
.gate-symbol-large.phase {
    background: #007D79;
    color: white;
}

/* Teal */
.gate-symbol-large.parametric {
    background: #FF832B;
    color: white;
}

/* IBM Orange */
.gate-symbol-large.two-qubit {
    background: #1192E8;
    color: white;
}

/* IBM Light Blue */
.gate-symbol-large.multi-qubit {
    background: #6929C4;
    color: white;
}

/* IBM Purple */
.gate-symbol-large.measure {
    background: #525252;
    color: white;
}

/* Grey/Slate */

.card-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.description-block {
    margin-bottom: 24px;
    flex-grow: 1;
}

.description-block .label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.card-description {
    color: #4b5563;
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0;
}

/* Measure Card Specialty */
.measure-card {
    border-color: #cbd5e1;
    background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
}

.measure-card .card-title {
    color: #334155;
}

.measure-card .matrix-view {
    background: #334155;
    font-style: italic;
    color: #94a3b8;
    text-align: center;
}

/* Responsive Polish */
@media (max-width: 768px) {
    .intro-section h1 {
        font-size: 2.25rem;
    }

    .intro-section {
        padding: 40px 20px;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .section-header h2 {
        font-size: 1.75rem;
    }
}

/* Category Filter Bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 32px;
    padding: 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.filter-btn {
    padding: 8px 18px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: inherit;
}

.filter-btn:hover {
    background: #eff6ff;
    color: #3b82f6;
    border-color: #3b82f6;
    transform: translateY(-1px);
}

.filter-btn.active {
    background: #3b82f6;
    color: #ffffff;
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Animation for filtering */
@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.card.gate {
    animation: cardFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Matrix Row in Gate Cards */
.card-footer {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid #f0f4f8;
}

.matrix-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}

.matrix-view {
    background: #f1f5f9;
    color: #334155;
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
    font-size: 0.76rem;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    white-space: normal;
    word-break: break-all;
    line-height: 1.5;
    overflow: hidden;
}

/* Gate badge for algorithm cards */
.algo-gates-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.gate-badge {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: 'IBM Plex Mono', monospace;
    letter-spacing: 0.03em;
}

/* ── Course Cards ── */
.card.course-card {
    padding: 0;
    cursor: pointer;
    overflow: hidden;
    border-radius: 16px;
    flex-direction: column;
    animation: cardFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.card.course-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 24px 40px -8px rgba(0, 0, 0, 0.12);
}

.course-thumb-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #0f172a;
    flex-shrink: 0;
}

.course-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
    display: block;
}

.card.course-card:hover .course-thumb {
    transform: scale(1.05);
}

.course-thumb-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 40%, rgba(0,0,0,0.6) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card.course-card:hover .course-thumb-overlay {
    opacity: 1;
}

.play-btn {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: rgba(255,255,255,0.95);
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.card.course-card:hover .play-btn {
    transform: scale(1);
}

.duration-chip {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.75);
    color: white;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 6px;
    font-family: 'IBM Plex Mono', monospace;
    letter-spacing: 0.04em;
}

.course-content {
    padding: 20px 24px 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.course-content .card-title {
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.4;
    margin: 0;
}

.course-content .card-description {
    font-size: 0.85rem;
    color: #6b7280;
    line-height: 1.55;
    margin: 0;
    flex: 1;
}

.course-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
}

.course-instructor {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #475569;
}

.difficulty-badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.difficulty-badge.beginner { background: #ecfdf5; color: #059669; border: 1px solid #d1fae5; }
.difficulty-badge.intermediate { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.difficulty-badge.advanced { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.difficulty-badge.mixed { background: #f5f3ff; color: #7c3aed; border: 1px solid #ddd6fe; }
.difficulty-badge.variational { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }