/* Main Container */
.novelstat-main-wrapper {
    width: calc(100% - 4.4em);
    min-height: 100vh;
    display: flex;
    flex-direction: row;
    justify-content: center;
    margin-left: auto;
    gap: 2rem;
    color: var(--novelstat-text-color);
    position: relative;
}

.novelstat-statistics-container {
    display: flex;
    background-color: var(--novelstat-container-bg);
    flex-direction: column;
    padding: 1rem 2rem;
    border-radius: 33px;
    gap: 20px;
    min-width: 1000px;
    max-width: 1100px;
}

/* Page Title and Selector */
.novelstat-page-title {
    text-wrap: nowrap;
    font-size: 1.8rem;
    color: var(--primary-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 0;   
    border-bottom: 1px solid var(--novelstat-border-color);
}

.novelstat-selector {
    background-color: var(--novelstat-selector-bg);
    color: var(--novelstat-selector-text);
    border: 2px solid var(--primary-color);
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 1rem;
    max-width: 300px;
    cursor: pointer;
}

.novelstat-selector:focus {
    outline: none;
    border-color: var(--primary-hover-color);
}

/* Empty States */
.novelstat-empty-chapter {
    background-color: var(--novelstat-selector-bg);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    color: var(--novelstat-selector-text);
}

.novelstat-empty-chapter-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.novelstat-empty-icon {
    font-size: 4rem;
    color: var(--primary-color);
}

.novelstat-empty-title {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.novelstat-empty-description {
    color: var(--novelstat-muted-text);
}

.novelstat-empty-action {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
}

.novelstat-empty-action:hover {
    text-decoration: underline;
}

.novelstat-empty-state {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    background-color: var(--novelstat-empty-state-bg);
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.novelstat-empty-state i {
    font-size: 3rem;
    color: var(--primary-hover-color);
    margin-bottom: 1rem;
    opacity: 0.8;
}

.novelstat-empty-state p {
    color: var(--novelstat-empty-state-text);
    font-size: 1rem;
    font-weight: 500;
    margin: 0;
    line-height: 1.6;
}

/* Novel Info Section */
.novelstat-info-section {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.novelstat-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 0.5rem;
}

.novelstat-image-cotainer {
    position: relative;
    width: 180px;
    height: 240px;
    border-radius: 10px;
    overflow: hidden;
    background-color: var(--novelstat-image-placeholder-bg);
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.5);
}

.novelstat-image-cotainer a {
    width: 100%;
    height: 100%;
}

.novelstat-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: 9/16;
}

.draft-badge-v2 {
    position: absolute;
    background-color: var(--primary-color);
    border: 2px solid var(--primary-color);
    color: #fff;
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 0 10px 0 5px;
    text-transform: uppercase;
    font-weight: bold;
    vertical-align: middle;
    display: inline-block;
    top: 0;
    right: 0;
}

.novelstat-edit-story {
    display: flex;
    gap: 0.5rem;
    flex-direction: column;
}

.novelstat-edit-novel-btn, .novelstat-delete-novel-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 10px 15px;
    color: #FFFFFF;
    text-decoration: none;
    border-radius: 10px;
    transition: background-color 0.3s ease;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.novelstat-edit-novel-btn {
    background-color: var(--primary-color);
}

.novelstat-delete-novel-btn {
    background-color: var(--error-color);
}

.novelstat-edit-novel-btn i, .novelstat-delete-novel-btn i {
    margin-right: 0.5em;
}

.novelstat-edit-novel-btn:hover {
    background-color: var(--primary-hover-color);
}

.novelstat-delete-novel-btn:hover {
    background-color: var(--novelstat-delete-btn-hover);
}

/* Novel Details */
.novelstat-details {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.novelstat-novel-title {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 10px;
    text-decoration: none;
    text-align: left;
    border-bottom: none;
}

.novelstat-meta-info {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    max-width: 100%;
    color: var(--novelstat-muted-text);
    margin-bottom: 15px;
}

.novelstat-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.novelstat-description {
    margin-bottom: 15px;
    line-height: 1.6;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.novelstat-gen-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.novelstat-gen {
    display: inline-block;
    background-color: var(--novelstat-genre-bg);
    color: var(--primary-color);
    padding: 5px 10px;
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.8rem;
    border: 1px solid var(--novelstat-border-color);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.novelstat-gen:hover {
    background-color: var(--primary-color);
    color: var(--novelstat-genre-hover-text);
}

.novelstat-last-updated {
    color: var(--novelstat-muted-text);
    font-size: 0.9rem;
    display: flex;
    flex-wrap: wrap;
    text-wrap: nowrap;
    gap: 0.3rem;
}

.recent-badge {
    background-color: var(--primary-color);
    color: var(--text-dark-light-color);
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
}

/* Tabbed Window System */
.novelstat-window-tabs {
    display: flex;
    border-bottom: 2px solid var(--novelstat-border-color);
    margin-bottom: 20px;
}

.novelstat-tab-btn {
    flex: 1;
    padding: 15px;
    background-color: var(--novelstat-selector-bg);
    color: var(--novelstat-muted-text);
    border: none;
    cursor: pointer;
    border-radius: 0;
    transition: all 0.3s ease;
    font-weight: bold;
    text-transform: uppercase;
}

.novelstat-tab-btn.active {
    background-color: var(--novelstat-genre-bg);
    color: var(--primary-color);
}

.novelstat-window-content {
    position: relative;
}

.novelstat-window-panel {
    display: none;
}

.novelstat-window-panel.active {
    display: block;
}

/* Stats Grid */
.novelstat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.novelstat-card {
    background-color: var(--novelstat-selector-bg);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    border-left: 4px solid var(--primary-color);
}

.novelstat-value {
    font-size: 2rem; 
    font-weight: bold; 
    margin: 10px 0; 
    color: var(--primary-color);
}

.novelstat-label {
    color: var(--novelstat-muted-text);
    font-size: 0.9rem;
    text-transform: uppercase;
}

/* Chapters Section */
.novelstat-chapters-wrapper {
    background-color: var(--novelstat-selector-bg);
    border-radius: 8px;
    overflow: hidden;
}

.novelstat-section-title {
    background-color: var(--novelstat-genre-bg);
    padding: 15px 20px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: bold;
    border-bottom: 1px solid var(--novelstat-border-color);
}

.novelstat-chapter-list {
    padding: 0;
    margin: 0;
    list-style: none;
}

.novelstat-chapter-item {
    padding: 15px 20px;
    border-bottom: 1px solid var(--novelstat-chapter-border);
    display: flex;
    flex-direction: column;
    width: 100%;
    justify-content: center;
    align-items: flex-start;
    transition: background-color 0.2s ease-in-out;
}

.novelstat-chapter-item:hover {
    background-color: var(--novelstat-genre-bg);
}

.novelstat-chapter-item:last-child {
    border-bottom: none;
}

.novelstat-chapter-info {
    flex: 1;
    cursor: default;
    display: flex;
    width: 100%;
    margin-bottom: 5px;
    justify-content: space-between;
    align-items: center;
}

.novelstat-chapter-title{
    color: var(--novelstat-selector-text);
    margin-right: 0.5rem;
}

.novelstat-chapter-info a {
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    width: fit-content;
    display: flex;
}

.novelstat-chapter-meta {
    font-size: 14px;
    color: var(--novelstat-chapter-meta-text);
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.novelstat-chapter-actions {
    display: flex;
    gap: 10px;
    margin-left: 0.5rem;
}

/* Action Buttons */
.novelstat-btn-primary, .novelstat-btn-secondary {
    padding: 6px 12px;
    border-radius: 8px;
    border: none;
    color: var(--text-dark-light-color);
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-flex;
    font-weight: inherit;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.novelstat-btn-primary i, .novelstat-btn-secondary i {
    font-size: 1.2rem;
    z-index: 1;
}

.novelstat-btn-primary {
    background-color: var(--error-color);
}

.novelstat-btn-primary:hover {
    background-color: var(--novelstat-delete-btn-hover);
}

.novelstat-btn-secondary {
    background-color: var(--primary-color);
}

.novelstat-btn-secondary:hover {
    background-color: var(--primary-hover-color);
}

/* Delete Modal */
.delete-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

.delete-modal-btn {
    padding: 10px 25px;
    border-radius: 8px;
    border: none;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.delete-modal-btn.cancel {
    background-color: var(--novelstat-modal-cancel-bg);
    color: var(--novelstat-text-color);
}

.delete-modal-btn.cancel:hover {
    background-color: var(--novelstat-modal-cancel-hover);
}

.delete-modal-btn.delete {
    background-color: var(--error-color);
    color: #ffffff;
    text-decoration: none;
}

.delete-modal-btn.delete:hover {
    background-color: var(--novelstat-modal-delete-hover);
}

/* Utility Classes */
#chapterTitleSpan, #novelTitleSpan {
    font-style: italic;
    color: var(--novelstat-title-span-color);
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .novelstat-statistics-container {
        min-width: auto;
    }
    
    .novelstat-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 1024px) {
    .novelstat-main-wrapper {
        width: 100%;
        margin: 0;
        padding: 0;
    }
    
    .novelstat-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .novelstat-statistics-container {
        padding: 1rem;
        border-radius: 20px;
    }
    
    .novelstat-info-section {
        flex-direction: row;
        margin-bottom: 0;
    }
    
    .novelstat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .novelstat-page-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;  
    }

    .novelstat-section-title {
        padding: 0.6rem 0.5rem;
    }
    
    .novelstat-chapter-item {
        padding: 0.6rem 0.5rem;
    }

    .novelstat-novel-title {
        font-size: 1.3rem;
        text-align: center;
        border-bottom: 2px solid var(--hover-bg-color);
        padding-bottom: 10px;
    }

    .novelstat-chapter-meta-item span {
        display: none;
    }
    
    .novelstat-selector {
        width: 100%;
        max-width: none;
    }
    
    .novelstat-meta-item {
        max-width: 100%;
    }
    
    .novelstat-chapter-meta {
        gap: 10px;
    }
}

@media (max-width: 576px) {
    .novelstat-info-section {
        flex-direction: column;
    }
    
    .novelstat-image-placeholder {
        margin: 0 auto;
        gap: 0;
    }
    
    .novelstat-chapter-item {
        gap: 0.3rem;
    }
    
    .novelstat-edit-story {
        position: absolute;
        top: 0;
        right: 0;
    }
    
    .novelstat-edit-novel-btn i, .novelstat-delete-novel-btn i {
        margin-right: 0;
    }
    
    .novelstat-mobile-hide {
        display: none;
    }
}

@media (max-width: 480px) {
    .novelstat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .novelstat-chapter-item {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 360px) {
    .novelstat-grid {
        grid-template-columns: 1fr;
    }
    
    .novelstat-statistics-container {
        padding: 0.75rem;
    }

    .novelstat-novel-title {
        font-size: 1.1rem;
    }
}