:root {
    --primary: #7c3aed;
    --primary-dark: #5b21b6;
    --accent: #475569;
    --bg: #f8fafc;
    --text: #1e293b;
    --radius: 24px;
    --shadow: 0 10px 40px rgba(124,58,237,.08);
}

* {
    box-sizing: border-box;
}

html {
    direction: rtl;
}

body {
    font-family: 'IRANSans', Tahoma, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

.sec {
    padding: 80px 20px;
    min-height: 100vh;
}

.sec-title {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 50px;
    position: relative;
}

.sec-title::after {
    content: '';
    width: 80px;
    height: 4px;
    background: var(--primary);
    border-radius: 2px;
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.card {
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.4s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    height: auto;
    min-height: 420px;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 60px rgba(124,58,237,.15);
}

.card-img-wrapper {
    position: relative;
    height: 180px;
    overflow: hidden;
    background: #f8fafc;
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.5s ease;
    display: block;
    background: #f8fafc;
    padding: 10px;
}

.card:hover .card-img {
    transform: scale(1.03);
}

.card-img-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.card-img-placeholder i {
    font-size: 3.5rem;
    opacity: 0.9;
}

.logo-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
    z-index: 10;
    border: 2px solid #f1f5f9;
    overflow: hidden;
}

.logo-badge img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.logo-badge i {
    color: var(--primary);
    font-size: 1.3rem;
}

.view-count {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: rgba(0,0,0,.7);
    color: #fff;
    font-size: .75rem;
    padding: 5px 10px;
    border-radius: 15px;
    z-index: 10;
    backdrop-filter: blur(10px);
}

.card-body {
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
    text-align: center;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 12px 0;
    line-height: 1.4;
    min-height: 3.2em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.instructor-line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.instructor-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #f1f5f9;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
}

.instructor-name {
    font-size: .9rem;
    color: #64748b;
    text-decoration: none;
    font-weight: 500;
}

.instructor-name:hover {
    color: var(--primary);
}

.card-meta {
    font-size: .82rem;
    color: #64748b;
    line-height: 1.7;
    margin-bottom: 20px;
    flex: 1;
}

.card-meta div {
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.card-meta i {
    width: 16px;
    text-align: center;
    color: var(--primary);
}

.card-footer {
    margin-top: auto;
    text-align: center;
    padding-top: 15px;
    border-top: 1px solid #f1f5f9;
}

.card-btn {
    display: inline-block;
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 10px 24px;
    border-radius: 50px;
    font-size: .85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.card-btn:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124,58,237,.3);
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #64748b;
    grid-column: 1 / -1;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 50px;
    flex-wrap: wrap;
}

.pagination a, .pagination span {
    background: #fff;
    border: 1px solid #e2e8f0;
    padding: 10px 16px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.3s ease;
    display: inline-block;
    font-size: .9rem;
}

.pagination .current {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.pagination a:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.search-filter {
    max-width: 600px;
    margin: 0 auto 40px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.search-form {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
    justify-content: center;
}

.search-box {
    padding: 12px 18px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: .95rem;
    flex: 1;
    min-width: 250px;
    max-width: 400px;
    font-family: inherit;
    transition: all 0.3s ease;
}

.search-box:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124,58,237,.1);
}

.search-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    cursor: pointer;
    font-size: .95rem;
    font-family: inherit;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.search-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.clear-filter {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 10px 16px;
    border-radius: 50px;
    font-size: .8rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    white-space: nowrap;
}

.clear-filter:hover {
    background: var(--primary);
    color: #fff;
}

.animate-fade {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.6s ease, transform 0.6s ease;
}
.animate-fade.show {
    opacity: 1 !important;
    transform: translateY(0) !important;
}