/* ==========================================
   1. OSNOVNI RESET I BAZNI STILOVI
   ========================================== */
* {
    box-sizing: border-box;
}

body {
    font-family: Verdana, sans-serif;
    font-size: 14px;
    background-color: #f8f6f1;
    color: #333333;
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

h1 {
    color: #1e293b;
    text-align: center;
    font-size: 42px;
    margin: 20px;
    letter-spacing: 1px;
}

a {
    color: #1e293b;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #c59d5f;
}

/* Naslovi po sekcijama */
#oMeni { color: coral; margin: 5px; padding: 5px; }
#Hobiji { color: purple; margin: 5px; padding: 5px; }
#OmiljeniSajtovi { color: blueviolet; margin: 5px; padding: 5px; }
#Kontakt { color: gold; margin: 5px; padding: 5px; }

/* DUGMAD (Generalno) */
button {
    background-color: #1e293b;
    color: #ffffff;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 15px;
}

button:hover {
    background-color: #c59d5f;
    transform: translateY(-2px);
}

.backbtn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background-color: #1e293b;
    color: #ffffff;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.backbtn:hover {
    background-color: #334155;
    transform: translateX(-3px);
}


/* ==========================================
   2. STICKY NAVIGACIJA I DROPDOWN MENI
   ========================================== */
nav, .navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 20px;
    background-color: #2c221e;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

nav ul, .nav-left {
    list-style-type: none;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin: 0;
    padding: 0;
}

nav ul li a, .nav-left a {
    color: #ffffff;
    text-decoration: none;
    font-size: 16px;
}

nav ul li a:hover, .nav-left a:hover {
    color: #c59d5f;
}

/* Dropdown Meni */
.dropdown {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #333333;
    min-width: 200px;
    padding: 0;
    margin: 0;
    z-index: 999;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.dropdown:hover .dropdown-content {
    display: block;
}

.genre-item {
    position: relative;
    list-style: none;
}

.genre-item > a {
    display: block;
    padding: 12px;
    color: #ffffff;
    text-decoration: none;
}

.genre-item:hover {
    background-color: #555555;
}

/* Podžanrovi (Submenu) */
.submenu {
    display: none;
    position: absolute;
    top: 0;
    left: 100%;
    background-color: #333333;
    min-width: 200px;
    padding: 0;
    margin: 0;
}

.genre-item:hover > .submenu {
    display: block;
}

.submenu li {
    list-style: none;
}

.submenu a {
    display: block;
    padding: 12px;
    color: #ffffff;
    text-decoration: none;
}

.submenu a:hover {
    background-color: #555555;
}

/* Header Right Options */
.top-header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    margin-top: 15px;
    margin-right: 20px;
}

.user-nav-box .user-link {
    color: #3b2d25;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.95em;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.user-nav-box .user-link:hover {
    color: #8c6d58;
}

.auth-link {
    color: #3b2d25;
    text-decoration: none;
    font-weight: 500;
}

.nav-divider {
    color: #ccc;
    opacity: 0.5;
    margin: 0 4px;
}


/* ==========================================
   3. PROFIL I DASHBOARD
   ========================================== */
.profile-container {
    max-width: 1000px;
    margin: 40px auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.user-link {
    color: #1e293b;
    text-decoration: none;
    font-weight: bold;
    font-size: 17px;
}

.user-link:hover {
    color: #c59d5f;
}

.profile-card {
    width: 400px;
    margin: 50px auto;
    background-color: #ffffff;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    text-align: center;
}

.profile-card p {
    font-size: 18px;
    margin: 20px;
}

.streak-badge {
    background-color: #fff3e0;
    color: #e65100;
    border: 1px solid #ffe0b2;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: bold;
    display: inline-block;
    margin-left: 6px;
}

/* User Profile Banner */
.user-profile-banner {
    background: #ffffff;
    border: 1px solid #e2d9cd;
    border-radius: 16px;
    padding: 24px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    margin-bottom: 30px;
    width: 100%;
    box-sizing: border-box;
}

.user-info-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.avatar-circle {
    width: 65px;
    height: 65px;
    background: #f3ede6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
}

.user-text-details h2 {
    margin: 0 0 4px 0;
    color: #2c221e;
    font-size: 1.6em;
}

.user-email, .user-joined {
    display: block;
    font-size: 0.85em;
    color: #776e65;
    margin-top: 2px;
}

.streak-pill {
    background: #fff4e5;
    border: 1px solid #ffe0b2;
    color: #d85100;
    padding: 8px 18px;
    border-radius: 30px;
    font-size: 0.95em;
}

/* Grid Layout */
.profile-dashboard-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 25px;
    align-items: start;
}

.dashboard-section {
    background: #ffffff;
    border: 1px solid #e2d9cd;
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
}

.dashboard-section h3 {
    margin-top: 0;
    margin-bottom: 18px;
    color: #3b2e28;
    font-size: 1.1em;
    border-bottom: 1px solid #f0e8de;
    padding-bottom: 10px;
}

/* Habits Cards */
.habits-cards-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.habit-card {
    background: #faf6f0;
    border: 1px solid #eee5da;
    border-radius: 12px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.habit-icon {
    font-size: 1.8em;
}

.habit-number {
    display: block;
    font-size: 1.3em;
    font-weight: bold;
    color: #2c221e;
}

.habit-label {
    font-size: 0.78em;
    color: #887e75;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Favorite Books Grid */
.favorites-books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 18px;
}

.fav-card {
    border: 1px solid #eee2d5;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease;
}

.fav-card:hover {
    transform: translateY(-4px);
}

.fav-cover {
    height: 190px;
    background: #f5f0eb;
    overflow: hidden;
}

.fav-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fav-info {
    padding: 12px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.fav-info h4 {
    margin: 0 0 4px 0;
    font-size: 0.9em;
    color: #2c221e;
}

.fav-info p {
    margin: 0 0 12px 0;
    font-size: 0.78em;
    color: #887e75;
    flex-grow: 1;
}

.fav-btn {
    text-align: center;
    background: #8c6d58;
    color: #fff;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.8em;
    font-weight: bold;
}

.empty-msg {
    color: #998e85;
    font-size: 0.9em;
    font-style: italic;
}


/* ==========================================
   4. PAGEFLIP KNJIGA & TAJMER (SNIPPETS & SIPS)
   ========================================== */
.book-section {
    max-width: 950px;
    margin: 40px auto;
    text-align: center;
    padding: 0 15px;
}

.book-section h2 {
    font-family: 'Georgia', serif;
    color: #333333;
    margin-bottom: 15px;
}

/* Omotač i Kontejner Knjige */
.pageflip-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
    margin: 10px auto;
    width: 100%;
}

#flip-book {
    width: 760px; /* Širina za 2 otvorene stranice (380px * 2) */
    height: 520px;
    position: relative;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
    background-color: #fdfbf7;
    margin: 0 auto;
}

/* Pojedinačne stranice unutar FlipBook-a */
#flip-book .page {
    width: 380px;
    height: 520px;
    padding: 30px 25px;
    background-color: #fdfbf7;
    color: #2c2c2c;
    font-family: 'Georgia', serif;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid #eae5d9;
    overflow: hidden;
}

/* SAKRIVANJE ostalih stranica pre nego što se StPageFlip JS pokrene */
#flip-book:not(.stpageflip) .page:not(:first-child) {
    display: none;
}

.page-header {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
    border-bottom: 1px solid #e0dacf;
    padding-bottom: 5px;
    margin-bottom: 12px;
}

.page-content {
    flex-grow: 1;
    font-size: 0.95rem;
    line-height: 1.6;
    text-align: justify;
    
    /* Stroži prelom reči da spreči usamljena slova na kraju reda */
    word-break: normal;
    overflow-wrap: anywhere; /* Umesto break-word, 'anywhere' sprečava loše sečenje */
    hyphens: auto;
    -webkit-hyphens: auto;
}
.author-subtitle {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 15px;
    font-style: italic;
    text-align: center;
}

.page-footer {
    text-align: center;
    font-size: 0.8rem;
    color: #888;
    border-top: 1px solid #e0dacf;
    padding-top: 8px;
    margin-top: 10px;
}

/* Kontrole za listanje */
.book-controls {
    text-align: center;
    margin-top: 20px;
    margin-bottom: 25px;
}

.book-controls button {
    background: #1e293b;
    color: #ffffff;
    border: none;
    padding: 10px 22px;
    margin: 0 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.2s ease;
}

.book-controls button:hover {
    background: #c59d5f;
}

.book-action-box {
    margin-top: 20px;
    text-align: center;
}

/* Tajmer i Animacija Kafe */
.timer-display {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
}

.timer-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.coffee-animation {
    position: relative;
    display: inline-block;
    text-align: center;
}

.cup-emoji {
    font-size: 3em;
    line-height: 1;
    position: relative;
    z-index: 1;
}

.steam-container {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 2;
}

.steam {
    font-size: 1.2em;
    font-weight: bold;
    color: #a89280;
    opacity: 0;
    display: inline-block;
    animation: riseSteam 2s infinite linear;
}

.steam-1 { animation-delay: 0s; }
.steam-2 { animation-delay: 0.6s; }
.steam-3 { animation-delay: 1.2s; }

@keyframes riseSteam {
    0% { transform: translateY(0) scaleX(1); opacity: 0; }
    30% { opacity: 0.7; }
    80% { opacity: 0.3; }
    100% { transform: translateY(-20px) scaleX(1.5); opacity: 0; }
}
/* Smanjenje fontova i proreda u tooltip (preview) oblačiću */
.tooltip-title {
    font-size: 11px !important; /* Bilo je 13px */
    line-height: 1.1 !important;
    margin-bottom: 3px !important;
}

.tooltip-author {
    font-size: 10px !important; /* Bilo je 11px */
}

/* Opcionalno: smanjenje dimenzija sličice i unutrašnjeg razmaka oblačića */
.book-preview-tooltip {
    width: 180px !important; /* Malo uže, ili ostavi na 200px ako želiš */
    padding: 8px !important;  /* Manji unutrašnji padding */
}

.tooltip-cover {
    width: 75px !important;   /* Manja naslovna slika (bila 90px) */
    height: 110px !important; /* Manja visina slike (bila 130px) */
    margin-bottom: 6px !important;
}


/* ==========================================
   5. WORD OF THE DAY KARTICA
   ========================================== */
.word-of-the-day-card {
    background-color: #fdfbf7;
    border: 1px solid #e2d9cc;
    border-radius: 12px;
    padding: 25px;
    max-width: 450px;
    margin: 20px auto;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    font-family: 'Georgia', serif;
}

.wotd-badge {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #8c6d53;
    font-weight: bold;
    margin-bottom: 10px;
}

.wotd-title {
    font-size: 2rem;
    color: #2c221e;
    margin: 0 0 5px 0;
}

.wotd-meta {
    font-size: 0.9rem;
    color: #7a7067;
    margin-bottom: 15px;
}

.wotd-meaning {
    font-size: 1.05rem;
    line-height: 1.5;
    color: #3b322c;
    margin-bottom: 15px;
}

.wotd-example {
    font-style: italic;
    color: #63584e;
    border-left: 3px solid #8c6d53;
    margin: 0;
    padding-left: 12px;
    font-size: 0.95rem;
}

.audio-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    margin-left: 8px;
    padding: 4px 8px;
    border-radius: 50%;
    transition: transform 0.2s ease, background-color 0.2s ease;
    vertical-align: middle;
}

.audio-btn:hover {
    transform: scale(1.15);
    background-color: #f0eae1;
}

.audio-btn:active {
    transform: scale(0.95);
}


/* ==========================================
   6. KATALOG, KNJIGE I PRETRAGA
   ========================================== */
.popular-books {
    width: 90%;
    margin: 60px auto;
}

.popular-books h2 {
    margin-bottom: 30px;
    text-align: center;
}

.popular-container {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.popular-card {
    width: 220px;
    text-align: center;
    border: 1px solid #dddddd;
    border-radius: 10px;
    padding: 15px;
    background-color: #ffffff;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.popular-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.popular-card img,
.book-image img,
.recommend-book img {
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.popular-card img {
    width: 170px;
    height: 250px;
    object-fit: cover;
}

.popular-card h3 {
    font-size: 18px;
    margin: 15px 0 10px;
}

.popular-card p {
    color: #777777;
}

.books_table {
    margin: 30px auto;
    width: 80%;
}

.books_table th, 
.books_table td {
    text-align: center;
    vertical-align: middle;
}

.knjiga {
    width: 200px;
    height: 200px;
    border: 2px solid #333333;
    margin: 30px;
    vertical-align: top;
}

.book-details,
.author-details {
    display: flex;
    gap: 40px;
    margin-top: 30px;
    align-items: flex-start;
}

.book-image img,
.author-image img {
    border-radius: 10px;
}

.book-text,
.author-text {
    max-width: 600px;
    font-size: 18px;
    line-height: 1.6;
}

.recommendations {
    display: flex;
    gap: 25px;
    margin-top: 30px;
}

.recommend-book {
    text-align: center;
}

.recommend-book img {
    height: 180px;
    width: 120px;
    object-fit: cover;
}

.random-book {
    text-align: center;
    margin: 30px;
}

.random-image {
    width: 220px;
    height: 220px;
    object-fit: cover;
}

.random-button {
    background-color: #c59d5f;
    color: #ffffff;
    border: none;
    padding: 12px 25px;
    border-radius: 30px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.random-button:hover {
    background-color: #a67c3c;
    transform: scale(1.05);
}

/* Pretraga i Filteri */
.search_input,
input[name="search"] {
    width: 350px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 15px;
}

.filter_select {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
}

.pretrazi_dugme {
    background-color: #2c7be5;
    color: #ffffff;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.pretrazi_dugme:hover {
    background-color: #1d5fbf;
}

.reset_button {
    display: inline-block;
    padding: 10px 18px;
    border: 1px solid #2c7be5;
    color: #2c7be5;
    border-radius: 6px;
    text-decoration: none;
}

.reset_button:hover {
    background-color: #2c7be5;
    color: #ffffff;
}

.favorite-btn {
    background-color: #c59d5f;
    color: #ffffff;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
}

.favorite-btn:hover {
    background-color: #a67c3c;
}

.favorite-active,
.favorite-active:hover {
    background-color: #e11d48;
    cursor: default;
    transform: none;
}
/* ==========================================
   DAILY THEME RECOMMENDED BOOKS SECTION
   ========================================== */

.daily-theme-section {
    margin-bottom: 40px;
    padding: 20px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

/* Kada je Manga Tema aktivna, dajemo mu posebnu konturu */
body.theme-manga .daily-theme-section {
    border: 3px solid #000;
    box-shadow: 6px 6px 0px #000;
    background: #fff;
}

body.theme-manga #daily-theme-title {
    font-family: 'Bangers', 'Comic Sans MS', cursive, sans-serif !important;
    letter-spacing: 1.5px;
    color: #ff4757 !important;
    text-transform: uppercase;
}


/* ==========================================
   7. ADMIN FORME
   ========================================== */
.admin-container {
    display: flex;
    gap: 50px;
    align-items: flex-start;
}

.book-form {
    width: 450px;
}

.author-form {
    width: 400px;
}

form button {
    padding: 8px 14px;
    cursor: pointer;
}

/* ==========================================
   8. DARK MODE (TAMNI REŽIM) - Ažurirano za Book / PageFlip
   ========================================== */
.dark-mode-container {
    display: flex;
    justify-content: flex-end;
    padding: 10px 30px;
}

#darkModeBtn {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    background-color: #333333;
    color: #ffffff;
    cursor: pointer;
    font-size: 15px;
    transition: background-color 0.3s ease;
}

#darkModeBtn:hover {
    background-color: #555555;
}

body.dark {
    background-color: #121212;
    color: #e0e0e0;
}

body.dark nav,
body.dark .navbar {
    background-color: #000000;
}

body.dark h1 { color: #90caf9; }
body.dark h2 { color: #eeeeee; }
body.dark a { color: #90caf9; }

body.dark #oMeni { color: #ffcc80; }
body.dark #Hobiji { color: #ce93d8; }
body.dark #OmiljeniSajtovi { color: #b39ddb; }
body.dark #Kontakt { color: #ffd54f; }

body.dark .popular-card,
body.dark .profile-card,
body.dark .dashboard-section,
body.dark .user-profile-banner {
    background-color: #1e1e1e;
    color: #ffffff;
    border-color: #333333;
}

body.dark .popular-card:hover {
    box-shadow: 0 10px 25px rgba(255, 255, 255, 0.1);
}

body.dark input,
body.dark select,
body.dark textarea {
    background-color: #222222;
    color: #ffffff;
    border: 1px solid #555555;
}

body.dark .user-link {
    color: #90caf9;
}

body.dark .user-link:hover {
    color: #00ff99;
}

/* ------------------------------------------
   POPRAVKA ZA PAGEFLIP KNJIGU U DARK MODU
   ------------------------------------------ */
body.dark #flip-book,
body.dark #flip-book .page,
body.dark .stf__wrapper,
body.dark .stf__item {
    background-color: #1a1a1a !important;
    color: #dcdcdc !important;
    border-color: #333333 !important;
}

/* Ako stranice unutra imaju specifične wrapper klase (npr. .page-content) */
body.dark .page *, 
body.dark #flip-book * {
    color: #dcdcdc;
}

/* Da linkovi unutar knjige ostanu lepo vidljivi */
body.dark #flip-book a,
body.dark .page a {
    color: #90caf9 !important;
}

body.dark .page-header,
body.dark .page-footer {
    border-color: #333333 !important;
    color: #aaaaaa !important;
}

body.dark .author-subtitle {
    color: #bbbbbb !important;
}

/* Dark Mode za Word of the Day */
body.dark .word-of-the-day-card {
    background-color: #1e1e1e;
    border-color: #333333;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

body.dark .wotd-badge { color: #c59d5f; }
body.dark .wotd-title { color: #ffffff; }
body.dark .wotd-meta { color: #aaa; }
body.dark .wotd-meaning { color: #dddddd; }
body.dark .wotd-example {
    color: #bbbbbb;
    border-left-color: #c59d5f;
}

body.dark .audio-btn:hover {
    background-color: #333333;
}


/* ==========================================
   9. RESPONSIVE (PRILAGOĐAVANJE TELEFONIMA)
   ========================================== */
@media (max-width: 768px) {
    nav ul {
        flex-direction: column;
        gap: 15px;
    }

    .profile-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .user-profile-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .book-details,
    .author-details,
    .admin-container {
        flex-direction: column;
        gap: 20px;
    }

    .book-form,
    .author-form {
        width: 100%;
    }
}