body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f5f5f5;
    color: #222;
}
.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 20px;
}
.topbar {
    background: #1f2937;
    color: #fff;
    padding: 12px 0;
}
.topbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.topbar a, .topbar button {
    color: #fff;
    text-decoration: none;
    margin-right: 16px;
    font-weight: 600;
}
.topbar nav a {
    margin-right: 14px;
}
.hidden {
    display: none;
}
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 240px));
    gap: 16px;
    margin-top: 16px;
}
.card, .book-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    padding: 16px;
}
.book-card-clickable {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.book-card-clickable:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.15);
}
.card img, .book-card img {
    width: 100%;
    border-radius: 8px;
}
.card h3, .book-card h2 {
    margin: 12px 0 8px;
}
.card p, .book-card p {
    margin: 0 0 8px;
    color: #555;
}
.password-change-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.password-change-row input,
.password-change-row button {
    height: 42px;
    line-height: 42px;
}
.password-change-row input {
    flex: 1 1 280px;
    min-width: 220px;
    padding: 10px 14px;
    box-sizing: border-box;
    margin-bottom: 0;
}
.password-change-row button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 64px;
    padding: 0 14px;
    line-height: normal;
}
.password-change-row .error-text {
    width: 100%;
    margin-top: 4px;
}
.progress-bar {
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}
.progress-fill {
    height: 100%;
    background: #2563eb;
    transition: width 0.3s ease;
}
.progress-text {
    margin: 4px 0 0;
    font-size: 12px;
    color: #2563eb;
    font-weight: 600;
}
button, input[type=submit] {
    background: #2563eb;
    color: #fff;
    border: none;
    padding: 12px 18px;
    border-radius: 8px;
    cursor: pointer;
}
button:hover:not(:disabled), input[type=submit]:hover:not(:disabled) {
    background: #1d4ed8;
}
button:disabled, input[type=submit]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
input, textarea, select {
    width: 100%;
    padding: 10px;
    margin-bottom: 14px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    box-sizing: border-box;
}
.field-group {
    margin-bottom: 16px;
}

.field-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.field-error input,
.field-error textarea,
.field-error select {
    border-color: #dc2626;
    box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.35);
}

.error-text {
    color: #dc2626;
    font-size: 13px;
    margin-top: 4px;
}

.auth-form, .upload-form {
    background: #fff;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    max-width: 560px;
    margin: 24px auto;
}
.search-row {
    margin-bottom: 20px;
}
#chapterList {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
}

.chapter-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
}

.chapter-item:last-child {
    border-bottom: none;
}

.chapter-item:hover {
    background: #f0f9ff;
}

.chapter-item.active {
    background: #0ea5e9;
    color: #fff;
    font-weight: 600;
}

.chapter-item.active:hover {
    background: #0284c7;
}

.chapter-number {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    width: 40px;
    height: 40px;
    background: #e0e7ff;
    border-radius: 50%;
    font-weight: 600;
    color: #2563eb;
    font-size: 14px;
}

.chapter-item.active .chapter-number {
    background: rgba(255, 255, 255, 0.3);
    color: #fff;
}

.chapter-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chapter-title {
    font-weight: 500;
    font-size: 15px;
    line-height: 1.3;
}

.chapter-duration {
    font-size: 12px;
    opacity: 0.7;
}
.book-player {
    margin-top: 20px;
}
.book-detail {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 24px;
}
@media (max-width: 900px) {
    .book-detail {
        grid-template-columns: 1fr;
    }
}

.user-panel {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 16px;
}

.user-name {
    color: #fff;
    font-weight: 600;
}

.logout-button {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
}

.logout-button:hover {
    opacity: 0.7;
}

.users-grid {
    display: grid;
    grid-template-columns: minmax(280px, 360px) 1fr;
    gap: 24px;
    margin-top: 24px;
}

.users-table-section {
    background: #fff;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table th,
.users-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
}

.users-table th {
    background: #f8fafc;
    font-weight: 700;
}

.users-table tr:hover {
    background: #f8fafc;
}

.delete-user-button {
    background: #ef4444;
    color: #fff;
    border-radius: 8px;
    padding: 8px 12px;
}

    .detail-actions {
        display: flex;
        gap: 12px;
        flex-wrap: wrap;
        margin-top: 18px;
    }

    .detail-actions button {
        min-width: 160px;
    }

    .delete-book-button {
        background: #ef4444;
        color: #fff;
        border-radius: 8px;
        padding: 10px 16px;
    }

    .delete-book-button:hover {
        background: #dc2626;
    }
@media (max-width: 900px) {
    .users-grid {
        grid-template-columns: 1fr;
    }
}
