/* General */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #f8f9fa;
}

.main-content {
    min-height: calc(100vh - 200px);
}

/* Breadcrumbs — единый серый стиль без подсветки */
.breadcrumb-item a,
.breadcrumb-item.active,
.breadcrumb-item + .breadcrumb-item::before {
    color: #6c757d;
    text-decoration: none;
}
.breadcrumb-item a:hover {
    color: #495057;
    text-decoration: none;
}

/* Header Icon Badges */
.site-logo {
    display: block;
    max-width: 180px;
    max-height: 38px;
    object-fit: contain;
}

.icon-badge-wrapper {
    position: relative;
    display: inline-block;
    padding: 0.5rem 0.4rem !important;
}

.icon-badge {
    position: absolute;
    top: 2px;
    right: -6px;
    background: #dc3545;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 50%;
    padding: 0 4px;
}

/* Courses Grid */
.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* Course Card */
.course-card {
    transition: all 0.3s ease;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.course-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.12) !important;
}

.card-img-wrapper {
    height: 200px;
    overflow: hidden;
    position: relative;
}

.card-img-wrapper img,
.card-img-wrapper > div {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.course-card:hover .card-img-wrapper img,
.course-card:hover .card-img-wrapper > div {
    transform: scale(1.05);
    filter: blur(2px) brightness(0.7);
}

/* Favorite button on card */
.card-fav-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    width: 34px;
    height: 34px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.2s ease;
    background: rgba(255,255,255,0.9) !important;
    border: none !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.card-fav-btn:hover {
    transform: scale(1.15);
    background: #fff !important;
}

.card-fav-btn .bi-heart-fill {
    color: #dc3545;
}

.card-fav-btn .bi-heart {
    color: #333;
}

.course-card:hover .card-fav-btn {
    opacity: 1;
}

.card-title-clamp {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.8em;
}

.card-description {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Card Overlay */
.card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
    padding: 2rem 1rem 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.cart-card-qty {
    align-items: center;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.cart-card-qty-value {
    font-weight: 700;
    min-width: 2rem;
    text-align: center;
}

.card-overlay .cart-card-qty-value {
    color: #fff;
}

.cart-card-qty-plus:disabled,
.cart-card-qty-minus:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.cart-total-amount {
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
}

.course-card:hover .card-overlay {
    opacity: 1;
}

/* Category Card */
.category-card {
    transition: all 0.3s ease;
    border-radius: 12px;
}

.category-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1) !important;
}

/* Search Autocomplete */
.search-wrapper {
    position: relative;
}

.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    z-index: 1050;
    max-height: 400px;
    overflow-y: auto;
}

.autocomplete-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    text-decoration: none;
    color: #333;
    transition: background 0.2s;
}

.autocomplete-item:hover {
    background: #f0f0f0;
}

.autocomplete-item img {
    width: 50px;
    height: 38px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 12px;
}

/* Star Rating */
.star-rating i {
    color: #ddd;
    transition: color 0.2s;
}

.star-rating i.bi-star-fill {
    color: #ffc107;
}

/* Hero */
.hero-section {
    background-size: cover;
    background-position: center;
}

.hero-image {
    max-height: 360px;
    object-fit: contain;
}

/* Cart */
.cart-item {
    transition: all 0.3s ease;
}

.cart-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08) !important;
}

/* Responsive */
@media (max-width: 768px) {
    .courses-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 1rem;
    }

    .hero-section {
        min-height: 350px !important;
    }

    .hero-section h1 {
        font-size: 2rem;
    }
}

/* Плашка «курс уже куплен» — информационная, появляется при наведении */
.course-purchased-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 56px; /* оставляем место для кнопки избранного справа */
    padding: 8px 12px;
    border-radius: 12px;
    background: rgba(25, 135, 84, 0.95);
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    text-align: center;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 6;
    box-shadow: 0 4px 12px rgba(25, 135, 84, 0.35);
}

.course-card--purchased:hover .course-purchased-badge {
    opacity: 1;
    transform: translateY(0);
}

/* На устройствах без hover показываем плашку сразу компактным бейджем */
@media (hover: none) {
    .course-purchased-badge {
        opacity: 1;
        transform: none;
        position: static;
        margin: 8px 8px 0;
    }
}
