/* ========================================
   Truyện Hoàn Thành - Responsive Design
   Mobile-First với Micro-Interactions
   ======================================== */

.hy-completed-stories {
    padding: 1rem 0;
    background: var(--hdk-background, #ffffff);
    min-height: auto;
    position: relative;
}

/* Dark mode support */
.dark .hy-completed-stories {
    background: var(--hdk-background, #000000);
}

/* ========================================
   Filter Bar - Modern Design
   ======================================== */
.hdk-filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1rem;
    padding: 0 0.5rem;
    gap: 0.75rem;
    flex-wrap: nowrap;
}

.hdk-filter-group {
    display: flex;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}

.hdk-filter-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    min-width: 120px;
    max-width: 180px;
}

.hdk-filter-label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--hdk-text-secondary, #536471);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.hdk-filter-label iconify-icon {
    font-size: 0.875rem;
    color: var(--hdk-primary, #54cfd6);
}

.hdk-filter-select {
    background: var(--hdk-background, #ffffff);
    border: 1px solid var(--hdk-border, #e1eaef);
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    color: var(--hdk-text-primary, #0f1419);
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%23536471' d='m12 15l-5-5h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.625rem center;
    padding-right: 2rem;
}

.dark .hdk-filter-select {
    background-color: var(--hdk-card, #17181c);
    border-color: var(--hdk-border, #242628);
    color: var(--hdk-text-primary, #e7e9ea);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%23e7e9ea' d='m12 15l-5-5h10l-5 5z'/%3E%3C/svg%3E");
}

.hdk-filter-select:focus {
    outline: none;
    border-color: var(--hdk-primary, #54cfd6);
    box-shadow: 0 0 0 3px rgba(84, 207, 214, 0.1);
}

.hdk-filter-select:hover {
    border-color: var(--hdk-primary, #54cfd6);
}

/* View Toggle Buttons */
.hdk-view-toggles {
    display: flex;
    gap: 0.25rem;
    background: var(--hdk-card, #f7f8f8);
    padding: 0.25rem;
    border-radius: 0.5rem;
    border: 1px solid var(--hdk-border, #e1eaef);
}

.dark .hdk-view-toggles {
    background: var(--hdk-card, #17181c);
    border-color: var(--hdk-border, #242628);
}

.hdk-view-btn {
    background: transparent;
    border: none;
    border-radius: 0.375rem;
    padding: 0.5rem;
    color: var(--hdk-text-secondary, #536471);
    cursor: pointer;
    transition: all 0.2s ease;
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hdk-view-btn iconify-icon {
    font-size: 1.125rem;
}

.hdk-view-btn:hover {
    color: var(--hdk-primary, #54cfd6);
    background: var(--hdk-primary-light, rgba(84, 207, 214, 0.1));
}

.hdk-view-btn.active {
    background: var(--hdk-primary, #54cfd6);
    color: white;
}

.dark .hdk-view-btn {
    color: var(--hdk-text-secondary, #71767b);
}

.dark .hdk-view-btn.active {
    background: var(--hdk-primary, #1c9cf0);
}

/* ========================================
   Loading Overlay
   ======================================== */
.hy-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 0.5rem;
}

.dark .hy-loading-overlay {
    background: rgba(0, 0, 0, 0.8);
}

.hy-loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--hdk-primary, #54cfd6);
}

.hy-loading-spinner i {
    font-size: 2rem;
}

.hy-loading-spinner span {
    font-size: 0.875rem;
    color: var(--hdk-text-secondary, #536471);
}

/* ========================================
   Stories Container
   ======================================== */
.hy-stories-container {
    position: relative;
    transition: opacity 0.3s ease;
}

.hy-story-col {
    transition: all 0.3s ease;
}

/* Empty State */
.hy-empty-state {
    padding: 3rem 1rem;
}

.hy-empty-state h4 {
    color: var(--hdk-text-primary, #0f1419);
    font-weight: 600;
}

.dark .hy-empty-state h4 {
    color: var(--hdk-text-primary, #e7e9ea);
}

/* ========================================
   List View Mode - Story Card List
   ======================================== */
.hy-stories-container.list-view .hy-story-col {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

/* Story Card List Component */
.hdk-story-card-list {
    margin-bottom: 0.5rem;
}

.hdk-story-card-list-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--hdk-background, #ffffff);
    border: 1px solid var(--hdk-border, #e1eaef);
    border-radius: 0.75rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.hdk-story-card-list-link:hover {
    border-color: var(--hdk-primary, #54cfd6);
    box-shadow: 0 2px 8px rgba(84, 207, 214, 0.1);
    transform: translateY(-1px);
}

.dark .hdk-story-card-list-link {
    background: var(--hdk-card, #17181c);
    border-color: var(--hdk-border, #242628);
}

.dark .hdk-story-card-list-link:hover {
    border-color: var(--hdk-primary, #1c9cf0);
}

/* Cover Image */
.hdk-story-card-list-cover {
    flex-shrink: 0;
    width: 70px;
    height: 95px;
    border-radius: 0.5rem;
    overflow: hidden;
    position: relative;
}

.hdk-story-card-list-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hdk-story-card-list-badge {
    position: absolute;
    top: 0.25rem;
    left: 0.25rem;
    background: var(--hdk-success, #10b981);
    color: white;
    font-size: 0.5rem;
    font-weight: 700;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Content */
.hdk-story-card-list-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.hdk-story-card-list-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.hdk-story-card-list-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--hdk-text-primary, #0f1419);
    margin: 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dark .hdk-story-card-list-title {
    color: var(--hdk-text-primary, #e7e9ea);
}

.hdk-story-card-list-genre {
    flex-shrink: 0;
    background: var(--hdk-primary-light, rgba(84, 207, 214, 0.1));
    color: var(--hdk-primary, #54cfd6);
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.1875rem 0.5rem;
    border-radius: 0.375rem;
    white-space: nowrap;
}

.hdk-story-card-list-author {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: var(--hdk-text-secondary, #536471);
    margin: 0;
}

.hdk-story-card-list-author iconify-icon {
    font-size: 0.75rem;
    color: var(--hdk-primary, #54cfd6);
}

.hdk-story-card-list-desc {
    font-size: 0.75rem;
    color: var(--hdk-text-muted, #8899a6);
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hdk-story-card-list-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.25rem;
}

.hdk-story-card-list-stat {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.6875rem;
    color: var(--hdk-text-muted, #8899a6);
}

.hdk-story-card-list-stat iconify-icon {
    font-size: 0.75rem;
}

/* Actions & Favorite Button */
.hdk-story-card-list-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.hdk-story-card-list-favorite {
    background: transparent;
    border: none;
    padding: 0.5rem;
    color: var(--hdk-text-muted, #8899a6);
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 50%;
    -webkit-border-radius: 50%;
    -moz-border-radius: 50%;
    -ms-border-radius: 50%;
    -o-border-radius: 50%;
    aspect-ratio: 1/1;
    width: 36px;
    min-width: 36px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.hdk-story-card-list-favorite iconify-icon {
    font-size: 1.25rem;
}

.hdk-story-card-list-favorite:hover {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
    transform: scale(1.1);
}

.hdk-story-card-list-favorite.active {
    color: #ff6b6b;
}

.hdk-story-card-list-favorite.active iconify-icon {
    animation: heartPulse 0.3s ease;
}

@keyframes heartPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* ========================================
   Pagination
   ======================================== */
.hy-pagination-wrapper {
    padding: 1rem 0.5rem;
    margin-top: 0.5rem;
}

.hy-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.375rem;
    flex-wrap: wrap;
}

.hy-page-btn {
    background: var(--hdk-card, #f7f8f8);
    border: 1px solid var(--hdk-border, #e1eaef);
    border-radius: 0.5rem;
    padding: 0.5rem 0.625rem;
    color: var(--hdk-text-primary, #0f1419);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    min-width: 2.25rem;
    height: 2.25rem;
    justify-content: center;
}

.dark .hy-page-btn {
    background: var(--hdk-card, #17181c);
    border-color: var(--hdk-border, #242628);
    color: var(--hdk-text-primary, #e7e9ea);
}

.hy-page-btn:hover:not(:disabled) {
    background: var(--hdk-primary, #54cfd6);
    color: white;
    border-color: var(--hdk-primary, #54cfd6);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(84, 207, 214, 0.25);
}

.hy-page-btn.active {
    background: var(--hdk-primary, #54cfd6);
    color: white;
    border-color: var(--hdk-primary, #54cfd6);
}

.hy-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.hy-page-numbers {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.hy-page-dots {
    padding: 0 0.375rem;
    color: var(--hdk-text-secondary, #536471);
    font-size: 0.875rem;
}

.hy-pagination-info {
    font-size: 0.8125rem;
    color: var(--hdk-text-secondary, #536471);
}

.hy-pagination-info strong {
    color: var(--hdk-text-primary, #0f1419);
}

.dark .hy-pagination-info strong {
    color: var(--hdk-text-primary, #e7e9ea);
}


/* ========================================
   Responsive Breakpoints
   ======================================== */

/* Mobile Small (< 375px) */
@media (max-width: 575.98px) {
    .hdk-filter-bar {
        padding: 0;
    }
    .hdk-filter-group {
        width: 100%;
        flex-wrap: nowrap;
        gap: 7px;
    }
    
    .hdk-filter-item {
        min-width: 90px;
    }

    
    .hdk-filter-select {
        font-size: 0.75rem;
        padding: 0.4375rem 0.625rem;
    }
    
    .hdk-view-toggles {
        align-self: flex-end;
    }
    
    .hy-page-btn {
        min-width: 2rem;
        height: 2rem;
        font-size: 0.75rem;
        padding: 0.375rem 0.5rem;
    }
    
    /* List card mobile small */
    .hdk-story-card-list-cover {
        width: 60px;
        height: 80px;
    }
    
    .hdk-story-card-list-title {
        font-size: 0.8125rem;
    }
    
    .hdk-story-card-list-desc {
        display: none;
    }
}

/* Mobile (375px - 575px) */
@media (min-width: 375px) and (max-width: 575px) {
    .hdk-filter-select {
        font-size: 0.8125rem;
    }
    
    .hdk-story-card-list-cover {
        width: 65px;
        height: 88px;
    }
}

/* Tablet Portrait (576px - 767px) */
@media (min-width: 576px) and (max-width: 767px) {
    .hy-completed-stories {
        padding: 1.25rem 0;
    }
    
    .hdk-filter-bar {
        padding: 0 0.75rem;
    }
    
    .hdk-filter-item {
        max-width: 120px;
    }
    
    .hdk-story-card-list-cover {
        width: 80px;
        height: 108px;
    }
    
    .hdk-story-card-list-title {
        font-size: 1rem;
    }
}

/* Tablet & Desktop (768px+) */
@media (min-width: 768px) {
    .hy-completed-stories {
        padding: 1.5rem 0;
    }

    .hdk-filter-bar {
        padding: 0 1rem;
        margin-bottom: 1.25rem;
    }

    .hdk-filter-group {
        gap: 1rem;
        flex-wrap: nowrap;
    }

    .hdk-filter-item {
        min-width: 140px;
        max-width: 200px;
    }

    .hdk-filter-select {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
    
    .hdk-view-btn {
        width: 2.5rem;
        height: 2.5rem;
    }

    .hy-pagination-wrapper {
        padding: 1.25rem 1rem;
    }
    
    .hy-page-btn {
        min-width: 2.5rem;
        height: 2.5rem;
        font-size: 0.875rem;
    }
    
    /* List view adjustments */
    .hdk-story-card-list-cover {
        width: 90px;
        height: 120px;
    }
    
    .hdk-story-card-list-title {
        font-size: 1.0625rem;
    }
    
    .hdk-story-card-list-link {
        padding: 1rem;
        gap: 1rem;
    }
}

/* Desktop (992px+) */
@media (min-width: 992px) {
    .hdk-filter-item {
        max-width: 220px;
    }
    
    .hdk-story-card-list-cover {
        width: 100px;
        height: 135px;
    }
    
    .hdk-story-card-list-title {
        font-size: 1.125rem;
    }
    
    .hdk-story-card-list-desc {
        -webkit-line-clamp: 2;
    }
}

/* Large Desktop (1200px+) */
@media (min-width: 1200px) {
    .hy-completed-stories {
        padding: 2rem 0;
    }
    
    .hdk-filter-bar {
        margin-bottom: 1.5rem;
    }
    
    .hdk-story-card-list-cover {
        width: 110px;
        height: 148px;
    }
}

/* ========================================
   Animations
   ======================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hy-story-col.loaded {
    animation: fadeInUp 0.4s ease-out;
}

/* Loading skeleton */
.hy-story-col.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* ========================================
   Mobile Pagination - Compact Style
   ======================================== */
@media (max-width: 767px) {
    .hy-pagination-wrapper {
        padding: 0.75rem 0.5rem;
    }
    
    .hy-pagination {
        gap: 0.25rem;
    }
    
    .hy-page-btn {
        min-width: 2rem;
        height: 2rem;
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
    
    .hy-page-btn.hy-page-prev,
    .hy-page-btn.hy-page-next {
        padding: 0.25rem 0.5rem;
    }
    
    .hy-page-numbers {
        gap: 0.125rem;
    }
    
    .hy-page-dots {
        padding: 0 0.25rem;
        font-size: 0.75rem;
    }
    
    .hy-pagination-info {
        font-size: 0.75rem;
        margin-top: 0.5rem;
    }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    .hy-filter-controls,
    .hy-pagination-wrapper,
    .hy-load-more-mobile,
    .hy-view-toggle {
        display: none !important;
    }
}
