/* ============ Style For Stories ========= */

/* Grid System - Tối ưu với breakpoints */
.list-story {
    display: grid;
    gap: 15px;
    grid-template-columns: repeat(3, 1fr); /* Mobile default */
}

@media (min-width: 576px) {
    .list-story {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 768px) {
    .list-story {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 992px) {
    .list-story {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (min-width: 1200px) {
    .list-story {
        grid-template-columns: repeat(8, 1fr);
    }
}

/* Story Item */
.story-item {
    max-width: 150px;
    margin: 0 auto;
    width: 100%;
}

.story-item a {
    position: relative;
    display: block;
    text-decoration: none;
}

.story-item__image {
    overflow: hidden;
    border-radius: 4px;
}

.story-item__image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.story-item:hover img {
    transform: scale(1.08);
}

.story-item__name {
    margin: 8px 0 0;
    color: #f4f4f4;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

/* Badge System */
.list-badge {
    position: absolute;
    top: 5px;
    left: 5px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.story-item__badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    line-height: 1;
}

/* Badge Colors */
.bg-danger { background-color: #ff6347; }
.bg-info { background-color: #0dcaf0; }
.bg-success { background-color: #198754; }
.text-light { color: #ffffff; }

/* Pagination */
.paginate-story {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 30px;
}

.paginate-story a,
.paginate-story__dot {
    color: #f3dede;
    padding: 8px 16px;
    background-color: #585858;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    border-radius: 4px;
}

.paginate-story .active,
.paginate-story a:hover {
    background-color: #4caf50;
    color: #fff;
}

/* Chapter List */
.story-detail__list-chapter--list__item {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.chapter-item-btn {
    background-color: #585858;
    display: inline-block;
    padding: 6px 12px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    text-decoration: none;
    color: #fff;
}

.chapter-item-btn:hover {
    background-color: #4caf50;
    color: #fff;
}

/* Story Header Actions */
.story-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.story-head select,
.story-head input {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #ddd;
    background-color: #fff;
}

.search-story {
    display: flex;
    gap: 8px;
}

.search-story input {
    color: #000;
}

.search-story button {
    background-color: #4caf50;
    border-radius: 6px;
    padding: 8px 16px;
    color: #fff;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.search-story button:hover {
    opacity: 0.9;
}

/* Breadcrumb */
ul.breadcrumb {
    padding: 10px 16px;
    list-style: none;
    background-color: #000;
    display: inline-block;
    border-radius: 6px;
    margin-bottom: 20px;
}

ul.breadcrumb li {
    display: inline;
    font-size: 14px;
}

ul.breadcrumb li+li:before {
    padding: 0 8px;
    color: #fff;
    content: "/\00a0";
}

ul.breadcrumb li a {
    color: #0275d8;
    text-decoration: none;
}

ul.breadcrumb li a:hover {
    color: #01447e;
    text-decoration: underline;
}

/* Chapter Navigation */
.action-change-chapter {
    max-width: 200px;
}

.chapter-actions {
    margin-top: 15px;
}

/* Pagination Selector */
.choose-paginate {
    position: relative;
}

.choose-paginate .choose-paginate__page-chapter {
    position: absolute;
    bottom: 110%;
    left: 0;
    display: flex;
    gap: 5px;
    background: #fff;
    padding: 8px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.input-paginate {
    width: 80px;
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
}

.btn-go-paginate,
.btn-choose-page {
    background-color: #198754;
    color: #fff;
    cursor: pointer;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    transition: opacity 0.2s ease;
}

.btn-go-paginate:hover,
.btn-choose-page:hover {
    opacity: 0.85;
}

/* Utility Classes */
.d-block { display: block !important; }
.d-none { display: none !important; }
.mb-1 { margin-bottom: 10px; }
.mb-3 { margin-bottom: 16px; }
.mt-3 { margin-top: 16px; }

/* Story Detail */
.story-action-read {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.story-item__chapter-new {
    display: block;
    text-align: center;
    margin-top: 5px;
    font-size: 12px;
    color: #ccc;
}

/* Ads */
#ads-chapter-pc-top {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .chapter-actions div {
        max-width: 150px;
    }
    
    .chapter-actions .btn {
        font-size: 13px;
        padding: 6px 10px;
    }
    
    .story-head {
        flex-direction: column;
        align-items: stretch;
    }
    
    .story-head .categories {
        margin-bottom: 0;
    }
    
    .search-story {
        width: 100%;
    }
    
    .search-story input {
        flex: 1;
    }
}

@media (max-width: 480px) {
    .list-story {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .story-item {
        max-width: 100%;
    }
    
    .story-item__image img {
        height: 160px;
    }
    
    .paginate-story a,
    .paginate-story__dot {
        padding: 6px 12px;
        font-size: 13px;
    }
}

/* Animation & Performance */
.story-item__image img,
.paginate-story a,
.chapter-item-btn,
.search-story button,
.btn-go-paginate,
.btn-choose-page {
    will-change: transform, background-color;
}

/* Fix cho các thiết bị cũ */
img {
    max-width: 100%;
    height: auto;
}

/* Scroll behavior cho anchor */
html {
    scroll-behavior: smooth;
}