.sidebar-active {
    background-color: #dbeafe;
    border-right: 3px solid #3b82f6;
    color: #1d4ed8;
}

.sidebar-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    padding-left: 0.5rem;
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 0.75rem;
    margin-bottom: 0.25rem;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.sidebar-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.sidebar-item.active {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.sidebar-item .badge {
    background-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    margin-left: auto;
}

.sidebar-item.active .badge {
    background-color: rgba(255, 255, 255, 0.4);
    color: white;
}

.sidebar-item .new-badge {
    background-color: #ef4444;
    color: white;
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    margin-left: auto;
}

.stat-card {
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.star-rating .star {
    color: #fbbf24;
}

.star-rating .star.empty {
    color: #e5e7eb;
}

.book-cover {
    width: 48px;
    height: 64px;
    object-fit: cover;
    border-radius: 4px;
}

.audio-status.available {
    color: #10b981;
}

.audio-status.not-available {
    color: #6b7280;
}


/* Primary gradient colors */

.bg-gradient-primary {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.dark .bg-gradient-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #10b981 100%);
    border: none;
}

.text-gradient-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #10b981 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}


/* Soft Modern Light Theme */

header {
    background: linear-gradient(90deg, #3b82f6 0%, #10b981 100%);
    border-color: rgba(255, 255, 255, 0.2);
}

header .text-gray-600 {
    color: rgba(255, 255, 255, 0.9) !important;
}

header .text-gray-400 {
    color: rgba(255, 255, 255, 0.7) !important;
}

header .text-gray-900 {
    color: white !important;
}

header button:hover .text-gray-600 {
    color: white !important;
}

header button:hover .text-gray-400 {
    color: white !important;
}

.sidebar {
    background: linear-gradient(180deg, #3b82f6 0%, #10b981 100%);
    border-color: #e5e7eb;
}

.main-content {
    background-color: #f1f5f9 !important;
}


/* Soft Modern Dark Theme */

.dark {
    background-color: #0f172a;
    color: #e2e8f0;
}

.dark header {
    background-color: #0f172a !important;
    border-color: #334155 !important;
}

.dark header .text-gray-600 {
    color: #cbd5e1 !important;
}

.dark header .text-gray-400 {
    color: #94a3b8 !important;
}

.dark header button:hover .text-gray-600 {
    color: #f1f5f9 !important;
}

.dark .sidebar {
    background-color: #1e293b;
    border-color: #334155;
}

.dark .sidebar-item {
    color: #cbd5e1;
}

.dark .sidebar-item:hover {
    background-color: #334155;
    color: #f1f5f9;
}

.dark .sidebar-item.active {
    background: linear-gradient(135deg, #3b82f6 0%, #10b981 100%);
    color: white;
}

.dark .sidebar-section {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.dark .sidebar.collapsed .sidebar-section {
    background: rgba(255, 255, 255, 0.08);
}

.dark .sidebar-section-title {
    color: #94a3b8;
}

.dark .main-content {
    background-color: #0f172a !important;
}

.dark .stat-card {
    background-color: #1e293b;
    border-color: #334155;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4);
}

.dark h1 {
    color: #f1f5f9 !important;
}

.dark h3 {
    color: #f1f5f9 !important;
}

.dark .text-gray-900 {
    color: #f1f5f9 !important;
}

.dark .text-gray-600 {
    color: #cbd5e1 !important;
}

.dark .text-gray-500 {
    color: #94a3b8 !important;
}

.dark .text-gray-400 {
    color: #64748b !important;
}

.dark .bg-white {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

.dark .bg-gray-50 {
    background-color: #334155 !important;
}

.dark .border-gray-200 {
    border-color: #334155 !important;
}

.dark .divide-gray-200> :not([hidden])~ :not([hidden]) {
    border-color: #334155 !important;
}


/* Sidebar collapse styles */

.sidebar.collapsed {
    width: 3rem !important;
    transition: width 0.3s ease;
}

.sidebar.collapsed .sidebar-section {
    padding: 0.5rem;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.1);
}

.sidebar.collapsed .sidebar-section-title,
.sidebar.collapsed .sidebar-item span:not(.icon),
.sidebar.collapsed .badge,
.sidebar.collapsed .new-badge,
.sidebar.collapsed #collapse-text {
    display: none;
}

.sidebar.collapsed .sidebar-item {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.75rem 0;
    margin: 0.25rem 0;
    position: relative;
    width: 100%;
    min-height: 2.5rem;
}

.sidebar.collapsed .sidebar-item i {
    margin: 0;
    font-size: 1.125rem;
}

.sidebar.collapsed>div {
    padding: 1rem 0.5rem;
}


/* Tooltip styles */

.tooltip {
    position: fixed;
    left: 2.5rem;
    margin-left: 0.5rem;
    background: linear-gradient(135deg, #3b82f6, #10b981);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 9999;
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.3);
    pointer-events: none;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.tooltip::before {
    content: "";
    position: absolute;
    top: 50%;
    left: -4px;
    transform: translateY(-50%);
    border: 4px solid transparent;
    border-right-color: #3b82f6;
}

.sidebar.collapsed .sidebar-item:hover .tooltip {
    opacity: 1;
    visibility: visible;
}

.dark .tooltip {
    background: linear-gradient(135deg, #1e40af, #059669);
    box-shadow: 0 10px 25px rgba(30, 64, 175, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.dark .tooltip::before {
    border-right-color: #1e40af;
}


/* Dropdown Styles */

.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    min-width: 16rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
    margin-top: 0.5rem;
}

.dropdown.show .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 600;
    color: #111827;
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: #374151;
    text-decoration: none;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f3f4f6;
}

.dropdown-item:hover {
    background-color: #f9fafb;
}

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

.dropdown-item i {
    margin-right: 0.75rem;
    color: #6b7280;
}

.dropdown-divider {
    height: 1px;
    background-color: #e5e7eb;
    margin: 0.5rem 0;
}


/* Dark theme dropdowns */

.dark .dropdown-menu {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.dark .dropdown-header {
    color: #f1f5f9;
    border-color: #334155;
}

.dark .dropdown-item {
    color: #cbd5e1;
}

.dark .dropdown-item:hover {
    background-color: #334155;
}

.dark .dropdown-item i {
    color: #94a3b8;
}

.dark .dropdown-divider {
    background-color: #334155;
}





/* Custom Scrollbar Styles for Sidebar */

.sidebar {
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE and Edge */
}

.sidebar::-webkit-scrollbar {
    width: 4px;
    /* Very thin scrollbar */
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
    /* Invisible track */
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.2);
    /* Very subtle blue */
    border-radius: 2px;
    transition: background 0.3s ease;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.4);
    /* Slightly more visible on hover */
}


/* Dark theme scrollbar */

.dark .sidebar::-webkit-scrollbar-thumb {
    background: rgba(16, 185, 129, 0.2);
    /* Very subtle green for dark mode */
}

.dark .sidebar::-webkit-scrollbar-thumb:hover {
        background: rgba(16, 185, 129, 0.4);
        /* Slightly more visible on hover */
    }

/* Optimized Scrolling Performance */
.create-chapters-list-container,
.edit-chapters-list-container {
    -webkit-overflow-scrolling: touch;
    transform: translateZ(0);
    will-change: scroll-position;
    contain: layout style paint;
}

.create-chapters-list-container::-webkit-scrollbar,
.edit-chapters-list-container::-webkit-scrollbar {
    width: 6px;
}

.create-chapters-list-container::-webkit-scrollbar-track,
.edit-chapters-list-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.create-chapters-list-container::-webkit-scrollbar-thumb,
.edit-chapters-list-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
    transition: background 0.2s ease;
}

.create-chapters-list-container::-webkit-scrollbar-thumb:hover,
.edit-chapters-list-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}


/* Responsive Design */

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: -16rem;
        height: 100vh;
        width: 16rem;
        z-index: 50;
        transition: left 0.3s ease;
    }
    .sidebar.mobile-open {
        left: 0;
    }
    .main-content {
        margin-left: 0 !important;
    }
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 40;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s, visibility 0.3s;
    }
    .sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }
    .tooltip {
        display: none;
    }
}

@media (min-width: 769px) {
    .sidebar {
        position: relative;
    }
    .main-content {
        margin-left: 0;
    }
}


/* Sidebar transition for desktop */

@media (min-width: 769px) {
    .sidebar.collapsed~.main-content {
        margin-left: 0;
    }
}

.user-avatar-initials {
    font-weight: 600;
    letter-spacing: 0.5px;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.user-avatar-container {
    position: relative;
    transition: transform 0.2s ease;
}

.user-avatar-container:hover {
    transform: scale(1.05);
}

.user-status-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border: 2px solid white;
    border-radius: 50%;
}


/* Dropdown Styles */

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 9999;
    min-width: 250px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    margin-top: 8px;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.15s ease;
}

.dropdown-menu.show {
    visibility: visible !important;
    opacity: 1 !important;
    transform: translateY(0) !important;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    background-color: #f9fafb;
    border-radius: 8px 8px 0 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    color: #374151;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.15s ease;
}

.dropdown-item:hover {
    background-color: #f3f4f6;
    color: #111827;
}

.dropdown-item i {
    margin-right: 8px;
    width: 16px;
    text-align: center;
}

.dropdown-divider {
    height: 1px;
    background-color: #e5e7eb;
    margin: 4px 0;
}





/* Sidebar Styles */

.sidebar.collapsed {
    width: 80px;
}

.sidebar.collapsed .sidebar-item span {
    display: none;
}

.sidebar.collapsed .badge {
    display: none;
}

.sidebar.collapsed .sidebar-section-title {
    display: none;
}


/* Dark theme support */

.dark-theme {
    background-color: #1f2937;
    color: #f9fafb;
}

.dark-theme .dropdown-menu {
    background-color: #374151;
    border-color: #4b5563;
}

.dark-theme .dropdown-item {
    color: #e5e7eb;
}

.dark-theme .dropdown-item:hover {
    background-color: #374151;
}


/* ========================================
   VISUAL BOOK EDITOR STYLES
   ======================================== */


/* Visual Book Representation */

.visual-book {
    perspective: 1000px;
    transform-style: preserve-3d;
}

.visual-book-cover {
    transition: all 0.3s ease;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.visual-book-cover:hover {
    transform: rotateY(-5deg) scale(1.02);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}


/* Optimized Chapter List Styles */

.chapter-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 8px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
    will-change: border-color, box-shadow;
    transform: translateZ(0);
}

.chapter-item:hover {
    border-color: #10b981;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.1);
    transform: translateY(-1px);
}

.chapter-item.editing {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.chapter-item.has-audio {
    border-left: 4px solid #10b981;
}

.chapter-item.no-audio {
    border-left: 4px solid #f59e0b;
}

.chapter-number {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.chapter-title {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

.chapter-summary {
    color: #6b7280;
    font-size: 14px;
    line-height: 1.4;
}

.chapter-actions {
    display: flex;
    gap: 8px;
}

.chapter-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.chapter-action-btn:hover {
    transform: scale(1.1);
}

.chapter-edit-btn {
    background: #3b82f6;
    color: white;
}

.chapter-edit-btn:hover {
    background: #2563eb;
}

.chapter-delete-btn {
    background: #ef4444;
    color: white;
}

.chapter-delete-btn:hover {
    background: #dc2626;
}

.chapter-audio-btn {
    background: #10b981;
    color: white;
}

.chapter-audio-btn:hover {
    background: #059669;
}

.chapter-audio-btn.no-audio {
    background: #f59e0b;
}

.chapter-audio-btn.no-audio:hover {
    background: #d97706;
}


/* Drag and Drop Styles */

.chapter-item.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
    z-index: 1000;
}

.chapter-item.drag-over {
    border-color: #10b981;
    background: #f0fdf4;
    transform: scale(1.02);
}

.chapter-drag-handle {
    cursor: grab;
    color: #9ca3af;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.chapter-drag-handle:hover {
    background: #f3f4f6;
    color: #6b7280;
}

.chapter-drag-handle:active {
    cursor: grabbing;
}

.chapters-sortable {
    min-height: 100px;
}

.chapters-sortable.drag-active {
    background: #f9fafb;
    border: 2px dashed #10b981;
    border-radius: 8px;
}


/* Visual Book Cover Upload */

.book-cover-upload {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}

.book-cover-upload:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.book-cover-upload.has-image {
    border: none;
}

.book-cover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.book-cover-upload:hover .book-cover-overlay {
    opacity: 1;
}


/* Progress Stats */

.progress-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.progress-stat-label {
    color: #059669;
    font-weight: 500;
}

.progress-stat-value {
    color: #065f46;
    font-weight: 600;
}


/* Audio Player Styles */

.audio-player {
    background: #f3f4f6;
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
}

.audio-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.audio-play-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #10b981;
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.audio-play-btn:hover {
    background: #059669;
    transform: scale(1.05);
}

.audio-progress {
    flex: 1;
    height: 4px;
    background: #d1d5db;
    border-radius: 2px;
    overflow: hidden;
}

.audio-progress-bar {
    height: 100%;
    background: #10b981;
    width: 0%;
    transition: width 0.1s ease;
}

.audio-time {
    font-size: 12px;
    color: #6b7280;
    min-width: 40px;
    text-align: center;
}


/* Form Enhancements */

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 14px;
}

.form-input:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}


/* Star Rating */

.star-rating {
    display: flex;
    gap: 4px;
}

.star-btn {
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 2px;
}

.star-btn:hover {
    transform: scale(1.1);
}

.star-btn.active {
    color: #fbbf24;
}

.star-btn.inactive {
    color: #d1d5db;
}


/* Loading States */

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #10b981;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}


/* Success States */

.success-indicator {
    color: #10b981;
    background: #f0fdf4;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.error-indicator {
    color: #ef4444;
    background: #fef2f2;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}


/* Responsive Design */

@media (max-width: 768px) {
    .visual-book-editor {
        flex-direction: column;
    }
    .visual-book-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
    }
    .chapter-item {
        padding: 12px;
    }
    .chapter-actions {
        flex-wrap: wrap;
    }
}


/* Dark Theme Support */

.dark-theme .chapter-item {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

.dark-theme .chapter-item:hover {
    border-color: #10b981;
    background: #4b5563;
}

.dark-theme .chapter-title {
    color: #f9fafb;
}

.dark-theme .chapter-summary {
    color: #d1d5db;
}

.dark-theme .form-input {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

.dark-theme .form-input:focus {
    border-color: #10b981;
    background: #4b5563;
}

.dark-theme .form-label {
    color: #f9fafb;
}

.dark-theme .audio-player {
    background: #4b5563;
}

.dark-theme .loading-overlay {
    background: rgba(55, 65, 81, 0.9);
}


/* ========== OPTIMIZED CREATE BOOK VISUAL STYLES ========== */


/* Create Book Visual Container - Optimized */

.create-visual-book-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 240px;
    margin: 16px 0;
    will-change: transform;
}


/* Create Book 3D Effect - Performance Optimized */

.create-book-3d {
    position: relative;
    width: 160px;
    height: 220px;
    transform: translateZ(0);
    transition: transform 0.2s ease-out;
    will-change: transform;
}

.create-book-3d:hover {
    transform: translateZ(0) scale(1.05);
}


/* Create Book Spine - Simplified */

.create-book-spine {
    position: absolute;
    left: -12px;
    top: 0;
    width: 12px;
    height: 280px;
    background: linear-gradient(135deg, #1e3a8a, #3b82f6);
    transform: rotateY(-90deg);
    transform-origin: right center;
    border-radius: 2px 0 0 2px;
}


/* Create Book Cover */

.create-book-cover {
    position: relative;
    width: 200px;
    height: 280px;
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1), inset 0 0 0 2px rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.create-book-cover-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.create-book-cover-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    padding: 20px;
    color: white;
}

.create-book-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.create-book-author {
    font-size: 12px;
    opacity: 0.9;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}


/* Create Book Pages */

.create-book-pages {
    position: absolute;
    right: -3px;
    top: 3px;
    width: 6px;
    height: 274px;
    background: linear-gradient(to right, #f5f5f5, #e0e0e0);
    border-radius: 0 2px 2px 0;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.1);
}

.create-book-pages::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient( to bottom, transparent 0px, transparent 8px, rgba(0, 0, 0, 0.05) 8px, rgba(0, 0, 0, 0.05) 9px);
}


/* Create Chapter Items */

.create-chapter-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px !important;
    margin-bottom: 12px;
    transition: all 0.2s ease;
    cursor: default;
}

.create-chapter-item:hover {
    border-color: #3b82f6;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
    transform: translateY(-1px);
}

.create-chapter-item.dragging {
    opacity: 0.5;
    transform: rotate(2deg) scale(0.98);
    z-index: 999;
}

.create-chapter-item.drag-over {
    border-color: #3b82f6;
    background-color: #eff6ff;
    transform: scale(1.02);
}

.create-chapter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.create-chapter-number {
    background: #3b82f6;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    margin-right: 12px;
    min-width: 24px;
    text-align: center;
}

.create-chapter-title-input {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 500;
    margin-right: 12px;
}

.create-chapter-title-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.create-chapter-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.create-chapter-action-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
}

.create-chapter-drag-handle {
    background: #f3f4f6;
    color: #6b7280;
}

.create-chapter-drag-handle:hover {
    background: #e5e7eb;
    color: #374151;
}

.create-chapter-delete-btn {
    background: #fef2f2;
    color: #ef4444;
}

.create-chapter-delete-btn:hover {
    background: #fee2e2;
    color: #dc2626;
}

.create-chapter-summary {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    resize: vertical;
    min-height: 60px;
    margin-bottom: 12px;
}

.create-chapter-summary:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.create-chapter-audio {
    display: flex;
    align-items: center;
    gap: 12px;
}


.create-audio-status {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.create-audio-status.has-audio {
    background: #dcfce7;
    color: #16a34a;
}

.create-audio-status.no-audio {
    background: #f3f4f6;
    color: #6b7280;
}


/* Empty State */

.create-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

.create-empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    color: #d1d5db;
}

.create-empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #374151;
}

.create-empty-state p {
    font-size: 14px;
    margin-bottom: 16px;
}


/* PDF Upload Styles */

.pdf-upload-area {
    transition: all 0.3s ease;
    cursor: pointer;
}

.pdf-upload-area:hover {
    border-color: #3b82f6 !important;
    background-color: #dbeafe !important;
}

.pdf-upload-area.drag-over {
    border-color: #3b82f6 !important;
    background-color: #dbeafe !important;
    transform: scale(1.02);
}

.pdf-preview {
    transition: all 0.3s ease;
}

.pdf-preview:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.pdf-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pdf-action-btn {
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.pdf-extract-btn {
    background-color: #dbeafe;
    color: #1d4ed8;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pdf-extract-btn:hover {
    background-color: #bfdbfe;
    color: #1e40af;
}


/* PDF Viewer Modal Styles */

.pdf-canvas {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
    max-width: 100%;
    max-height: 100%;
}


/* Create Book Modal Scrolling */

.create-book-modal {
    max-height: 95vh;
    overflow: hidden;
}

.create-book-left-panel {
    max-height: calc(95vh - 140px);
    /* Account for header and footer */
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

.create-book-left-panel::-webkit-scrollbar {
    width: 6px;
}

.create-book-left-panel::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.create-book-left-panel::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.create-book-left-panel::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.create-book-right-panel {
    max-height: calc(95vh - 140px);
    /* Account for header and footer */
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

.create-book-right-panel::-webkit-scrollbar {
    width: 6px;
}

.create-book-right-panel::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.create-book-right-panel::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.create-book-right-panel::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}


/* Create Chapters List Specific Scrolling */

.create-chapters-list-container {
    max-height: 1000px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

.create-chapters-list-container::-webkit-scrollbar {
    width: 6px;
}

.create-chapters-list-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.create-chapters-list-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.create-chapters-list-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}


/* Ensure chapters list takes full height and scrolls properly */

#createChaptersList {
    min-height: 200px;
}

/* Enhanced Chapter Card Styles */
.create-chapter-item {
    transition: all 0.2s ease;
    max-height: 320px;
    overflow: hidden;
}

.create-chapter-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.chapter-title-input {
    transition: all 0.2s ease;
}

.chapter-title-input:focus {
    background-color: #f8fafc;
    border-radius: 6px;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.chapter-content-input {
    transition: all 0.2s ease;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

.chapter-content-input::-webkit-scrollbar {
    width: 6px;
}

.chapter-content-input::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.chapter-content-input::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.chapter-content-input::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.chapter-content-input:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.create-chapter-number {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.chapter-char-count {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
}

/* Drag and drop styling */
.create-chapter-item.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.create-chapter-item.drag-over {
    border-color: #3b82f6;
    background-color: #eff6ff;
}

/* Button hover effects */
.create-chapter-delete-btn:hover {
    transform: scale(1.05);
}

.create-chapter-drag-handle:hover {
    transform: scale(1.05);
}

/* Enhanced Edit Chapter Styles */
.edit-chapter-item {
    transition: all 0.2s ease;
    max-height: 320px;
    overflow: hidden;
}

.edit-chapter-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.edit-chapter-title-input {
    transition: all 0.2s ease;
}

.edit-chapter-title-input:focus {
    background-color: #f8fafc;
    border-radius: 6px;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.1);
}

.edit-chapter-content-input {
    transition: all 0.2s ease;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

.edit-chapter-content-input::-webkit-scrollbar {
    width: 6px;
}

.edit-chapter-content-input::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.edit-chapter-content-input::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.edit-chapter-content-input::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.edit-chapter-content-input:focus {
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.edit-chapter-number {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    box-shadow: 0 2px 4px rgba(34, 197, 94, 0.2);
}

.edit-chapter-char-count {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
}

/* Edit chapter button hover effects */
.edit-chapter-delete-btn:hover {
    transform: scale(1.05);
}

.edit-chapter-drag-handle:hover {
    transform: scale(1.05);
}

/* Error state for edit chapters */
.edit-chapter-item.error {
    border-color: #ef4444;
    background-color: #fef2f2;
}

/* Success state for edit chapters */
.edit-chapter-item.success {
    border-color: #22c55e;
    background-color: #f0fdf4;
}


/* Optimized Modal Performance */

body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

.create-book-modal-content {
    height: 96vh;
    overflow: hidden;
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Edit Book Modal Styles - Optimized */
.edit-book-modal-content {
    height: 96vh;
    overflow: hidden;
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.edit-visual-book-container {
    perspective: 1000px;
    margin: 20px auto;
}

.edit-book-3d {
    position: relative;
    width: 120px;
    height: 160px;
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
}

.edit-book-3d:hover {
    transform: rotateY(-15deg) rotateX(5deg);
}

.edit-book-spine {
    position: absolute;
    left: -8px;
    top: 0;
    width: 8px;
    height: 160px;
    background: linear-gradient(to bottom, #16a34a, #15803d);
    border-radius: 2px 0 0 2px;
    box-shadow: -2px 0 4px rgba(0, 0, 0, 0.2);
}

.edit-book-cover {
    position: relative;
    width: 120px;
    height: 160px;
    background: white;
    border-radius: 0 4px 4px 0;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.edit-book-cover-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0 4px 4px 0;
}

.edit-book-cover-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    padding: 8px;
    text-align: center;
}

.edit-book-title {
    font-size: 10px;
    font-weight: bold;
    margin: 0;
    line-height: 1.2;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.edit-book-author {
    font-size: 8px;
    margin: 2px 0 0 0;
    opacity: 0.9;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.edit-book-pages {
    position: absolute;
    right: -3px;
    top: 2px;
    width: 118px;
    height: 156px;
    background: #f3f4f6;
    border-radius: 0 4px 4px 0;
    z-index: -1;
    box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
}

.edit-book-pages::after {
    content: '';
    position: absolute;
    right: -2px;
    top: 2px;
    width: 116px;
    height: 152px;
    background: #e5e7eb;
    border-radius: 0 4px 4px 0;
    z-index: -1;
    box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.edit-chapters-list-container {
    max-height: calc(95vh - 300px);
    overflow-y: auto;
}

.edit-chapters-list-container::-webkit-scrollbar {
    width: 6px;
}

.edit-chapters-list-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.edit-chapters-list-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.edit-chapters-list-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}