/* Tag Catalog */
.tag-catalog {
    margin: 0 auto;
    padding: 20px;
}

.tag-catalog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.tag-catalog-header h1 {
    margin: 0;
}

.tag-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
}

.tag-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.tag-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    text-decoration: none;
    color: inherit;
}

.tag-card-image {
    height: 160px;
    overflow: hidden;
    background: #f5f5f5;
}

.tag-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tag-card-body {
    padding: 15px;
}

.tag-card-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
}

.tag-card-stats {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: #7f8c8d;
}

/* Courses Grid */
.tag-courses {
    margin: 0 auto;
    padding: 20px;
}

.tag-courses-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.tag-courses-header h1 {
    margin: 0;
    flex: 1;
}

.tag-courses-count {
    color: #555;
    font-size: 16px;
}

.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.course-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.course-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    text-decoration: none;
    color: inherit;
}

.course-card-image {
    height: 200px;
    overflow: hidden;
    background: #f5f5f5;
    position: relative;
}

.course-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s;
}

.course-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    opacity: 0;
    transition: opacity 0.3s;
    display: flex;
    align-items: center;
    padding: 20px;
    overflow-y: auto;
}

.course-card:hover .course-card-overlay {
    opacity: 1;
}

.course-card:hover .course-card-image img {
    opacity: 0.3;
}

.course-card-description {
    color: #fff;
    font-size: 13px;
    line-height: 1.6;
    max-height: 100%;
    overflow-y: auto;
}

.course-card-body {
    padding: 15px;
}

.course-card-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
}

.course-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: #222;
}

.course-card-price {
    font-weight: 600;
    color: #2c3e50;
    font-size: 16px;
}

.price-free {
    color: #27ae60;
}

/* Images Manager */
.tag-images-manager {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.tag-images-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.tag-images-grid {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.tag-image-item {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    gap: 30px;
    align-items: center;
}

.tag-image-preview {
    flex: 0 0 200px;
}

.tag-image-preview h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
}

.tag-image-preview img {
    width: 200px;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    background: #f5f5f5;
}

.no-image-placeholder {
    width: 200px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 8px;
    color: #bdc3c7;
    font-size: 14px;
}

.tag-image-upload {
    flex: 1;
}

@media (max-width: 768px) {
    .tag-image-item {
        flex-direction: column;
        text-align: center;
    }

    .tag-image-preview {
        flex: 0 0 auto;
    }

    .tag-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .courses-grid {
        grid-template-columns: 1fr;
    }
}

/* Tag Card */
.tag-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border-radius: 7px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.tag-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    text-decoration: none;
    color: inherit;
}

/* Изображение и overlay */
.tag-card-image {
    height: 260px;
    overflow: hidden;
    background: #f5f5f5;
    position: relative;
}

.tag-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

/* Hover overlay */
.tag-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.tag-card:hover .tag-card-overlay {
    opacity: 1;
}

.tag-card:hover .tag-card-img {
    opacity: 0.3;
}

.tag-card-stats-hover {
    color: #fff;
    text-align: center;
    font-size: 14px;
    line-height: 1.8;
    width: 100%;
}

.stat-item {
    padding: 4px 0;
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-item:first-child {
    font-weight: 600;
    font-size: 15px;
}

/* Остальные стии */
.tag-card-body {
    padding: 15px;
}

.tag-card-title {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.tag-card-stats {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: #7f8c8d;
}

.tag-card-courses {
    color: #3498db;
    font-weight: 500;
}

.tag-card-duration {
    color: #27ae60;
    font-weight: 500;
}

/* Адаптив */
@media (max-width: 768px) {
    .tag-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .tag-card-image {
        height: 120px;
    }

    .tag-card-stats-hover {
        font-size: 12px;
    }
}
