/*
 * Style sheet for the redesigned Wilanów library catalogue.
 *
 * This file defines the overall look and feel of the new catalogue UI.
 * It uses modern responsive design principles and clear typography to
 * make the catalogue easy to browse on desktops, tablets and phones.
 */

/*--------------------------------------------------------------------
 * Zaktualizowany arkusz stylów dla katalogu bibliotecznego.
 * Dodaje nowoczesną paletę kolorów, responsywny układ z klejącą stopką
 * oraz komponenty kart i zakładek. Ustawienia zmiennych kolorów ułatwiają
 * późniejszą modyfikację wyglądu.
 *-------------------------------------------------------------------*/

/* Kolory bazowe – można je łatwo zmienić, aby dostosować motyw */
:root {
    /*
     * Paleta kolorów inspirowana oryginalnym katalogiem – stonowane beże
     * i ciepłe pomarańcze podkreślają przyjazny, biblioteczny charakter
     * serwisu. Kolory tekstu zostały dobrane tak, aby zapewnić wysoki
     * kontrast i czytelność na jasnym tle.
     */
    --primary: #bf7c2e; /* głęboki odcień pomarańczu/brązu na nagłówki i akcje */
    --primary-light: #d99d56; /* jaśniejszy wariant używany w gradientach */
    --secondary: #e0a96d; /* pastelowy akcent na przyciski i linki */
    --secondary-light: #ebbf96; /* lżejszy odcień akcentu */
    --background: #f9f6f1; /* ciepłe, bardzo jasne tło strony */
    --surface: #ffffff; /* powierzchnie kart i formularzy */
    --text-primary: #3a2e23; /* ciemnobrązowy tekst bazowy */
    --text-secondary: #7a624c; /* jaśniejszy brąz dla tekstu pomocniczego */
    --border-color: #e6ddd2; /* delikatny beż dla obramowań */
    --shadow-color: rgba(0, 0, 0, 0.05); /* subtelniejszy cień kart */
}

/* Reset and base styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    color: var(--text-primary);
    line-height: 1.6;
    background-color: var(--background);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navigation bar */
nav {
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 999;
}

nav .container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

nav .brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: #ffffff;
    text-decoration: none;
}

nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

nav ul li a {
    text-decoration: none;
    color: #ffffff;
    font-weight: 500;
    transition: color 0.2s ease;
}

nav ul li a:hover {
    color: var(--secondary-light);
}

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

/* Button component */
.btn {
    background: linear-gradient(90deg, var(--secondary), var(--secondary-light));
    color: #ffffff;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: inline-block;
    font-weight: 500;
}

.btn:hover {
    background: var(--secondary-light);
}

/* Style buttons with the btn class on form elements */
button.btn,
input.btn {
    background: linear-gradient(90deg, var(--secondary), var(--secondary-light));
    color: #ffffff;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-weight: 500;
}

button.btn:hover,
input.btn:hover {
    background: var(--secondary-light);
}

/* Responsive mobile menu toggle */
.menu-toggle {
    display: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: #333;
}

@media (max-width: 768px) {
    nav ul {
        display: none;
        flex-direction: column;
        width: 100%;
        margin-top: 0.5rem;
    }
    nav ul.show {
        display: flex;
    }
    .menu-toggle {
        display: block;
    }
    nav .actions {
        display: none;
    }
}

/* Hero section */
.hero {
    background: url('hero.png') center/cover no-repeat;
    position: relative;
    min-height: 50vh;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.hero .content {
    position: relative;
    z-index: 1;
    max-width: 800px;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
}

.hero .search-bar {
    max-width: 500px;
    margin: 0 auto;
    display: flex;
}

.hero .search-bar input {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: 4px 0 0 4px;
    outline: none;
}

.hero .search-bar button {
    padding: 0.75rem 1rem;
    border: none;
    background: linear-gradient(90deg, var(--secondary), var(--secondary-light));
    color: #ffffff;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

.hero .search-bar button:hover {
    background: var(--secondary-light);
}

/* Section styles */
.section {
    padding: 3rem 1rem;
    background-color: var(--surface);
    /* Ogranicz szerokość sekcji, aby uniknąć zbyt długich wierszy tekstu. */
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
}

.section.alt {
    background-color: var(--background);
}

.section h2 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2rem;
    color: var(--primary);
}

/* Card layout */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.card {
    background-color: var(--surface);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px var(--shadow-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px var(--shadow-color);
}

.card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
    color: var(--primary);
}

.card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* Table styles for search results */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    overflow-x: auto;
}

/* Table cell styles: apply to both header and data cells */
.table th,
.table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

/* Header cells only */
.table th {
    background-color: var(--background);
    font-weight: 600;
    color: var(--text-primary);
}

.table tr:hover {
    background-color: var(--background);
}

/* Provide a responsive wrapper for tables so they can scroll horizontally on small screens. */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Responsive adjustments for the book details and navigation on small viewports */
@media (max-width: 768px) {
    /* Stack book cover and information vertically on small screens */
    .book-details {
        flex-direction: column;
        align-items: center;
    }
    .book-details .book-cover {
        width: 60%;
        max-width: 250px;
        height: auto;
        margin: 0 auto;
    }
    .book-details .book-info {
        width: 100%;
    }
    /* Expand navigation dropdown to full width and style its items */
    nav ul {
        background-color: var(--primary);
        padding: 1rem 0;
    }
    nav ul li {
        width: 100%;
        text-align: center;
        padding: 0.5rem 0;
    }
    nav ul li a {
        display: block;
    }

    /* Remove max-width constraint and center margin on the nav container to allow the menu to occupy the full viewport width */
    nav .container {
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
}

/* Mobile-friendly table styling: convert rows into card-like blocks */
@media (max-width: 600px) {
    /* Hide table header on small screens */
    .table thead {
        display: none;
    }
    /* Make table elements block-level for stacking */
    .table,
    .table tbody,
    .table tr,
    .table td {
        display: block;
        width: 100%;
    }
    .table tr {
        margin-bottom: 1rem;
        border-bottom: 1px solid var(--border-color);
    }
    .table td {
        text-align: right;
        padding-left: 50%;
        position: relative;
    }
    /* Show the column name before each cell's value */
    .table td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 50%;
        padding-left: 0.75rem;
        font-weight: 600;
        text-align: left;
        color: var(--text-primary);
    }
    /* Constrain images inside responsive table on mobile */
    .table td img {
        max-width: 80px;
        height: auto;
    }
}

/* When the screen is very narrow, display one card per row instead of multiple columns */
@media (max-width: 600px) {
    .cards {
        grid-template-columns: 1fr;
    }
}

/* Book details layout */
.book-details {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    max-width: 1000px;
    margin: 0 auto;
}

/* Status badges and row highlighting
 *
 * W systemie MATEUSZ kolor tła wiersza rezerwacji informuje, na jakim miejscu w
 * kolejce znajduje się użytkownik (różowy – dalsze miejsce w kolejce,
 * żółty – pierwsze miejsce, zielony – pozycja do odbioru). Dodatkowo
 * statusy dostępności w wynikach wyszukiwania i tabelach konta mają własne
 * kolory, które ułatwiają szybkie rozpoznanie czy egzemplarz jest
 * dostępny, wypożyczony lub zarezerwowany.
 */

/* Tło wiersza rezerwacji w zakładce konta */
.reservation-row.waiting {
    background-color: #ffe5e5; /* jasnoróżowy – użytkownik czeka w kolejce */
}

.reservation-row.first {
    background-color: #fff3cd; /* jasny żółty – użytkownik jest pierwszy w kolejce */
}

.reservation-row.available {
    background-color: #e8f5e9; /* jasna zieleń – pozycja do odbioru */
}

/* Tekstowe statusy dostępności w tabelach */
.status-available {
    color: #2e7d32; /* zielony – dostępna pozycja */
    font-weight: 600;
}

.status-unavailable {
    color: #c62828; /* czerwony – wypożyczona lub niedostępna */
    font-weight: 600;
}

.book-details .book-cover {
    width: 200px;
    height: auto;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.book-info {
    flex: 1;
}

.book-info p {
    margin-bottom: 0.5rem;
}

.book-info .description {
    margin-top: 1rem;
}

.actions {
    margin-top: 1rem;
}

.actions .btn {
    margin-right: 0.5rem;
    margin-top: 0.5rem;
}

/* Login form */
/* Nadpisane style formularza logowania i stopki dla spójności motywu */
.login-form {
    max-width: 400px;
    margin: 0 auto;
    padding: 2rem;
    background-color: var(--surface);
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--shadow-color);
}

.login-form h2 {
    margin-bottom: 1rem;
    text-align: center;
    color: var(--primary);
}

.login-form form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-form label {
    font-weight: 500;
}

.login-form input {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.login-form .note {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* Footer (sticky, gradient) */
footer {
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    color: #ffffff;
    text-align: center;
    padding: 1.5rem 1rem;
    margin-top: auto;
}

footer a {
    color: #ffffff;
    text-decoration: underline;
}

/* Panel konta – zakładki i tabele */
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.tabs button {
    background: none;
    border: none;
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-secondary);
    border-bottom: 3px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.tabs button.active {
    color: var(--primary);
    border-color: var(--primary);
    font-weight: 600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Tabele i formularze w panelu konta */
.account-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.account-table th,
.account-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.account-table th {
    background-color: var(--background);
    font-weight: 600;
    color: var(--text-primary);
}

.account-table tr:hover {
    background-color: var(--background);
}

.settings-form {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.settings-form label {
    font-weight: 500;
}

.settings-form input[type="text"],
.settings-form select,
.settings-form input[type="file"] {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.settings-form .note {
    font-size: 0.9rem;
    color: var(--text-secondary);
}