/* Base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 1px;
}

.container {
    max-width: 1450px;
    margin: 0 auto;
    padding: 20px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    
}

.container2 {
    max-width: 1450px;
    margin: 0 auto;
    padding: 20px;
    background: #ff00003b;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    
}

/* Responsive Grid */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .book-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .book-grid {
        grid-template-columns: 1fr;
    }
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.stat-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.stat-icon {
    font-size: 2.5rem;
    color: #007bff;
}

.stat-info h3 {
    font-size: 2rem;
    margin: 0;
    color: #333;
}

.stat-info p {
    color: #666;
    margin: 0;
}

/* Charts Row */
.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

@media (max-width: 768px) {
    .charts-row {
        grid-template-columns: 1fr;
    }
}

.chart-container {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.chart-container h3 {
    margin-bottom: 15px;
    color: #333;
}

/* Book Cards */
.book-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.book-card.has-access {
    border-left: 4px solid #28a745;
}

.book-card.no-access {
    border-left: 4px solid #ffc107;
}

.book-icon {
    font-size: 2.5rem;
    color: #007bff;
    margin-bottom: 10px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #f5f7fa;
    border-radius: 8px;
}

.book-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.book-card h4 {
    margin: 10px 0;
    color: #333;
}

.book-card .author {
    color: #666;
    font-style: italic;
}

.book-card .description {
    flex: 1;
    margin: 10px 0;
    color: #555;
    font-size: 0.9em;
}

.book-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0;
    flex-wrap: wrap;
    gap: 5px;
}

.book-meta span {
    font-size: 0.85em;
    color: #666;
}

.badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75em;
    font-weight: bold;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.btn-read, .btn-request {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

/* Inside a book-grid card, push the button to the bottom and make it full width
   so every card in a row lines up evenly regardless of description length */
.book-grid .book-card > .btn-read,
.book-grid .book-card > .btn-request {
    margin-top: auto;
    width: 100%;
}

.btn-read {
    background: #28a745;
    color: #fff;
}

.btn-read:hover {
    background: #218838;
    transform: translateY(-2px);
}

.btn-request {
    background: #ffc107;
    color: #333;
}

.btn-request:hover {
    background: #e0a800;
    transform: translateY(-2px);
}

/* Search Section */
.search-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.search-form {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.search-input-group {
    flex: 1;
    display: flex;
    gap: 0;
}

.search-input-group input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 6px 0 0 6px;
    font-size: 1rem;
}

.search-input-group button {
    padding: 12px 20px;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
}

.filter-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.filter-group select {
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: #fff;
}

@media (max-width: 768px) {
    .search-form {
        flex-direction: column;
    }
    
    .search-input-group {
        width: 100%;
    }
    
    .filter-group {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .filter-group select {
        flex: 1;
    }
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.pagination a {
    padding: 8px 15px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 6px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
}

.pagination a:hover {
    background: #007bff;
    color: #fff;
}

.pagination a.active {
    background: #007bff;
    color: #fff;
}

.pagination a.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Login/Register */
.login-container, .register-container {
    max-width: 450px;
    margin: 50px auto;
    padding: 40px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

@media (max-width: 480px) {
    .login-container, .register-container {
        margin: 20px;
        padding: 20px;
    }
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

table th, table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

table tr:hover {
    background: #f8f9fa;
}

@media (max-width: 768px) {
    table {
        font-size: 0.9rem;
    }
    
    table th, table td {
        padding: 8px;
    }
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #007bff;
    outline: none;
}

/* Buttons */
.btn-primary {
    padding: 12px 25px;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,123,255,0.3);
}

.btn-danger {
    padding: 8px 15px;
    background: #dc3545;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.85rem;
}

/* Small inline action buttons used in admin tables (Approve/Reject/Grant/Edit/Delete/View) */
.btn-approve, .btn-grant, .btn-edit, .btn-delete, .btn-view, .btn-reject {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: none;
    border-radius: 5px;
    font-size: 0.82rem;
    text-decoration: none;
    cursor: pointer;
    margin: 2px;
    transition: all 0.2s ease;
}

.btn-approve { background: #28a745; color: #fff; }
.btn-approve:hover { background: #218838; }

.btn-grant { background: #007bff; color: #fff; }
.btn-grant:hover { background: #0069d9; }

.btn-edit, .btn-view { background: #17a2b8; color: #fff; }
.btn-edit:hover, .btn-view:hover { background: #138496; }

.btn-delete, .btn-reject { background: #dc3545; color: #fff; }
.btn-delete:hover, .btn-reject:hover { background: #c82333; }

.btn-large {
    padding: 15px 30px;
    font-size: 1.1rem;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid;
}

.alert-success {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.alert-error {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.alert-info {
    background: #d1ecf1;
    border-color: #17a2b8;
    color: #0c5460;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 50px 20px;
    color: #666;
}

.no-results i {
    font-size: 4rem;
    color: #ddd;
    margin-bottom: 20px;
}

/* Book stats header row (e.g. "Total Books: X" + "Browse More Books" button) */
.book-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin: 15px 0 5px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.book-stats p {
    margin: 0;
    font-size: 1.05rem;
    color: #444;
    font-weight: 600;
}

/* Reading progress bar (used on My Books) */
.progress-container {
    width: 100%;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 5px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
    border-radius: 10px;
    transition: width 0.3s ease;
}

/* Responsive Utilities */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    h1, h2, h3 {
        font-size: 1.3rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-icon {
        font-size: 1.8rem;
    }
    
    .stat-info h3 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .pagination a {
        padding: 6px 12px;
        font-size: 0.9rem;
    }

    .book-stats {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .book-stats .btn-primary {
        width: 100%;
    }
}

/* Print Disable */
@media print {
    .disable-print {
        display: none !important;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.container {
    animation: fadeIn 0.5s ease;
}