/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --background-color: #f5f6fa;
    --card-background: #ffffff;
    --text-color: #2c3e50;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --hover-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
    --border-radius: 12px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
header {
    background: linear-gradient(135deg, var(--primary-color), #34495e);
    color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.header-top {
    background: rgba(0, 0, 0, 0.2);
    padding: 10px 20px;
    text-align: center;
}

.ad-space {
    background: linear-gradient(45deg, #f39c12, #e67e22);
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    display: inline-block;
    font-weight: bold;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    flex-wrap: wrap;
}

.logo h1 {
    font-size: 2em;
    margin-bottom: 5px;
}

.logo h1 i {
    color: #f39c12;
    margin-right: 10px;
}

.logo p {
    font-size: 0.9em;
    opacity: 0.8;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 20px;
}

nav ul li a {
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 25px;
    transition: all 0.3s ease;
    font-weight: 500;
}

nav ul li a:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

nav ul li a i {
    margin-right: 8px;
}

.search-bar {
    background: white;
    padding: 20px 40px;
    display: flex;
    justify-content: center;
}

.search-bar form {
    width: 100%;
    max-width: 600px;
    display: flex;
    gap: 10px;
}

.search-bar input[type="text"] {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #ddd;
    border-radius: 30px;
    font-size: 1em;
    transition: all 0.3s ease;
    outline: none;
}

.search-bar input[type="text"]:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3);
}

.search-bar button {
    padding: 12px 30px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1em;
}

.search-bar button:hover {
    background: #2980b9;
    transform: scale(1.05);
}

/* Main Content */
main {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 40px;
    width: 100%;
}

/* Breadcrumb */
.breadcrumb {
    background: white;
    padding: 15px 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.breadcrumb a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

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

/* Stats */
.stats {
    background: white;
    padding: 15px 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    display: inline-block;
}

.stats i {
    color: var(--secondary-color);
    margin-right: 10px;
}

/* Books Grid */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.book-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

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

.book-card-header {
    background: linear-gradient(135deg, var(--secondary-color), #2980b9);
    padding: 20px;
    color: white;
}

.book-card-header h3 {
    font-size: 1.2em;
}

.book-title-link {
    color: white;
    text-decoration: none;
    transition: color 0.3s ease;
}

.book-title-link:hover {
    color: #f1c40f;
    text-decoration: underline;
}

.book-card-body {
    padding: 20px;
    flex: 1;
}

.book-card-body p {
    margin: 8px 0;
    font-size: 0.95em;
}

.book-card-body i {
    color: var(--secondary-color);
    width: 20px;
}

.author-link {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.author-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.book-card-footer {
    padding: 15px 20px;
    background: #f8f9fa;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    border-top: 1px solid #eee;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 25px;
    text-decoration: none;
    color: white;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 0.95em;
}

.btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

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

.btn-secondary {
    background: #95a5a6;
}

.btn-gutenberg {
    background: #6c5ce7;
}

.btn-archive {
    background: #e17055;
}

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

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

.btn-large {
    padding: 15px 30px;
    font-size: 1.1em;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85em;
}

/* Book Detail Page */
.book-detail {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-top: 20px;
}

.book-detail-header {
    background: linear-gradient(135deg, var(--primary-color), #34495e);
    padding: 30px;
    color: white;
}

.book-detail-header h2 {
    font-size: 2em;
}

.book-detail-body {
    padding: 30px;
}

.book-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.book-info p {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.book-description {
    background: #f8f9fa;
    padding: 20px;
    border-radius: var(--border-radius);
    margin: 20px 0;
    border-left: 4px solid var(--secondary-color);
}

.book-description h4 {
    color: var(--secondary-color);
    margin-bottom: 10px;
}

.book-links {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin: 25px 0;
}

.library-info {
    margin: 20px 0;
}

.alert {
    padding: 15px 20px;
    border-radius: var(--border-radius);
    margin: 10px 0;
}

.alert-info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

.alert-library {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border: 2px solid #f39c12;
    color: #856404;
    font-weight: 500;
}

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

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

.book-detail-footer {
    padding: 20px 30px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 30px;
    padding: 20px;
}

.page-info {
    background: white;
    padding: 8px 20px;
    border-radius: 20px;
    box-shadow: var(--shadow);
}

/* No Books */
.no-books {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.no-books i {
    color: #bdc3c7;
    margin-bottom: 20px;
}

.no-books p {
    font-size: 1.2em;
    margin-bottom: 20px;
    color: #7f8c8d;
}

/* Admin Styles */
.admin-login {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--hover-shadow);
    width: 100%;
    max-width: 400px;
}

.login-box h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary-color);
}

.admin-dashboard {
    background: white;
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.admin-dashboard h2 {
    color: var(--primary-color);
    margin-bottom: 30px;
    border-bottom: 3px solid var(--secondary-color);
    padding-bottom: 15px;
}

.admin-section {
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: var(--border-radius);
}

.admin-section h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
}

.admin-form .form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-weight: 600;
    color: #555;
}

.form-group input {
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    transition: border-color 0.3s ease;
    font-size: 1em;
}

.form-group input:focus {
    border-color: var(--secondary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3);
}

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

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

.admin-table th,
.admin-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

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

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

/* Footer */
footer {
    background: linear-gradient(135deg, var(--primary-color), #1a252f);
    color: white;
    margin-top: 40px;
}

.footer-ad {
    background: rgba(243, 156, 18, 0.2);
    text-align: center;
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-ad span {
    background: linear-gradient(45deg, #f39c12, #e67e22);
    padding: 8px 25px;
    border-radius: 20px;
    display: inline-block;
    font-weight: bold;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.footer-section h4 {
    margin-bottom: 15px;
    color: #f39c12;
}

.footer-section p {
    opacity: 0.8;
    margin: 8px 0;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin: 8px 0;
}

.footer-section ul li a {
    color: #ecf0f1;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section ul li a:hover {
    color: #f39c12;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    text-align: center;
    opacity: 0.8;
    font-size: 0.9em;
}

.footer-bottom p:last-child {
    color: #f39c12;
    font-weight: 500;
    margin-top: 5px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-main {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }
    
    .logo {
        margin-bottom: 15px;
    }
    
    nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .search-bar {
        padding: 15px;
    }
    
    .search-bar form {
        flex-direction: column;
    }
    
    main {
        padding: 15px;
    }
    
    .books-grid {
        grid-template-columns: 1fr;
    }
    
    .book-info {
        grid-template-columns: 1fr;
    }
    
    .book-links {
        flex-direction: column;
    }
    
    .admin-form .form-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        padding: 20px;
    }
    
    .pagination {
        flex-wrap: wrap;
    }
}