/* ==========================================================================
   صفحه آکادمی — /academy
   ========================================================================== */

.academy-page {
    background: var(--app-bg);
    min-height: 60vh;
    padding-bottom: 3rem;
}

/* ---------- Hero ---------- */
.ac-hero {
    position: relative;
    overflow: hidden;
    padding: 2.2rem 0 3.4rem;
    background: linear-gradient(135deg, #312e81 0%, #4f46e5 55%, #0ea5e9 100%);
    color: #fff;
}

.ac-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 12% 20%, rgba(255, 255, 255, 0.14), transparent 45%),
        radial-gradient(circle at 88% 85%, rgba(14, 165, 233, 0.35), transparent 50%);
    pointer-events: none;
}

.ac-hero__inner {
    position: relative;
    z-index: 1;
}

.ac-crumbs {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.9rem;
    font-size: 0.76rem;
    color: rgba(255, 255, 255, 0.72);
}

.ac-crumbs a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
}

.ac-crumbs a:hover {
    color: #fff;
    text-decoration: underline;
}

.ac-hero h1 {
    margin: 0 0 0.6rem;
    font-size: clamp(1.5rem, 3.6vw, 2.3rem);
    font-weight: 800;
    color: #fff;
    line-height: 1.45;
}

.ac-hero p {
    margin: 0;
    max-width: 64ch;
    color: rgba(255, 255, 255, 0.86);
    line-height: 1.9;
    font-size: 0.95rem;
}

.ac-hero__stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.15rem;
}

.ac-hero__stat {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.13);
    border: 1px solid rgba(255, 255, 255, 0.22);
    font-size: 0.8rem;
    white-space: nowrap;
}

/* ---------- Toolbar ---------- */
.ac-toolbar {
    position: relative;
    z-index: 2;
    margin-top: -2rem;
    padding: 1rem;
    border-radius: 1.15rem;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    box-shadow: 0 18px 40px -28px var(--app-shadow-xl);
}

.ac-toolbar__top {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ac-search {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

.ac-search input {
    width: 100%;
    padding: 0.68rem 2.6rem 0.68rem 1rem;
    border-radius: 0.8rem;
    border: 1px solid var(--app-input-border);
    background: var(--app-input-bg);
    color: var(--app-text);
    font-size: 0.92rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ac-search input:focus {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 3px var(--app-input-focus);
}

.ac-search input::placeholder {
    color: var(--app-placeholder);
}

.ac-search__icon {
    position: absolute;
    top: 50%;
    right: 0.95rem;
    transform: translateY(-50%);
    color: var(--app-text-muted);
    pointer-events: none;
}

/* ---------- Type tabs ---------- */
.ac-seg {
    display: inline-flex;
    flex: 0 0 auto;
    gap: 0.15rem;
    padding: 0.2rem;
    border-radius: 0.75rem;
    background: var(--app-bg);
    border: 1px solid var(--app-border);
}

.ac-seg__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 0;
    background: transparent;
    color: var(--app-text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.42rem 0.8rem;
    border-radius: 0.55rem;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.ac-seg__btn:hover {
    color: var(--app-primary);
}

.ac-seg__btn.is-active {
    background: var(--app-surface);
    color: var(--app-primary);
    box-shadow: 0 2px 8px -4px var(--app-shadow-lg);
}

.ac-seg__count {
    min-width: 1.35rem;
    padding: 0.05rem 0.35rem;
    border-radius: 999px;
    background: var(--app-primary-light);
    color: var(--app-primary);
    font-size: 0.68rem;
    font-weight: 700;
    text-align: center;
}

.ac-seg__btn:not(.is-active) .ac-seg__count {
    background: var(--app-surface);
    color: var(--app-text-muted);
}

/* ---------- Category chips ---------- */
.ac-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.8rem;
}

.ac-chips__label {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--app-text-muted);
}

.ac-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.32rem 0.8rem;
    border-radius: 999px;
    border: 1px solid var(--app-border);
    background: var(--app-bg);
    color: var(--app-text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ac-chip:hover {
    border-color: var(--app-primary);
    color: var(--app-primary);
}

.ac-chip.is-active {
    background: var(--app-primary);
    border-color: var(--app-primary);
    color: #fff;
}

.ac-chip__count {
    font-size: 0.68rem;
    opacity: 0.75;
}

/* ---------- Featured band ---------- */
.ac-featured {
    margin-top: 2rem;
    padding: 1rem;
    border-radius: 1.15rem;
    background:
        linear-gradient(180deg, var(--app-primary-light), transparent 150%),
        var(--app-surface);
    border: 1px solid var(--app-border);
}

.ac-featured__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.55rem;
    margin-bottom: 0.85rem;
}

.ac-featured__title {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
    color: var(--app-text);
}

.ac-featured__title .oi {
    color: var(--app-warning);
}

.ac-featured__hint {
    font-size: 0.75rem;
    color: var(--app-text-muted);
}

.ac-featured__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.7rem;
}

.ac-spot {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem;
    border-radius: 0.85rem;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    text-decoration: none;
    min-width: 0;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.ac-spot:hover {
    border-color: var(--app-primary);
    transform: translateY(-2px);
}

.ac-spot__thumb {
    display: grid;
    place-items: center;
    width: 62px;
    height: 62px;
    border-radius: 0.7rem;
    overflow: hidden;
    background: var(--app-bg);
    color: var(--app-text-muted);
    font-size: 1.3rem;
    flex: 0 0 auto;
}

.ac-spot__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ac-spot__body {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.ac-spot__type {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--app-primary);
}

.ac-spot__title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.6;
    color: var(--app-text);
}

.ac-spot__meta {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.72rem;
    color: var(--app-text-muted);
}

/* ---------- Results head ---------- */
.ac-results {
    margin-top: 2rem;
}

.ac-results__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    margin-bottom: 0.9rem;
}

.ac-results__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--app-text);
}

.ac-results__count {
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    background: var(--app-primary-light);
    color: var(--app-primary);
    font-size: 0.72rem;
    font-weight: 700;
}

.ac-sort {
    display: inline-flex;
    gap: 0.3rem;
}

.ac-sort__btn {
    border: 1px solid var(--app-border);
    background: var(--app-surface);
    color: var(--app-text-muted);
    font-size: 0.76rem;
    font-weight: 600;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ac-sort__btn:hover {
    border-color: var(--app-primary);
    color: var(--app-primary);
}

.ac-sort__btn.is-active {
    background: var(--app-primary);
    border-color: var(--app-primary);
    color: #fff;
}

/* ---------- Grid & card ---------- */
.ac-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 1rem;
}

.ac-card {
    min-width: 0;
    border-radius: 1rem;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.ac-card:hover {
    transform: translateY(-3px);
    border-color: var(--app-border-strong);
    box-shadow: 0 16px 34px -24px var(--app-shadow-xl);
}

.ac-card__link {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.ac-card__thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--app-bg);
    overflow: hidden;
}

.ac-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.ac-card:hover .ac-card__thumb img {
    transform: scale(1.04);
}

.ac-card__thumb-empty {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    color: var(--app-text-muted);
    font-size: 1.6rem;
}

.ac-card__badge {
    position: absolute;
    top: 0.55rem;
    right: 0.55rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.67rem;
    font-weight: 700;
    color: #fff;
    background: var(--app-primary);
}

.ac-card__badge--article {
    background: #0d9488;
}

.ac-card__premium {
    position: absolute;
    top: 0.55rem;
    left: 0.55rem;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.64rem;
    font-weight: 700;
    background: #f59e0b;
    color: #1f2937;
}

.ac-card__body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    padding: 0.75rem 0.9rem 0.85rem;
}

.ac-card__cat {
    align-self: flex-start;
    margin-bottom: 0.3rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: var(--app-primary-light);
    color: var(--app-primary);
    font-size: 0.66rem;
    font-weight: 700;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ac-card__title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1.65;
    color: var(--app-text);
}

.ac-card__desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0.25rem 0 0.65rem;
    font-size: 0.77rem;
    line-height: 1.8;
    color: var(--app-text-muted);
}

.ac-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    margin-top: auto;
    padding-top: 0.55rem;
    border-top: 1px solid var(--app-divider);
    font-size: 0.72rem;
    color: var(--app-text-muted);
}

.ac-card__cta {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 700;
    color: var(--app-primary);
    white-space: nowrap;
}

/* ---------- Skeletons ---------- */
.ac-skel {
    background: var(--app-bg);
    border-radius: 0.45rem;
    animation: ac-pulse 1.6s ease-in-out infinite;
}

.ac-skel--thumb {
    border-radius: 0;
    aspect-ratio: 16 / 9;
    width: 100%;
}

.ac-skel-body {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.8rem 0.9rem;
}

.ac-skel--line {
    height: 0.8rem;
}

.ac-skel--short {
    width: 62%;
}

@keyframes ac-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

/* ---------- Empty / more ---------- */
.ac-empty {
    margin-top: 1.6rem;
    padding: 2.4rem 1rem;
    text-align: center;
    border-radius: 1rem;
    border: 1px dashed var(--app-border-strong);
    color: var(--app-text-muted);
}

.ac-empty > span.oi {
    display: block;
    font-size: 2rem;
    margin-bottom: 0.55rem;
}

.ac-empty h2 {
    margin: 0 0 0.35rem;
    font-size: 1.02rem;
    font-weight: 800;
    color: var(--app-text-secondary);
}

.ac-empty p {
    margin: 0 0 0.9rem;
    font-size: 0.85rem;
    line-height: 1.9;
}

.ac-more {
    display: flex;
    justify-content: center;
    margin-top: 1.6rem;
}

.ac-more__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.6rem;
    border-radius: 999px;
    border: 1px solid var(--app-primary);
    background: var(--app-surface);
    color: var(--app-primary);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ac-more__btn:hover {
    background: var(--app-primary);
    color: #fff;
}

.ac-more__count {
    font-size: 0.72rem;
    opacity: 0.75;
}

/* ---------- Mobile ---------- */
@media (max-width: 767.98px) {
    .ac-toolbar__top {
        flex-direction: column;
        align-items: stretch;
    }

    .ac-seg {
        width: 100%;
    }

    .ac-seg__btn {
        flex: 1 1 0;
        justify-content: center;
    }
}

@media (max-width: 575.98px) {
    .ac-hero {
        padding: 1.6rem 0 3rem;
    }

    .ac-toolbar {
        margin-top: -1.6rem;
        padding: 0.8rem;
    }

    .ac-hero__stat:last-child {
        display: none;
    }

    .ac-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.7rem;
    }

    .ac-card__body {
        padding: 0.6rem 0.7rem 0.7rem;
    }

    .ac-card__title {
        font-size: 0.82rem;
    }

    .ac-card__desc {
        margin-bottom: 0.5rem;
        font-size: 0.72rem;
    }

    .ac-card__meta {
        font-size: 0.67rem;
    }

    .ac-card__cta .oi {
        display: none;
    }

    .ac-featured__grid {
        grid-template-columns: 1fr;
    }

    .ac-sort__btn {
        font-size: 0.72rem;
        padding: 0.28rem 0.6rem;
    }
}

/* ---------- My study corner (progress + bookmarks) ---------- */
.ac-mine {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.2rem;
}

.ac-mine__block {
    background: var(--app-card-bg, #fff);
    border: 1px solid var(--app-border, #e2e8f0);
    border-radius: 1rem;
    padding: 0.9rem 1rem;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.05);
}

.ac-mine__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.7rem;
}

.ac-mine__title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--app-text, #0f172a);
}

.ac-mine__title .oi {
    color: var(--app-primary, #4f46e5);
}

.ac-mine__clear {
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #b91c1c;
    border-radius: 0.6rem;
    padding: 0.3rem 0.7rem;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
}

.ac-mine__clear:hover {
    background: #fee2e2;
}

.ac-mine__row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 0.6rem;
}

.ac-continue {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.7rem 0.85rem;
    border-radius: 0.8rem;
    background: var(--app-bg, #f8fafc);
    border: 1px solid var(--app-border, #e2e8f0);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ac-continue:hover {
    border-color: #a5b4fc;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.12);
    color: inherit;
}

.ac-continue__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.ac-continue__course {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--app-primary, #4f46e5);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ac-continue__lesson {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--app-text, #0f172a);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ac-continue__bar {
    display: block;
    height: 5px;
    border-radius: 999px;
    background: var(--app-border, #e2e8f0);
    overflow: hidden;
}

.ac-continue__bar span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #22c55e, #4ade80);
}

.ac-continue__percent {
    font-size: 0.72rem;
    font-weight: 800;
    color: #15803d;
}

.ac-mine__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ac-bookmark {
    display: inline-flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.5rem 0.8rem;
    border-radius: 0.7rem;
    background: var(--app-bg, #f8fafc);
    border: 1px solid var(--app-border, #e2e8f0);
    text-decoration: none;
    color: inherit;
    max-width: 240px;
    transition: border-color 0.15s ease;
}

.ac-bookmark:hover {
    border-color: #a5b4fc;
    color: inherit;
}

.ac-bookmark__course {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--app-primary, #4f46e5);
}

.ac-bookmark__title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--app-text, #0f172a);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- Dark mode accents ---------- */
[data-theme="dark"] .ac-hero::before {
    background-image:
        radial-gradient(circle at 12% 20%, rgba(255, 255, 255, 0.1), transparent 45%),
        radial-gradient(circle at 88% 85%, rgba(79, 70, 229, 0.45), transparent 50%);
}

[data-theme="dark"] .ac-card__premium {
    color: #0f172a;
}
