/* --- 1. IMPORT FONTŮ A PROMĚNNÉ --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600&family=Poppins:wght@600;700&display=swap');

:root {
    /* Barevná paleta - Profesionální & Hravá */
    --primary-color: #4a90e2;       /* Moderní modrá */
    --primary-hover: #357abd;
    --secondary-color: #2ecc71;     /* Svěží zelená pro nákup */
    --accent-color: #f39c12;        /* Oranžová pro akce */
    --dark-bg: #2c3e50;             /* Tmavá pro navbar */
    --light-bg: #f4f6f9;            /* Jemně šedé pozadí webu */
    --text-main: #2d3436;
    --text-muted: #636e72;
    --white: #ffffff;
    --radius: 12px;                 /* Jednotné zaoblení rohů */
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.08);
    --shadow-hover: 0 12px 30px rgba(0,0,0,0.12);
	--dark: #2D3436;
}


/* --- 2. ZÁKLADNÍ RESET --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--light-bg);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased; /* Hezčí písmo na Macu/iPhone */
}

h1, h2, h3, .logo, .price {
    font-family: 'Poppins', sans-serif; /* Jiný font pro nadpisy */
}

/* --- 3. NAVBAR (Moderní Glassmorphism) --- */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    background: rgba(44, 62, 80, 0.95); /* Průhlednost */
    backdrop-filter: blur(10px);        /* Rozmazání pozadí za navbarem (Apple styl) */
    color: white;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.logo {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--white);
    letter-spacing: -0.5px;
}

.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 25px;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.nav-links a:hover {
    color: var(--white);
    transform: translateY(-2px);
}

.login-btn {
    background: var(--primary-color);
    color: white !important;
    padding: 10px 24px;
    border-radius: 50px;
    font-weight: 600 !important;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
    transition: all 0.3s ease;
}

.login-btn:hover {
    background: var(--primary-hover);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.5);
    transform: translateY(-2px);
}

/* --- 4. GRID SYSTÉM A KARTY --- */
.container {
    max-width: 1400px;
    margin: 40px auto; /* Větší odsazení shora */
    padding: 0 20px;
}

.book-grid {
    display: grid;
    gap: 30px;
    grid-template-columns: 1fr; /* Mobil: 1 sloupec */
}

/* Tablet */
@media (min-width: 768px) {
    .book-grid { grid-template-columns: repeat(3, 1fr); }
}

/* PC */
@media (min-width: 1200px) {
    .book-grid { grid-template-columns: repeat(6, 1fr); }
}

/* Karta knihy - Moderní vzhled */
.book-card {
    background: var(--white);
    border: none; /* Žádné rámečky, jen stíny */
    border-radius: var(--radius);
    padding: 15px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.book-card:hover {
    transform: translateY(-8px); /* Karta "vyskočí" nahoru */
    box-shadow: var(--shadow-hover);
}

.book-card img {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    border-radius: 8px;
    background: #eee;
    margin-bottom: 12px;
}

.book-card h3 {
    margin: 5px 0;
    font-size: 1.1rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    height: 42px;
    overflow: hidden;
    margin-bottom: 15px;
    line-height: 1.4;
}

.price {
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

/* Tlačítko Koupit / Získat zdarma */
.buy-btn {
    background: linear-gradient(135deg, #2ecc71, #27ae60); /* Jemný gradient */
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    width: 100%;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    transition: filter 0.3s, transform 0.2s;
    text-align: center;
    text-decoration: none;
    display: block;
}

.buy-btn:hover {
    filter: brightness(110%);
}

.buy-btn:active {
    transform: scale(0.98);
}

/* --- 5. NÁHRADNÍ OBÁLKA (Placeholder) --- */
.book-cover-wrapper {
    width: 100%;
    aspect-ratio: 2/3;
    background: #dfe6e9;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    margin-bottom: 12px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.05); /* Vnitřní stín pro hloubku */
}

.no-cover {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 15px;
    background: linear-gradient(135deg, #74b9ff, #0984e3); /* Modrý gradient */
    color: white;
    width: 100%;
    height: 100%;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.no-cover::before {
    content: "📚";
    font-size: 3.5rem;
    margin-bottom: 15px;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2));
}

/* --- 6. FORMULÁŘE (Login & Upload) --- */
.form-container {
    max-width: 500px;
    margin: 60px auto;
    background: var(--white);
    padding: 40px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
}

.form-container h2 {
    margin-bottom: 30px;
    text-align: center;
    color: var(--dark-bg);
    font-size: 1.8rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 14px;
    border: 2px solid #edf2f7;
    border-radius: 10px;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.3s;
    background: #fcfcfc;
}

.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
}

.submit-btn {
    width: 100%;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 15px;
    transition: background 0.3s, transform 0.2s;
}

.submit-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

/* --- 7. SEKCE STAŽENO (Seznam) --- */
.download-item {
    display: flex;
    align-items: center;
    background: var(--white);
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 12px;
    gap: 25px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s;
}

.download-item:hover {
    transform: translateX(5px);
}

.download-item img, .download-item .no-cover {
    width: 70px;
    height: 100px;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.download-item strong {
    font-size: 1.2rem;
    display: block;
    margin-bottom: 5px;
}

.read-btn {
    margin-left: auto;
    background: var(--accent-color);
    color: white;
    padding: 10px 25px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(243, 156, 18, 0.3);
    transition: all 0.2s;
}

.read-btn:hover {
    background: #e67e22;
    transform: scale(1.05);
}

/* --- 8. ČTEČKA (Reader - App Mode) --- */
.reader-body {
    background-color: #121212; /* Hluboká černá pro OLED displeje */
    color: #ecf0f1;
    margin: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.reader-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    background: rgba(30, 30, 30, 0.9);
    backdrop-filter: blur(5px);
    z-index: 10;
    border-bottom: 1px solid #333;
}

.btn-lang {
    background: #333;
    color: #bbb;
    border: 1px solid #444;
    padding: 8px 18px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.btn-lang:hover { background: #444; color: white; }

.btn-lang.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(74, 144, 226, 0.4);
}

.btn-close {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    text-decoration: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-close:hover {
    background: #e74c3c;
    color: white;
}

.reader-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.reader-image-container {
    max-width: 100%;
    max-height: 65vh;
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.reader-image-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6); /* Silný stín pro "pop" efekt */
}

.reader-text {
    max-width: 700px;
    font-size: 1.3rem;
    text-align: center;
    line-height: 1.6;
    background: rgba(255, 255, 255, 0.08); /* Skleněný efekt */
    padding: 25px;
    border-radius: 16px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.05);
}

.reader-controls {
    display: flex;
    justify-content: center;
    gap: 30px;
    align-items: center;
    padding: 25px;
    background: rgba(30, 30, 30, 0.95);
    border-top: 1px solid #333;
}

.btn-nav {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 14px 35px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    min-width: 130px;
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-nav:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 204, 113, 0.5);
}

.btn-nav:disabled {
    background: #444;
    color: #777;
    box-shadow: none;
    cursor: default;
    transform: none;
}

.page-info {
    font-size: 1.1rem;
    font-weight: 600;
    color: #888;
    min-width: 80px;
    text-align: center;
}

/* Mobilní úpravy pro čtečku */
@media (max-width: 600px) {
    .reader-text {
        font-size: 1.1rem;
        padding: 15px;
    }
    .btn-nav {
        padding: 12px 20px;
        min-width: auto;
        font-size: 1rem;
    }
    .reader-controls {
        gap: 15px;
    }
}

/* --- MOBILNÍ OPTIMALIZACE (PWA Mód) --- */

/* Globální nastavení pro dotykové obrazovky */
* {
    /* Zakáže označování textu (aby to nepůsobilo jako web, ale jako appka) */
    -webkit-tap-highlight-color: transparent; 
    user-select: none;
}

/* Povolit označování jen ve formulářích, aby šlo psát */
input, textarea {
    user-select: text;
}

@media (max-width: 768px) {
    
    /* 1. NAVBAR PŘESUNUTÝ DOLŮ (Jako v aplikacích) */
    .navbar {
        position: fixed;
        bottom: 0;
        top: auto;
        left: 0;
        width: 100%;
        height: 70px; /* Pevná výška */
        justify-content: space-around; /* Rozmístění ikon rovnoměrně */
        padding: 0;
        border-bottom: none;
        border-top: 3px solid #eee;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        box-shadow: 0 -5px 20px rgba(0,0,0,0.05);
    }

    /* Skryjeme logo na mobilu, zabírá místo */
    .logo {
        display: none;
    }

    /* Úprava odkazů v menu na ikonky */
    .nav-links {
        width: 100%;
        justify-content: space-around;
        gap: 0;
        padding: 0;
        margin: 0;
    }

    .nav-links li {
        flex: 1; /* Každá ikona má stejně místa */
        display: flex;
        justify-content: center;
    }

    .nav-links a {
        display: flex;
        flex-direction: column;
        align-items: center;
        font-size: 0.7rem; /* Menší text pod ikonou */
        padding: 5px;
        background: transparent !important; /* Zrušíme pozadí při hoveru */
        color: var(--dark);
        transform: none !important; /* Zrušíme zvětšování */
        gap: 5px;
    }

    /* Zvětšíme emoji, aby vypadaly jako ikony */
    .nav-links a::before {
        font-size: 1.5rem;
        display: block;
        margin-bottom: 2px;
    }
    
    /* Trik: Emoji definujeme v CSS, aby se daly stylovat */
    /* Domů */
    .nav-links li:nth-child(1) a { font-size: 0; } /* Skryje text odkazu v HTML */
    .nav-links li:nth-child(1) a::after { content: "Domů"; font-size: 0.7rem; font-weight: 700; }
    .nav-links li:nth-child(1) a::before { content: "🏠"; }

    /* Batůžek */
    .nav-links li:nth-child(2) a { font-size: 0; }
    .nav-links li:nth-child(2) a::after { content: "Batůžek"; font-size: 0.7rem; font-weight: 700; }
    .nav-links li:nth-child(2) a::before { content: "🎒"; }

    /* Login / Odhlásit */
    .nav-links li:last-child a { font-size: 0; }
    .nav-links li:last-child a::after { content: "Profil"; font-size: 0.7rem; font-weight: 700; }
    .nav-links li:last-child a::before { content: "👤"; }

    .login-btn {
        box-shadow: none !important;
        color: var(--dark) !important;
        background: transparent !important;
    }

    /* 2. ÚPRAVA OBSAHU ABY NEBYL POD MENU */
    body {
        padding-bottom: 90px; /* Místo pro dolní menu */
    }

    .container {
        margin: 20px auto;
        padding: 0 15px;
    }

    /* 3. KARTY KNIH NA MOBILU */
    .book-grid {
        grid-template-columns: 1fr; /* Jedna kniha na řádek */
        gap: 20px;
    }

    .book-card {
        flex-direction: row; /* Obrázek vlevo, text vpravo */
        align-items: center;
        padding: 10px;
    }

    .book-cover-wrapper {
        width: 100px; /* Menší obrázek */
        margin-bottom: 0;
        margin-right: 15px;
        flex-shrink: 0;
    }

    .book-card div {
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    .book-card h3 {
        font-size: 1.1rem;
    }

    .book-card p {
        display: none; /* Popis na mobilu skryjeme pro úsporu místa */
    }

    .buy-btn {
        padding: 8px;
        font-size: 1rem;
        margin-top: 5px;
    }

    /* 4. ČTEČKA NA CELÝ DISPLEJ */
    .reader-body {
        position: fixed;
        width: 100%;
        height: 100%;
        z-index: 2000;
    }

    .reader-nav {
        padding: 10px;
    }
    
    .reader-image-container {
        max-height: 50vh; /* Obrázek max půlka displeje */
    }
    
    .reader-text {
        font-size: 1.1rem;
        padding: 15px;
        margin-top: 10px;
    }
    
    .btn-nav {
        padding: 10px 20px;
        font-size: 1rem;
    }
}

.book-info-content {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.book-card h3 {
    margin: 5px 0;
    font-size: 1.2rem;
    color: var(--dark);
}

/* --- MOBILNÍ OPTIMALIZACE --- */
@media (max-width: 768px) {
    
    /* 1. NAVBAR DOLE */
    .navbar {
        position: fixed;
        bottom: 0;
        top: auto;
        left: 0;
        width: 100%;
        height: 70px;
        justify-content: space-around;
        padding: 0;
        border-top: 1px solid #ddd;
        background: rgba(255, 255, 255, 0.98);
        box-shadow: 0 -5px 20px rgba(0,0,0,0.05);
    }

    .logo { display: none; }

    .nav-links {
        width: 100%;
        justify-content: space-around;
        gap: 0;
        padding: 0;
        margin: 0;
    }

    .nav-links li { flex: 1; display: flex; justify-content: center; }

    .nav-links a {
        display: flex;
        flex-direction: column;
        align-items: center;
        font-size: 0.75rem;
        padding: 8px;
        color: var(--dark);
        background: transparent !important;
        transform: none !important;
    }

    /* 2. KARTY KNIH - ABY BYLO VIDĚT TLAČÍTKO */
    .book-grid {
        grid-template-columns: 1fr; /* Jeden sloupec */
        padding-bottom: 80px; /* Místo dole, aby navbar nezakrýval poslední knihu */
    }

    .book-card {
        flex-direction: column !important; /* Důležité: Obrázek nahoře, text dole */
        height: auto !important;           /* Karta se natáhne podle obsahu */
        padding: 15px;
        align-items: stretch;              /* Roztáhnout na šířku */
    }

    .book-cover-wrapper {
        width: 100% !important;
        height: 250px;                     /* Pevná výška pro obrázek/modrou kartu */
        margin-bottom: 15px;
        margin-right: 0;
    }

    .book-info-content {
        padding: 0;
        text-align: center;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    /* 3. TLAČÍTKO - VYNUTIT ZOBRAZENÍ */
    .buy-btn {
        display: block !important;
        background: #f39c12; /* Oranžová */
        color: white;
        padding: 12px;
        border-radius: 8px;
        margin-top: 10px;
        width: 100%;
        text-align: center;
    }
    
    /* Skryjeme popis na mobilu, pokud je moc dlouhý */
    .book-card p {
        display: none; 
    }
}
.delete-btn {
    display: block;
    margin-top: 15px;
    color: #e74c3c;
    background: #fff;
    text-align: center;
    text-decoration: none;
    padding: 10px;
    border: 2px solid #fadbd8;
    border-radius: 10px;
    font-weight: bold;
}