/* Моя бібліотека - Стилі */

/* Скидання стилів та базові налаштування */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --dark-color: #2c3e50;
    --light-color: #ecf0f1;
    --text-color: #34495e;
    --border-color: #bdc3c7;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #f5f7fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    width: 100%;
}

/* Заголовок */
.header {
    background: white;
    box-shadow: var(--shadow);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    color: var(--dark-color);
    font-size: 1.8rem;
}

.header-nav {
    display: flex;
    gap: 1rem;
}

/* Статистика */
.stats-bar {
    background: linear-gradient(135deg, var(--primary-color), #2980b9);
    color: white;
    padding: 1.5rem 0;
}

.stats {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 2rem;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 0.25rem;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: bold;
}

/* Головний контейнер */
.main-container {
    display: flex;
    gap: 2rem;
    padding: 2rem 0;
    flex: 1;
}

/* Бічна панель */
.sidebar {
    width: 280px;
    flex-shrink: 0;
}

.filters {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    position: sticky;
    top: 100px;
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.filters-header h3 {
    margin: 0;
    color: var(--dark-color);
}

.filter-group {
    margin-bottom: 1.5rem;
}

.filter-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.9rem;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.95rem;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.year-range {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.year-range input {
    width: calc(50% - 0.25rem);
}

/* Контент */
.content {
    flex: 1;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.results-info {
    font-size: 1.1rem;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sort-controls label {
    font-weight: 600;
}

.sort-controls select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.95rem;
}

/* Сітка книг */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.book-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.book-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.book-cover {
    display: block;
    position: relative;
    padding-top: 150%;
    overflow: hidden;
    background: #eee;
}

.book-cover img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.book-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    font-weight: bold;
    color: white;
    text-transform: uppercase;
}

.book-status {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: var(--shadow);
}

.status-прочитана {
    background: var(--secondary-color);
    color: white;
}

.status-читаю-зараз {
    background: var(--warning-color);
    color: white;
}

.book-info {
    padding: 1rem;
}

.book-title {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.book-title a {
    color: var(--dark-color);
    text-decoration: none;
}

.book-title a:hover {
    color: var(--primary-color);
}

.book-author {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.book-series {
    color: #95a5a6;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* Рейтинг */
.rating {
    display: flex;
    gap: 2px;
    margin: 0.5rem 0;
}

.star {
    color: #ddd;
    font-size: 1rem;
}

.star.filled {
    color: #f39c12;
}

.rating-large .star {
    font-size: 1.5rem;
}

/* Порожній стан */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.empty-state p {
    font-size: 1.3rem;
    color: #95a5a6;
    margin-bottom: 1.5rem;
}

/* Пагінація */
.pagination {
    margin: 2rem 0;
}

.pagination ul {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    list-style: none;
    flex-wrap: wrap;
}

.pagination li a,
.pagination li span {
    display: block;
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-decoration: none;
    color: var(--text-color);
}

.pagination li a:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination li.active span {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Деталі книги */
.book-detail {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 3rem;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin: 2rem 0;
}

.book-detail-cover img {
    width: 100%;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.book-placeholder-large {
    width: 100%;
    padding-top: 150%;
    position: relative;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.book-placeholder-large span {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 6rem;
    font-weight: bold;
    color: white;
}

.book-detail-info h1 {
    color: var(--dark-color);
    margin-bottom: 1rem;
    font-size: 2rem;
}

.book-author-large {
    font-size: 1.3rem;
    color: #7f8c8d;
    margin-bottom: 1rem;
}

.book-status-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    margin: 1rem 0;
}

.book-description,
.book-notes {
    margin: 2rem 0;
}

.book-description h3,
.book-notes h3 {
    color: var(--dark-color);
    margin-bottom: 1rem;
}

.book-details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 2rem 0;
}

.detail-item {
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 4px;
}

.detail-label {
    display: block;
    font-weight: 600;
    color: #7f8c8d;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.detail-value {
    color: var(--dark-color);
    font-size: 1rem;
}

.book-meta {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: #95a5a6;
}

/* Кнопки */
.btn {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-success {
    background: var(--secondary-color);
    color: white;
}

.btn-success:hover {
    background: #27ae60;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-text {
    background: none;
    border: none;
    color: var(--primary-color);
    padding: 0.25rem 0.5rem;
    font-size: 0.9rem;
}

/* Алерти */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert ul {
    margin: 0.5rem 0 0 1.5rem;
}

/* Форми */
.book-form {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    max-width: 1000px;
    margin: 0 auto;
}

.form-section {
    margin-bottom: 2.5rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--border-color);
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section h3 {
    color: var(--dark-color);
    margin-bottom: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark-color);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

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

.form-group textarea {
    resize: vertical;
}

.form-help {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #7f8c8d;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.current-cover {
    margin-bottom: 1rem;
}

.current-cover img {
    border-radius: 4px;
    box-shadow: var(--shadow);
}

/* Адмін панель */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.admin-search {
    margin-bottom: 2rem;
}

.admin-search form {
    display: flex;
    gap: 1rem;
}

.admin-search input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
}

.table-responsive {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.admin-table thead {
    background: var(--dark-color);
    color: white;
}

.admin-table th,
.admin-table td {
    padding: 1rem;
    text-align: left;
}

.admin-table tbody tr {
    border-bottom: 1px solid var(--border-color);
}

.admin-table tbody tr:hover {
    background: #f8f9fa;
}

.table-thumbnail {
    width: 50px;
    height: 75px;
    border-radius: 4px;
    overflow: hidden;
}

.table-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.actions {
    display: flex;
    gap: 0.5rem;
}

.text-muted {
    color: #95a5a6;
}

/* Сторінка логіну */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color), #2980b9);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

.login-box {
    background: white;
    padding: 2.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.login-box h1 {
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.subtitle {
    text-align: center;
    color: #7f8c8d;
    margin-bottom: 2rem;
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
}

.login-footer a {
    color: var(--primary-color);
    text-decoration: none;
}

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

/* Футер */
.footer {
    background: var(--dark-color);
    color: white;
    padding: 2rem 0;
    text-align: center;
    margin-top: auto;
}

/* Адаптивний дизайн */
@media (max-width: 1200px) {
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

@media (max-width: 992px) {
    .main-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
    }
    
    .filters {
        position: static;
    }
    
    .book-detail {
        grid-template-columns: 1fr;
    }
    
    .book-detail-cover {
        max-width: 350px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    .header h1 {
        font-size: 1.4rem;
    }
    
    .stats {
        gap: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }
    
    .content-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .book-details-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn-danger {
        order: -1;
    }
    
    .admin-search form {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .header-nav {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .book-card {
        font-size: 0.9rem;
    }
}
