/**
 * 📚 Book Constructor V3 - Premium Glassmorphism Theme
 * Премиальные стили с эффектом жидкого стекла
 * 
 * @version 3.0.0
 */

/* ==================== ГЛОБАЛЬНЫЙ ФОН ==================== */

body {
    background: 
        radial-gradient(ellipse 80% 50% at 20% 40%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 20%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse 50% 30% at 50% 80%, rgba(168, 85, 247, 0.08) 0%, transparent 50%),
        linear-gradient(135deg, #0a0a12 0%, #12121a 50%, #0a0a12 100%);
    background-attachment: fixed;
    min-height: 100vh;
}

/* ==================== ОСНОВНОЙ КОНТЕЙНЕР V3 ==================== */

.book-app-v3 {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-top: 0;
}

.book-app-v3.loaded {
    opacity: 1;
}

/* ==================== ГЛОБАЛЬНАЯ НАВИГАЦИЯ ==================== */

.global-nav {
    position: sticky;
    top: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 56px;
    
    background: linear-gradient(
        135deg,
        rgba(88, 28, 135, 0.9) 0%,
        rgba(124, 58, 237, 0.8) 30%,
        rgba(139, 92, 246, 0.75) 50%,
        rgba(124, 58, 237, 0.8) 70%,
        rgba(88, 28, 135, 0.9) 100%
    );
    
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 
        0 4px 24px rgba(139, 92, 246, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.nav-left,
.nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.nav-group {
    display: flex;
    align-items: center;
}

.nav-group-label {
    display: none;
}

.nav-items {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.15);
}

.nav-item.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 
        0 0 20px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.nav-item i {
    font-size: 14px;
}

.nav-item-sm {
    padding: 8px 10px;
}

.nav-item-sm span {
    display: none;
}

.nav-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 8px;
}

/* App Title */
.app-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-title-icon {
    font-size: 26px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.app-title-text {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.app-version {
    padding: 3px 10px;
    font-size: 10px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-avatar {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-avatar:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    padding: 8px;
    background: rgba(30, 30, 46, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 300;
}

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

.user-info {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-name {
    display: block;
    font-weight: 600;
    color: #fff;
}

.user-role {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 2px;
}

.dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 8px 0;
}

.dropdown-item-glass {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.dropdown-item-glass:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.dropdown-item-glass.text-error {
    color: #f87171;
}

.admin-links {
    display: flex;
    gap: 4px;
}

/* ==================== ТУЛБАР ==================== */

.book-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    margin: 16px 24px;
    gap: 20px;
    
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.toolbar-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.toolbar-left {
    flex: 1;
    max-width: 350px;
}

.toolbar-center {
    display: flex;
    align-items: center;
    gap: 16px;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Book Name Input */
.book-name-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.book-name-icon {
    position: absolute;
    left: 14px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
    pointer-events: none;
}

.book-name-input {
    width: 100%;
    padding: 10px 16px 10px 38px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.book-name-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.book-name-input:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.book-name-input:focus {
    outline: none;
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.book-name-status {
    position: absolute;
    right: 12px;
    color: #22c55e;
    opacity: 0;
    transition: opacity 0.2s;
}

.book-name-input:not(:placeholder-shown) ~ .book-name-status {
    opacity: 1;
}

/* Mode Switcher */
.mode-switcher {
    display: flex;
    padding: 4px;
    gap: 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
}

.mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 20px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-btn i {
    font-size: 16px;
    margin-bottom: 2px;
}

.mode-hint {
    font-size: 10px;
    opacity: 0.6;
}

.mode-btn:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.08);
}

.mode-btn.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.8), rgba(99, 102, 241, 0.8));
    border-color: rgba(139, 92, 246, 0.3);
    box-shadow: 
        0 4px 15px rgba(139, 92, 246, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Size Switcher */
.size-switcher {
    display: flex;
    padding: 4px;
    gap: 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
}

.size-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.2s ease;
}

.size-value {
    font-size: 15px;
    font-weight: 700;
}

.size-label {
    font-size: 10px;
    opacity: 0.7;
}

.size-btn:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.08);
}

.size-btn.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.8), rgba(99, 102, 241, 0.8));
    border-color: rgba(139, 92, 246, 0.3);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

/* Toolbar Actions */
.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-group {
    display: flex;
    gap: 6px;
}

.action-divider {
    width: 1px;
    height: 28px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 8px;
}

/* ==================== QUICK LINKS ==================== */

.quick-links {
    margin: 0 24px 16px;
    padding: 16px;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 12px;
}

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

.quick-links-header h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #4ade80;
}

.quick-links-body {
    display: flex;
    gap: 12px;
}

.link-card {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

.link-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 16px;
}

.link-icon.production {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
}

.link-icon.client {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.link-info {
    flex: 1;
    min-width: 0;
}

.link-label {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 2px;
}

.link-url {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==================== PREMIUM BUTTONS ==================== */

.btn-glass {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    height: 40px;
    
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-glass:active {
    transform: translateY(0);
}

.btn-glass.btn-sm {
    height: 34px;
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 10px;
}

.btn-glass-primary,
.export-main-btn {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.8), rgba(99, 102, 241, 0.8));
    border-color: rgba(139, 92, 246, 0.4);
    color: #fff;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.25);
}

.btn-glass-primary:hover,
.export-main-btn:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.9), rgba(99, 102, 241, 0.9));
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.35);
    transform: translateY(-2px);
}

.btn-glass-success {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.8), rgba(22, 163, 74, 0.8));
    border-color: rgba(34, 197, 94, 0.4);
    color: #fff;
}

.btn-glass-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.8), rgba(220, 38, 38, 0.8));
    border-color: rgba(239, 68, 68, 0.4);
    color: #fff;
}

/* ==================== MAIN LAYOUT ==================== */

.book-main {
    display: flex;
    gap: 16px;
    padding: 0 24px 24px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ==================== SIDEBARS ==================== */

.sidebar {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    
    overflow: hidden;
}

.sidebar-left {
    /* Левый сайдбар */
}

.sidebar-right {
    /* Правый сайдбар */
}

/* Sidebar Sections */
.sidebar-section {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-section:last-child {
    border-bottom: none;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.section-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.section-header h3 i {
    font-size: 14px;
    color: rgba(139, 92, 246, 0.8);
}

/* Cover Section */
.cover-section {
    /* Секция обложки */
}

.cover-preview-wrapper {
    position: relative;
    cursor: pointer;
}

.cover-preview {
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
    
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(59, 130, 246, 0.1));
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.cover-preview:hover {
    border-color: rgba(139, 92, 246, 0.5);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(59, 130, 246, 0.15));
}

.cover-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.4);
}

.cover-placeholder i {
    font-size: 32px;
}

.cover-placeholder span {
    font-size: 12px;
    text-align: center;
    padding: 0 16px;
}

.cover-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cover-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: opacity 0.2s;
    border-radius: 12px;
}

.cover-preview-wrapper:hover .cover-overlay {
    opacity: 1;
}

.cover-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

.cover-size i {
    margin-right: 4px;
}

.cover-status {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.cover-status.success {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

/* Progress Section */
.progress-section {
    /* Секция прогресса */
}

.progress-value {
    font-size: 14px;
    font-weight: 700;
    color: #22c55e;
}

.fill-progress {
    /* Контейнер прогресса */
}

.fill-progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.fill-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #8b5cf6, #22c55e);
    border-radius: 10px;
    transition: width 0.5s ease;
}

.fill-progress-stats {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

.fill-progress-stats i {
    margin-right: 4px;
}

/* History Section */
.history-section {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.history-search {
    position: relative;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.history-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
    pointer-events: none;
}

.history-search .input-glass,
.history-search input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: #fff;
    font-size: 13px;
}

.history-search input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.history-search input:focus {
    outline: none;
    border-color: rgba(139, 92, 246, 0.5);
    background: rgba(139, 92, 246, 0.1);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    margin: 0 -8px;
    padding: 0 8px;
}

.history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    color: rgba(255, 255, 255, 0.3);
    text-align: center;
}

.history-empty i {
    font-size: 32px;
    margin-bottom: 8px;
}

.history-empty span {
    font-size: 13px;
}

/* History Item */
.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 8px;
    
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(139, 92, 246, 0.3);
    transform: translateX(4px);
}

.history-item-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(99, 102, 241, 0.2));
    border-radius: 10px;
    color: #a78bfa;
    font-size: 14px;
    flex-shrink: 0;
}

.history-item-info {
    flex: 1;
    min-width: 0;
}

.history-item-name {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.history-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
}

.history-item-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.history-item:hover .history-item-actions {
    opacity: 1;
}

.history-item-actions .btn-glass {
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 12px;
}

/* ==================== CONTENT AREA ==================== */

.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    
    overflow: hidden;
}

.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.content-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.content-title h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

.content-title h2 i {
    color: rgba(139, 92, 246, 0.8);
}

.page-counter {
    padding: 6px 14px;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #a78bfa;
}

.content-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.spread-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
}

.spread-count {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    padding: 0 8px;
}

/* Pages Mode */
.pages-mode {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.spreads-mode {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Pages Grid */
.pages-grid-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.pages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.grid-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    color: rgba(255, 255, 255, 0.5);
}

.grid-loading .loading-spinner {
    margin-bottom: 16px;
}

/* Spreads Grid */
.spreads-grid-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.spreads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

/* ==================== SPREAD CARD ==================== */

.spread-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 12px;
    transition: all 0.2s ease;
}

.spread-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(139, 92, 246, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.spread-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.spread-title {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
}

.spread-pages {
    display: flex;
    gap: 8px;
}

.page-slot {
    flex: 1;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    
    background: rgba(255, 255, 255, 0.03);
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    position: relative;
}

.page-slot:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.4);
}

.page-slot.has-image {
    border-style: solid;
    border-color: rgba(34, 197, 94, 0.4);
}

.page-slot.has-text {
    border-color: rgba(59, 130, 246, 0.4);
}

.page-slot-icon {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.3);
}

.page-slot-hint {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
}

.page-slot-number {
    position: absolute;
    top: 6px;
    left: 6px;
    padding: 2px 8px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
}

.page-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.page-text-indicator {
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.8);
    border-radius: 6px;
    font-size: 10px;
    color: #fff;
}

/* ==================== KEYBOARD HINTS ==================== */

.content-footer {
    padding: 12px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.keyboard-hints {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.hint {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

kbd {
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
}

/* ==================== EXPORT PROGRESS ==================== */

.export-progress {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 380px;
    
    background: rgba(30, 30, 46, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    z-index: 100;
}

.export-progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.export-progress-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.export-progress-title i {
    color: #a78bfa;
}

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

.export-progress-body {
    padding: 16px;
}

.export-progress-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
}

.export-progress-status {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
}

.export-progress-percent {
    font-size: 14px;
    font-weight: 700;
    color: #a78bfa;
}

.export-progress-details {
    margin-top: 12px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

/* Progress Bar */
.progress-glass {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

.progress-glass-fill {
    height: 100%;
    background: linear-gradient(90deg, #8b5cf6, #a78bfa);
    border-radius: 10px;
    transition: width 0.3s ease;
}

/* ==================== STATUS BAR ==================== */

.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 24px;
    margin: 0 24px 16px;
    
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    flex-shrink: 0;
}

.status-left,
.status-center,
.status-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.status-item i {
    font-size: 11px;
}

.status-connection {
    color: #22c55e;
}

.status-autosave.saved {
    color: #22c55e;
}

.status-autosave.saving {
    color: #f59e0b;
}

.status-autosave.saving i {
    animation: pulse 1s infinite;
}

.status-autosave.error {
    color: #ef4444;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ==================== TOAST CONTAINER ==================== */

.toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

/* ==================== LOADING SPINNER ==================== */

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-spinner.lg {
    width: 40px;
    height: 40px;
    border-width: 4px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== ANIMATIONS ==================== */

.animate-fade-in-down {
    animation: fadeInDown 0.3s ease;
}

.animate-slide-in-up {
    animation: slideInUp 0.3s ease;
}

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

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== SCROLLBAR ==================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 1200px) {
    .sidebar {
        width: 240px;
    }
    
    .nav-item span {
        display: none;
    }
    
    .nav-item {
        padding: 8px 12px;
    }
}

@media (max-width: 992px) {
    .book-main {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        max-height: 250px;
    }
}

@media (max-width: 768px) {
    .book-toolbar {
        flex-wrap: wrap;
        margin: 12px 16px;
        padding: 12px 16px;
    }
    
    .toolbar-left {
        order: 1;
        width: 100%;
        max-width: none;
        margin-bottom: 12px;
    }
    
    .toolbar-center {
        order: 2;
    }
    
    .toolbar-right {
        order: 3;
        margin-left: auto;
    }
    
    .mode-btn span,
    .mode-hint {
        display: none;
    }
    
    .mode-btn {
        padding: 10px 14px;
    }
    
    .book-main {
        padding: 0 16px 16px;
    }
    
    .status-bar {
        margin: 0 16px 12px;
    }
    
    .pages-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    
    .keyboard-hints {
        flex-wrap: wrap;
        gap: 12px;
    }
}
/* ==================== ИСПРАВЛЕНИЯ ЛЕЙАУТА ==================== */

/* 1. История - ограничить высоту и добавить скролл */
.sidebar-left {
    max-height: calc(100vh - 56px - 100px);
    overflow: hidden;
}

.sidebar-left .sidebar-section:last-child {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.history-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    max-height: 300px;
    margin: 0 -8px;
    padding: 0 8px 8px;
}

/* Показывать только когда активен режим разворотов */
.book-app-v3[data-view="spreads"] .spreads-mode,
.book-app-v3.spreads-active .spreads-mode {
    display: flex !important;
}

.book-app-v3[data-view="spreads"] .pages-mode,
.book-app-v3.spreads-active .pages-mode {
    display: none !important;
}

/* Секция "Развороты для фотопечати" внизу страницы - скрыть */
.content-area ~ .spreads-mode,
.book-main > .spreads-mode:not(.content-area .spreads-mode) {
    display: none !important;
}

/* 3. Обложка - исправить позиционирование */
.cover-preview {
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.cover-preview .cover-image,
.cover-preview img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Убрать смещение */
.cover-preview-wrapper {
    position: relative;
    width: 100%;
}

.cover-section .cover-preview {
    width: 100%;
}

/* 4. Основной контент - фиксированная высота */
.book-main {
    display: flex;
    gap: 16px;
    padding: 0 24px 24px;
    flex: 1;
    min-height: 0;
    max-height: calc(100vh - 56px - 80px - 60px);
    overflow: hidden;
}

.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.pages-grid-wrapper,
.spreads-grid-wrapper {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* 5. Сайдбары - фиксированная высота */
.sidebar {
    max-height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sidebar-right {
    max-height: 100%;
}

/* ==================== КНОПКА "НОВЫЙ ПРОЕКТ" ==================== */

/* Стиль для кнопки если она есть в HTML */
.btn-new-project,
[data-action="new-project"],
.new-project-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    height: 40px;
    
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-new-project:hover,
[data-action="new-project"]:hover,
.new-project-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}
/* ==================== ФИКСЫ ПЕРЕКЛЮЧЕНИЯ РЕЖИМОВ ==================== */

/* По умолчанию показываем только pages-mode */
.pages-mode {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* Контент разворотов скрыт по умолчанию */
.spreads-mode[hidden] {
    display: none;
}

.spreads-mode:not([hidden]) {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.pages-mode[hidden] {
    display: none;
}

/* НЕ скрываем кнопки режимов! */
.mode-btn[data-mode="spreads"],
.mode-btn[data-mode="pages"] {
    display: flex;
}

/* ==================== КНОПКА "НОВЫЙ ПРОЕКТ" ==================== */

/* Добавляем стиль для кнопки нового проекта */
#newProjectBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    height: 40px;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

#newProjectBtn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* ==================== ИСТОРИЯ - ОГРАНИЧИТЬ ВЫСОТУ ==================== */

.history-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    max-height: 250px;
    margin: 0 -8px;
    padding: 0 8px 8px;
}

/* ==================== САЙДБАР - ПРАВИЛЬНАЯ ВЫСОТА ==================== */

.sidebar-left {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 56px - 100px - 60px);
    overflow: hidden;
}

.sidebar-left .sidebar-section:last-child {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ==================== BOOK-MAIN - ПРАВИЛЬНЫЙ FLEX ==================== */

.book-main {
    display: flex;
    gap: 16px;
    padding: 0 24px 24px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

/* ==================== GRID СТРАНИЦ ==================== */

.pages-grid-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    min-height: 0;
}

.pages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

/* ==================== SPREAD CARD В PAGES MODE ==================== */

/* Карточка разворота (в режиме страниц показываем как 2 страницы) */
.spread-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 12px;
    transition: all 0.2s ease;
}

.spread-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(139, 92, 246, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.spread-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.spread-number {
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
}

.spread-pages {
    display: flex;
    gap: 8px;
}

.page-slot {
    flex: 1;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.03);
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    position: relative;
}

.page-slot:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.4);
}

.page-slot.has-image {
    border-style: solid;
    border-color: rgba(34, 197, 94, 0.4);
}

.page-slot-icon {
    font-size: 24px;
    color: rgba(255, 255, 255, 0.3);
}

.page-slot-hint {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
}

.page-slot-number {
    position: absolute;
    top: 6px;
    left: 6px;
    padding: 2px 8px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
}

.page-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}
/* ==================== ИСПРАВЛЕНИЯ TOOLTIPS ==================== */

/* Тултипы в навигации - показывать СНИЗУ */
.global-nav [data-tooltip]::after {
    bottom: auto;
    top: 100%;
    transform: translateX(-50%) translateY(8px);
}

.global-nav [data-tooltip]:hover::after {
    transform: translateX(-50%) translateY(4px);
}

/* Тултипы в контенте - показывать СНИЗУ */
.content-area [data-tooltip]::after,
.book-toolbar [data-tooltip]::after {
    bottom: auto;
    top: 100%;
    transform: translateX(-50%) translateY(8px);
}

.content-area [data-tooltip]:hover::after,
.book-toolbar [data-tooltip]:hover::after {
    transform: translateX(-50%) translateY(4px);
}

/* Общий стиль тултипов - убедиться что видно */
[data-tooltip]::after {
    background: rgba(30, 30, 46, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    z-index: 9999;
    white-space: nowrap;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* ==================== КНОПКИ В ИСТОРИИ ==================== */

/* Иконки действий в истории - фиолетовые */
.history-item-icon {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(99, 102, 241, 0.3));
    color: #a78bfa;
}

/* Кнопки действий в истории */
.history-item-actions .btn-glass {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.3);
    color: #a78bfa;
}

.history-item-actions .btn-glass:hover {
    background: rgba(139, 92, 246, 0.4);
    border-color: rgba(139, 92, 246, 0.5);
    color: #fff;
}

/* Иконки внутри history-item (папка, скачать, ссылка) */
.history-item a,
.history-item button,
.history-item .btn-glass {
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.25);
    color: #a78bfa;
}

.history-item a:hover,
.history-item button:hover,
.history-item .btn-glass:hover {
    background: rgba(139, 92, 246, 0.3);
    border-color: rgba(139, 92, 246, 0.4);
    color: #c4b5fd;
}

/* Если иконки просто внутри span/div */
.history-item-meta i,
.history-item i {
    color: #a78bfa;
}

/* Кнопка обновить историю */
#refreshHistoryBtn {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.25);
    color: #a78bfa;
}

#refreshHistoryBtn:hover {
    background: rgba(139, 92, 246, 0.3);
    color: #c4b5fd;
}

/* ==================== СЕКЦИЯ HEADER В САЙДБАРЕ ==================== */

.section-header .btn-glass {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.25);
    color: #a78bfa;
}

.section-header .btn-glass:hover {
    background: rgba(139, 92, 246, 0.3);
    border-color: rgba(139, 92, 246, 0.4);
    color: #c4b5fd;
}
/* ==================== ЗАГЛУШКА ДЛЯ КНОПОК В РАЗРАБОТКЕ ==================== */

.nav-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-item.disabled:hover {
    background: transparent;
    border-color: transparent;
    color: rgba(255, 255, 255, 0.5);
}
