/* ===== BASE STYLES (style.css) ===== */
.page {
  max-width: 90ch;
  margin: 0 auto;
  padding: 1rem;
}

.site-header {
  background-color: #fff;
  border-bottom: 1px solid #ddd;
  width: 100%;
}

.nav {
  display: flex;
  gap: 1.25rem;
  padding: 1rem;
  width: 100%;
  justify-content: flex-start;
  align-items: center;
}

.nav a {
  font-family: system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 20px;
  font-weight: 600;
  text-decoration: none;
  color: #000000;
  transition: transform 0.15s ease;
}

@media (hover: hover) {
  .nav a:hover {
    transform: scale(1.08);
  }
}

.site-footer {
  border-top: 1px solid #ddd;
  margin-top: 4rem;
  width: 100%;
  background-color: #fff4c3;
}

.footer-inner {
  max-width: 65ch;
  margin: 0 auto;
  padding: 2rem 1rem;
  text-align: center;
  font-size: 0.875rem;
  color: #666;
}

.footer-nav {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 1rem 0;
}

.footer-nav a {
  text-decoration: none;
  color: inherit;
  font-weight: 500;
}

.footer-nav a:hover {
  text-decoration: underline;
}

.kontaktno-okno {
  margin-top: 2rem;
  padding: 1.5rem;
  border-radius: 12px;
  background-color: #d2d2d2;
  border: 1px solid #000000;
  max-width: 40ch;
  margin: 2rem auto 0;
}

.kontakt-text {
  text-align: center
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  align-items: center;
}

* {
  box-sizing: border-box;
}

.browse-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #2c3e50;
    color: white;
    padding: 3rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 2.5rem;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.browse-card:hover {
    transform: translateY(-15px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.25);
}

.browse-card h2 {
    font-size: 2rem;
    margin: 0 0 0.5rem 0;
    font-weight: 700;
}

.browse-card p {
    font-size: 1.1rem;
    margin: 0 0 1.5rem 0;
    opacity: 0.9;
    max-width: 600px;
}

.browse-btn {
    display: inline-block;
    background-color: #ffffff;
    color: #2c3e50;
    padding: 12px 32px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.browse-btn:hover {
    background-color: #f0f0f0;
    color: #1a252f;
}

/* ===== BOOK CARDS (UI1.css) ===== */
.book-card {
  display: flex;
  align-items: stretch;
  height: 180px;
  width: 120px;
  flex-shrink: 0;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.book-card img {
  width: 120px;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  z-index: 1;
}

/* Renamed from .book-info to avoid conflict */
.library-book-info {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.95);
  border-radius: 6px;
  padding: 0.75rem;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
  display: flex;
  flex-direction: column;
  justify-content: center;
  z-index: 2;
  overflow: hidden;
}

.library-book-info h3 {
  font-size: 0.9rem;
  margin: 0 0 0.25rem 0;
  font-weight: 700;
}

.library-book-info .author {
  font-size: 0.75rem;
  color: #666;
  margin: 0 0 0.5rem 0;
  font-style: italic;
}

.library-book-info .summary {
  font-size: 0.75rem;
  line-height: 1.4;
  color: #333;
  margin: 0;
}

@media (hover: hover) {
  .book-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
  }
  .book-card:hover .library-book-info {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
}

.book-link {
  text-decoration: none;
  color: inherit;
  display: inline-block;
  cursor: pointer;
}

.book-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.search-container {
  display: flex;
  justify-content: center;
  margin: 20px 0;
}

#search-bar {
  width: 60%;
  max-width: 600px;
  padding: 15px 20px;
  font-size: 18px;
  border: 2px solid #ccc;
  border-radius: 25px;
  outline: none;
  transition: 0.3s;
}

#search-bar:focus {
  border-color: #007bff;
  box-shadow: 0 0 8px rgba(0, 123, 255, 0.3);
}

.section-hint {
  font-size: 0.9rem;
  color: #000000;
  margin-top: -0.25rem;
  margin-bottom: 1rem;
}

/* ===== BOOK DETAIL (UI2.css) ===== */
.book-detail {
  display: flex;
  gap: 2rem;
  max-width: 900px;
  margin: 2rem auto;
  padding: 1rem;
  align-items: flex-start;
}

.book-cover {
  width: 220px;
  height: auto;
  border-radius: 6px;
  border: 1px solid #ccc;
  flex-shrink: 0;
}

/* Renamed to avoid generic button conflict */
.detail-book-info {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Scoped button styles */
.action-button {
    font-size: 1.2rem;
    padding: 15px 25px;
    margin: 10px 0;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
    width: 100%;
    max-width: 300px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.send-kindle {
    background-color: #4CAF50;
    color: white;
}

.send-kindle:hover {
    background-color: #45a049;
    transform: scale(1.05);
}

.download-usb {
    background-color: #2196F3;
    color: white;
}

.download-usb:hover {
    background-color: #1976d2;
    transform: scale(1.05);
}

.read-online {
    background-color: #667eea;
    color: white;
}

.read-online:hover {
    background-color: #764ba2;
    transform: scale(1.05);
}

button[onclick^="history.back"] {
    font-size: 0.9rem;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    background-color: #f2f2f2;
    color: #333;
    cursor: pointer;
    position: fixed;
    top: 80px;
    left: 20px;
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    width: auto;
}

button[onclick^="history.back"]:hover {
    background-color: #e0e0e0;
    transform: scale(1.05);
}

/* ===== ABOUT PAGE (o_nas.css) ===== */
.about-section,
.goals-section,
.contact-section {
    margin-bottom: 3rem;
}

.about-section h1,
.goals-section h2,
.contact-section h2 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.about-section p,
.contact-section p {
    line-height: 1.6;
    color: #333;
}

.goals-section ul {
    list-style-type: disc;
    padding-left: 1.5rem;
    line-height: 1.6;
}

.goals-section li {
    margin-bottom: 0.5rem;
}

.contact-section a {
    color: #000;
    text-decoration: underline;
    font-weight: 500;
}

.contact-section a:hover {
    color: #666;
}

/* ===== READER (reader.css) ===== */
#reader-header {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 2000; /* Above iframe */
    background-color: #fff;
    border-bottom: 1px solid #ddd;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

#reader-header.active {
    display: block;
}

/* Reader Iframe (Full Screen Below Header) */
#reader {
    display: none; /* Hidden by default */
    position: fixed;
    top: 60px; /* Height of header */
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: calc(100vh - 60px);
    border: none;
    background-color: #f5f5f5;
    z-index: 1000;
}

/* Reader Wrapper (Container for loading spinner) */
.reader-wrapper {
    position: relative;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    /* Padding top not needed since iframe is fixed */
}

/* Loading Spinner */
.reader-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #666;
    font-size: 1.1rem;
    display: none;
    z-index: 1500; /* Above iframe */
    background: rgba(255,255,255,0.9);
    padding: 20px;
    border-radius: 8px;
}

.reader-loading.active {
    display: block;
}

/* Hiding Page Content (Handled by JS, but CSS backup) */
.book-detail.hidden,
header.hidden,
footer.hidden {
    display: none !important;
}
/* ===== MOBILE RESPONSIVE (Max-width 768px) ===== */

@media (max-width: 768px) {
    /* --- Navigation --- */
    .nav {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.75rem;
        justify-content: center;
    }

    .nav a {
        font-size: 0.9rem;
        padding: 4px 8px;
    }

    /* --- Footer --- */
    .footer-nav {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .footer-nav a {
        font-size: 0.8rem;
    }

    /* --- Book Cards (Library & Home) --- */
    .book-row {
        gap: 15px;
        justify-content: center;
    }

    .book-card {
        width: 100%;
        max-width: 160px;
        height: auto;
        flex-direction: column;
        border: 1px solid #eee;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.05);
        transition: transform 0.2s ease;
    }

    .book-card img {
        width: 100%;
        height: 220px; 
        object-fit: contain; 
        object-position: center;
        border-radius: 8px 8px 0 0;
        background-color: #f0f0f0; 
        flex-shrink: 0;
    }

    .library-book-info {
        position: relative;
        width: 100%;
        height: auto;
        background-color: #fff;
        border-radius: 0 0 8px 8px;
        padding: 1rem;
        opacity: 1;
        visibility: visible;
        transform: none;
        border: none;
        box-shadow: none;
        justify-content: flex-start;
    }

    .library-book-info h3 {
        font-size: 1rem;
        margin: 0 0 0.3rem 0;
        line-height: 1.2;
    }

    .library-book-info .author {
        font-size: 0.85rem;
        color: #555;
        margin: 0 0 0.5rem 0;
        font-weight: 600;
    }

    .library-book-info .summary {
        display: block; /* Changed from 'none' to 'block' */
        font-size: 0.85rem; /* Optional: slightly larger for readability */
        color: #555;
        margin: 0.25rem 0 0 0;
        font-weight: 500;
    }

    .book-card:active {
        transform: scale(0.98);
    }

    /* --- Search Bar --- */
    #search-bar {
        width: 90%;
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px 16px;
    }

    /* --- Buttons (General & Action) --- */
    button, .browse-btn, .action-button {
        font-size: 1rem;
        padding: 12px 20px;
        width: 100%;
        max-width: 100%;
        margin: 8px 0;
    }

    /* --- Book Detail Page --- */
    .book-detail {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1.5rem;
        padding: 1rem;
    }

    .book-cover {
        width: 180px;
        margin: 0 auto;
    }

    .book-info {
        width: 100%;
    }

    /* --- Reader Mode (Mobile) --- */
    #reader-header {
        padding: 0.5rem 1rem;
        position: fixed;
        top: 0;
        width: 100%;
        z-index: 2000;
    }

    .nav {
        padding: 0.5rem;
        justify-content: space-between; /* Spread links out */
    }

    .nav a {
        font-size: 0.85rem;
        white-space: nowrap;
    }

    #reader {
        top: 50px; /* Adjust for smaller header */
        height: calc(100vh - 50px);
        border-radius: 0;
    }

    .reader-loading {
        top: 50%;
        left: 50%;
        font-size: 1rem;
        padding: 15px;
    }

    /* --- Browse Card --- */
    .browse-card {
        padding: 2rem 1rem;
        margin-bottom: 1.5rem;
    }

    .browse-card h2 {
        font-size: 1.5rem;
    }

    .browse-card p {
        font-size: 1rem;
    }
}