/* General layout & index.html */

/* Body and Container base styles */
body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.container {
    max-width: 1000px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    padding: 2rem;
}

/* Header styles */
header {
    margin-bottom: 1rem;
    padding-top: 0.5rem;
}

header h1 {
    margin: 0;
}

header .btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.page-title {
    word-break: break-all;
}

/* Icon item styles */
.icon-item {
    text-align: center;
    margin-bottom: 1rem;
}

.icon-item i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.icon-item .btn {
    width: 100%;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    border-color: #2f3336;
    color: #2f3336;
}

.icon-item .btn:hover {
    background-color: #6c757d;
    color: white;
}

.footer {
    margin-top: 2rem;
    text-align: center;
    padding: 1rem;
    background-color: rgba(248, 249, 250, 0.9);
    border-radius: 8px;
}

/* Bangumi.html styles */

.poster-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    justify-content: left;
}

.watched-info {
    position: absolute;
    top: 0;
    left: 0;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.25rem 0.5rem;
    border-bottom-right-radius: 4px;
    font-size: 0.875rem;
}

.poster-item {
    position: relative;
    flex: 0 1 calc(16.66% - 1rem);
    max-width: calc(16.66% - 1rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.poster-item:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.poster-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    background: #f0f0f0;
}

.poster-item h3 {
    font-size: 1rem;
    margin: 0.25rem;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-break: normal;
}

.poster-item p {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 0.5rem;
    word-break: break-all;
}

@media (max-width: 768px) {
    .poster-item {
        flex: 1 1 calc(33.33% - 1rem);
        max-width: calc(33.33% - 1rem);
    }
}

@media (max-width: 480px) {
    .poster-item {
        flex: 1 1 calc(50% - 1rem);
        max-width: calc(50% - 1rem);
    }

    .poster-item img {
        width: 100%;
        height: 75px;
        object-fit: cover;
        background: #f0f0f0;
    }
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    align-items: center;
    justify-content: center;
}

.modal[style*="display: block"] {
    display: flex !important;
}

.modal-content {
    background-color: #fefefe;
    padding: 0;
    border: 1px solid #888;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid #ddd;
    padding: 1rem 1.5rem;
    flex-shrink: 0;
}

.modal-header h3 {
    margin: 0 0 0.25rem 0;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.loading {
    text-align: center;
    font-size: 1.5rem;
    padding: 2rem 0;
}

/* Episode list styles */
.episode-list {
    list-style: none;
    padding: 1rem 1.5rem;
    margin: 0;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.episode-item {
    border-bottom: 1px solid #eee;
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    transition: background-color 0.2s;
}

.episode-item:hover {
    background-color: #f8f9fa;
}

.episode-item.last-watched-episode {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    padding-left: 0.75rem;
}

.episode-title {
    font-weight: bold;
    display: flex;
    align-items: center;
}

.episode-title i {
    margin-right: 0.5rem;
}

.episode-details {
    font-size: 0.875rem;
    color: #666;
    margin-top: 0.25rem;
    display: flex;
    flex-wrap: wrap;
}

.episode-details div {
    margin-right: 1rem;
}

.local-files {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.file-item-link {
    color: #007bff;
    text-decoration: none;
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    transition: all 0.2s;
    background: white;
}

.file-item-link:hover {
    background-color: #f8f9fa;
    border-color: #007bff;
    text-decoration: none;
}

.file-thumbnail {
    width: 120px;
    height: 68px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 0.75rem;
    flex-shrink: 0;
    background: #f0f0f0;
}

.file-item-info {
    flex: 1;
    display: flex;
    align-items: center;
    word-break: break-word;
}

.file-item-info i {
    margin-right: 0.5rem;
    color: #6c757d;
}

.local-files a {
    color: #007bff;
    text-decoration: none;
    display: flex;
    align-items: center;
    margin-top: 0.25rem;
    transition: color 0.2s;
}

.local-files a:hover {
    color: #0056b3;
}

.local-files a i {
    margin-right: 0.5rem;
}

@media (max-width: 576px) {
    .episode-details {
        flex-direction: column;
    }

    .episode-details div {
        margin-right: 0;
        margin-top: 0.25rem;
    }
}

.search-bar {
    width: 100%;
    max-width: 300px;
}

@media (max-width: 576px) {
    .d-flex.justify-content-between.align-items-center {
        flex-direction: column;
        align-items: flex-start;
    }

    .search-bar {
        width: 100%;
        margin-top: 0.5rem;
    }
}

.status-icon {
    margin-right: 0.5rem;
    font-size: 1.25rem;
}

.status-icon.watched {
    color: green;
}

.status-icon.not-watched {
    color: gray;
}

.status-icon.not-aired {
    color: orange;
}

.group-name {
    font-size: 1.2rem;
    margin: 0.5rem 0;
    width: 100%;
}

/* Quick navigation styles */
.quick-nav {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 80vh;
    overflow-y: auto;
}

.quick-nav a {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    color: #333;
    text-decoration: none;
    font-size: 0.875rem;
}

.quick-nav a:hover {
    text-decoration: underline;
}

.quick-nav i {
    margin-right: 0.5rem;
}

/* Quick nav toggle button styles */
.quick-nav-toggle {
    position: fixed;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 0.5rem;
    border-radius: 50%;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    z-index: 1001;
    display: flex;
    justify-content: center;
    align-items: center;
}

.quick-nav.collapsed {
    display: none;
}

.quick-nav.collapsed ~ .quick-nav-toggle {
    display: flex;
}

/* Filelist.html styles */

.file-item {
    position: relative;
    flex: 1 1 calc(25% - 1rem);
    max-width: calc(25% - 1rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    padding: 0.5rem;
}

.file-item:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.file-item .thumbnail {
    position: relative;
    width: 100%;
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.file-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    background: #f0f0f0;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.file-item .file-description {
    position: absolute;
    left: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-bottom-left-radius: 8px;
}

.file-item .file-extension {
    position: absolute;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-bottom-right-radius: 8px;
}

.file-item h3 {
    font-size: 0.875rem;
    margin: 0.5rem;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-break: break-all;
}

.file-item p {
    font-size: 0.75rem;
    color: #666;
    margin: 0.25rem 0 0;
}

@media (max-width: 768px) {
    .file-item {
        flex: 1 1 calc(33.33% - 1rem);
        max-width: calc(33.33% - 1rem);
    }
}

@media (max-width: 480px) {
    .file-item {
        flex: 1 1 calc(50% - 1rem);
        max-width: calc(50% - 1rem);
    }
}
