@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600&display=swap');

:root {
    --bg-color: #0f172a;
    --accent-color: #38bdf8;
    --text-color: #f8fafc;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.8);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Outfit', sans-serif;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
}

.flip-book-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 2000px;
    padding: 10vh 5vw; /* Added padding to "zoom out" the book */
}

#flipbook {
    background-color: transparent;
    max-height: 80vh;
    max-width: 90vw;
    border: none;
    outline: none;
}

.page {
    background-color: transparent;
    overflow: hidden;
}

.page img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    user-select: none;
}

/* Page Slider */
.slider-container {
    position: absolute;
    bottom: 7rem;
    width: 60%;
    z-index: 10;
}

#pageSlider {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    appearance: none;
    outline: none;
    cursor: pointer;
}

#pageSlider::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px var(--accent-color);
    transition: transform 0.2s ease;
}

#pageSlider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.controls {
    position: absolute;
    bottom: 2rem;
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.8); /* Darker background for better icon contrast */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 0.6rem 1.5rem;
    border-radius: 100px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow);
    z-index: 10;
    gap: 1.5rem;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.divider {
    width: 1px;
    height: 24px;
    background: var(--glass-border);
}

.extra-tools {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

button {
    background: transparent;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-color);
    transform: translateY(-2px);
}

button svg {
    stroke: var(--accent-color); /* Vibrant blue icons */
    width: 20px;
    height: 20px;
    display: block;
}

button:hover svg {
    stroke: #fff; /* White on hover */
}

.page-info {
    font-size: 0.9rem;
    font-weight: 500;
    min-width: 60px;
    text-align: center;
    color: var(--accent-color); /* Match vibrant blue */
}

/* Panels */
.panel {
    position: fixed;
    top: 0;
    right: -450px;
    width: 400px; /* Made wider */
    height: 100%;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(30px);
    border-left: 1px solid var(--glass-border);
    z-index: 100;
    transition: right 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 30px rgba(0,0,0,0.5);
}

.panel.active {
    right: 0;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.close-panel {
    font-size: 1.5rem;
}

.thumbnail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 10px;
    overflow-y: auto;
}

.thumb-item {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform 0.2s ease;
}

.thumb-item:hover {
    transform: translateY(-5px);
}

.thumb-img-wrapper {
    width: 100%;
    aspect-ratio: 550 / 733;
    background: #1e293b;
    border-radius: 4px;
    overflow: hidden;
    border: 2px solid transparent;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.thumb-item.active .thumb-img-wrapper {
    border-color: var(--accent-color);
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}

.thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Ensure full page is visible */
    background: #0f172a;
}

.thumb-page-num {
    text-align: center;
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 500;
}

.thumb-item.active .thumb-page-num {
    color: var(--accent-color);
}

.notes-content textarea {
    width: 100%;
    height: 200px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
    padding: 1rem;
    font-family: inherit;
    resize: none;
    margin-bottom: 1rem;
}

#saveNotes {
    width: 100%;
    background: var(--accent-color);
    color: var(--bg-color);
    font-weight: 600;
    border-radius: 8px;
    padding: 0.8rem;
}

/* Zoom state */
.zoomed {
    transform: scale(1.5);
    z-index: 50;
    transition: transform 0.3s ease;
}

/* Background Decoration */
.blob {
    position: absolute;
    width: 600px;
    height: 600px;
    filter: blur(80px);
    border-radius: 50%;
    z-index: -1;
    opacity: 0.6;
}

#blob1 {
    background: radial-gradient(circle, rgba(56, 189, 248, 0.2), transparent);
    top: -10%;
    left: -10%;
    animation: float1 25s infinite alternate ease-in-out;
}

#blob2 {
    background: radial-gradient(circle, rgba(139, 92, 246, 0.15), transparent);
    bottom: -10%;
    right: -10%;
    animation: float2 30s infinite alternate ease-in-out;
}

#blob3 {
    background: radial-gradient(circle, rgba(236, 72, 153, 0.1), transparent);
    top: 20%;
    right: 20%;
    animation: float1 20s infinite alternate-reverse ease-in-out;
}

#blob4 {
    background: radial-gradient(circle, rgba(34, 197, 94, 0.1), transparent);
    bottom: 30%;
    left: 10%;
    animation: float2 35s infinite alternate-reverse ease-in-out;
}

@keyframes float1 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(100px, 50px) scale(1.2); }
}

@keyframes float2 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-150px, -80px) scale(1.1); }
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .flip-book-container {
        height: 60vh;
    }
    h1 {
        font-size: 1.8rem;
    }
    .controls {
        gap: 1rem;
        padding: 0.8rem 1.5rem;
        bottom: 2rem;
    }
}
