/* CSS Reset & Variables */
:root {
    --bg-color: #1a1a1a;
    --text-color: #f0f0f0;
    --primary-color: #3b82f6;
    --toolbar-bg: rgba(26, 26, 26, 0.95);
    --shadow-color: rgba(0, 0, 0, 0.5);
    --book-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden; /* Prevent body scroll, handle in app */
    height: 100vh;
}

/* Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Toolbar */
.toolbar {
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    background-color: var(--toolbar-bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 100;
    backdrop-filter: blur(10px);
}

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

.toolbar-right {
    display: flex;
    gap: 10px;
}

#book-title {
    font-size: 1rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

#page-indicator {
    font-variant-numeric: tabular-nums;
    font-size: 0.9rem;
    min-width: 60px;
    text-align: center;
}

/* Main Area */
.flipbook-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 20px;
    overflow: hidden;
}

.flipbook {
    display: none; /* Hidden until loaded */
    box-shadow: var(--book-shadow);
    transition: transform 0.3s ease;
}

/* Canvas Pages */
canvas {
    display: block;
}

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -20px;
    margin-left: -20px;
}

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

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
    #book-title {
        display: none;
    }
    .toolbar {
        padding: 0 10px;
    }
}
