/* ==========================================
   1. GLAVNI KONTEJNER I NAVIGACIJA
   ========================================== */

.library-container {
    max-width: 1200px;
    margin: 20px auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 0 20px;
}

/* --- LEPLJIVA NAVIGACIJA (STICKY NAVBAR) --- */
.main-navbar {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #1f130a;
    border-bottom: 3px solid #3d281a;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    z-index: 5000;
    padding: 12px 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-family: 'Georgia', serif;
    font-size: 18px;
    font-weight: bold;
    color: #f0e6d2;
    text-decoration: none;
    letter-spacing: 1px;
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-links a {
    font-family: 'Georgia', serif;
    font-size: 14px;
    color: #d4c3a3;
    text-decoration: none;
    transition: color 0.2s ease;
}

.nav-links a:hover, 
.nav-links a.active {
    color: #ffffff;
    border-bottom: 1px solid #f0e6d2;
}


/* ==========================================
   2. FILTERI I ŽANROVI (CHIPS)
   ========================================== */

.genre-filter-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
    max-width: 1200px;
}

.genre-chip {
    background-color: #f0e6d2;
    color: #2c1d11;
    padding: 4px 12px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 12px;
    font-family: 'Georgia', serif;
    font-weight: 600;
    border: 1px solid #d4c3a3;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.genre-chip:hover {
    background-color: #3d281a;
    color: #f0e6d2;
    border-color: #3d281a;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.genre-chip.active {
    background-color: #5c3d2e;
    color: #ffffff;
    border-color: #3d281a;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}


/* ==========================================
   3. NASLOV KATEGORIJE
   ========================================== */

.shelf-category-title {
    font-family: 'Georgia', serif;
    font-size: 16px;
    font-weight: bold;
    color: #2c1d11;
    margin-bottom: 6px;
    border-bottom: 2px solid #3d281a;
    display: inline-block;
    padding-bottom: 3px;
    letter-spacing: 1px;
}


/* ==========================================
   4. POLICA I HRBATI KNJIGA
   ========================================== */

.bookshelf {
    position: relative;
    width: 100%;
    background: linear-gradient(to bottom, #1f130a 0%, #2c1d11 15%, #3d281a 85%, #1a1007 100%);
    padding: 70px 30px 10px 30px; 
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 6px;
    border-bottom: 32px solid #140b05; /* Drvena daska na dnu */
    box-shadow: 0 25px 50px rgba(0,0,0,0.6), inset 0 10px 15px rgba(0,0,0,0.8);
    border-radius: 2px;
    overflow: visible !important; 
}

.bookshelf::before {
    content: '';
    position: absolute;
    bottom: 32px;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(0, 0, 0, 0.4);
}

/* Horizontalna polica sa skrolom (ako se koristi) */
.single-bookshelf {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 4px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 10px 15px 20px 15px;
    width: 100%;
    background: linear-gradient(to bottom, #1f130a 0%, #2c1d11 15%, #3d281a 85%, #1a1007 100%);
    border-bottom: 32px solid #140b05; 
    box-shadow: 0 25px 50px rgba(0,0,0,0.6), inset 0 10px 15px rgba(0,0,0,0.8);
    border-radius: 2px;
    scrollbar-width: none;
}

.single-bookshelf::-webkit-scrollbar {
    display: none;
}

.shelf-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    margin: 20px 30px 40px 30px;
    padding-top: 70px;
}

/* Strelice za pomeranje levo/desno */
.shelf-arrow {
    position: absolute;
    top: 60%;
    transform: translateY(-50%);
    z-index: 20;
    background: rgba(43, 45, 66, 0.9);
    color: #fff;
    border: 2px solid #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.shelf-arrow:hover {
    background: #e76f51;
    transform: translateY(-50%) scale(1.1);
}

.arrow-left { left: -25px; }
.arrow-right { right: -25px; }


/* ==========================================
   5. HRBAT KNJIGE I ANIMACIJE
   ========================================== */

.book-spine {
    position: relative;
    display: flex;
    text-decoration: none;
    color: #fff;
    border-radius: 2px 3px 3px 2px;
    box-shadow: inset -7px 0 15px rgba(0,0,0,0.65), 3px 4px 10px rgba(0,0,0,0.8);
    cursor: pointer;
    transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
    transform-origin: bottom center;
    margin-bottom: 0px;
    z-index: 1;
    overflow: visible !important;
    flex-shrink: 0;
}

.book-spine:hover {
    transform: translateY(-45px) scale(1.05) rotate(-1deg);
    box-shadow: -14px 24px 38px rgba(0,0,0,0.95), inset -4px 0 10px rgba(0,0,0,0.3);
    z-index: 1000;
}


/* ==========================================
   6. TOOLTIP PREVIEW (OBLAČIĆ)
   ========================================== */

.book-preview-tooltip {
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    width: 200px;
    background: #fff;
    color: #2c1d11;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease-in-out;
    pointer-events: none;
    z-index: 2000;
}

.book-preview-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #fff transparent transparent transparent;
}

.book-spine:hover .book-preview-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-10px) scale(1);
}

.tooltip-cover {
    width: 90px;
    height: 130px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.tooltip-title {
    font-size: 13px;
    font-weight: bold;
    color: #1a1007;
    margin-bottom: 4px;
    line-height: 1.2;
}

.tooltip-author {
    font-size: 11px;
    color: #666;
    font-style: italic;
}


/* ==========================================
   7. LAYOUTI I TEKSTOVI NA HRBTU
   ========================================== */

.spine-layout-1 { flex-direction: column; justify-content: space-between; align-items: center; padding: 12px 3px; border-top: 5px solid rgba(0,0,0,0.3); border-bottom: 8px solid rgba(0,0,0,0.4); }
.spine-layout-2 { flex-direction: column; justify-content: center; align-items: center; padding: 15px 2px; }
.spine-layout-3 { flex-direction: column; justify-content: flex-start; align-items: center; padding: 18px 4px; border-left: 3px solid rgba(255,255,255,0.12); }
.spine-layout-4 { flex-direction: column; justify-content: space-around; align-items: center; padding: 10px 3px; }
.spine-layout-5 { flex-direction: column; justify-content: space-between; align-items: center; padding: 22px 5px; }
.spine-layout-6 { flex-direction: column; justify-content: space-between; align-items: center; padding: 14px 4px; border-bottom: 12px solid rgba(0,0,0,0.5); }

.spine-top-text, .book-title, .book-author {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-title { font-size: 11px; font-weight: 700; max-height: 200px; text-shadow: 1px 1px 3px rgba(0,0,0,0.9); }
.book-author { font-size: 9.5px; opacity: 0.9; }
.spine-top-text { font-size: 9px; opacity: 0.85; }
.spine-publisher-logo { font-size: 8px; letter-spacing: 1px; background: rgba(0,0,0,0.3); padding: 2px 4px; border-radius: 2px; color: #f0e6d2; }
.spine-emblem { font-size: 7px; opacity: 0.7; }


/* ==========================================
   8. DARK MODE (KOMPLETNA PRILAGODDBA)
   ========================================== */

/* Žanrovski čipovi u tamnom režimu */
body.dark .genre-chip {
    background-color: #1e1e1e !important;
    color: #e0e0e0 !important;
    border: 1px solid #333333 !important;
}

body.dark .genre-chip:hover,
body.dark .genre-chip.active {
    background-color: #c59d5f !important;
    color: #ffffff !important;
    border-color: #c59d5f !important;
}

/* Podžanrovi */
body.dark .subgenre-container {
    background: rgba(255, 255, 255, 0.05) !important;
    border-left-color: #c59d5f !important;
}

body.dark .subgenre-chip {
    background-color: #2a2a2a !important;
    color: #e0e0e0 !important;
    border-color: #444444 !important;
}

body.dark .subgenre-chip:hover, 
body.dark .subgenre-chip.active {
    background-color: #c59d5f !important;
    color: #ffffff !important;
    border-color: #c59d5f !important;
}

/* Naslovi i tekstovi */
body.dark .shelf-category-title {
    color: #ffffff !important;
}

body.dark .shelf-category-title span {
    color: #aaaaaa !important;
}

/* Polica i drvena daska na dnu u dark mode-u */
body.dark .bookshelf,
body.dark .single-bookshelf {
    background: linear-gradient(to bottom, #120b06 0%, #1a1007 15%, #24170e 85%, #0d0704 100%) !important;
    border-bottom-color: #080402 !important;
}

/* Tooltip (isling oblačić) u dark mode-u */
body.dark .book-preview-tooltip {
    background-color: #1e1e1e !important;
    color: #ffffff !important;
    border: 1px solid #333333 !important;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.7) !important;
}

body.dark .book-preview-tooltip::after {
    border-color: #1e1e1e transparent transparent transparent !important;
}

body.dark .tooltip-title {
    color: #ffffff !important;
}

body.dark .tooltip-author {
    color: #aaaaaa !important;
}

body.dark .library-container p {
    color: #aaaaaa !important;
}
/* ==========================================
   DOPUNA ZA TEKSTOVE NA HRBTU U DARK MODE-u
   ========================================== */

body.dark .book-title {
    color: #ffffff !important;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.95) !important;
}

body.dark .book-author {
    color: #e0d0c0 !important;
}

body.dark .spine-top-text {
    color: #d0c0b0 !important;
}

body.dark .spine-publisher-logo {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
}

body.dark .spine-emblem {
    color: #cccccc !important;
}