* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --yellow: #FFD700;
    --yellow-light: #FFEB3B;
    --yellow-dark: #FFC700;
    --black: #1a1a1a;
    --black-light: #2d2d2d;
    --white: #ffffff;
    --gray: #f5f5f5;
    --shadow: rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--black) 0%, var(--black-light) 50%, var(--yellow-dark) 100%);
    min-height: 100vh;
    color: var(--black);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: linear-gradient(90deg, var(--black), var(--black-light));
    padding: 20px 0;
    box-shadow: 0 2px 10px var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    color: var(--yellow);
    font-size: 28px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.search-container {
    flex: 1;
    max-width: 600px;
}

.search-input {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid var(--yellow);
    border-radius: 25px;
    font-size: 16px;
    background: var(--white);
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--yellow-light);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

/* Main Content */
.main-content {
    padding: 40px 0;
}

.main-content .container {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 30px;
}

/* Sidebar */
.sidebar {
    background: linear-gradient(180deg, var(--white), var(--gray));
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 4px 15px var(--shadow);
    height: fit-content;
    position: sticky;
    top: 100px;
}

.sidebar h3 {
    color: var(--black);
    margin-bottom: 20px;
    font-size: 20px;
    border-bottom: 3px solid var(--yellow);
    padding-bottom: 10px;
}

.category-filters {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.category-btn {
    padding: 12px 20px;
    border: 2px solid var(--yellow);
    background: var(--white);
    color: var(--black);
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-align: left;
}

.category-btn:hover {
    background: linear-gradient(135deg, var(--yellow), var(--yellow-light));
    transform: translateX(5px);
    box-shadow: 0 3px 10px rgba(255, 215, 0, 0.3);
}

.category-btn.active {
    background: linear-gradient(135deg, var(--yellow-dark), var(--yellow));
    color: var(--black);
    font-weight: bold;
}

/* Book Grid */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

.book-card {
    background: var(--white);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px var(--shadow);
    transition: all 0.3s ease;
    cursor: pointer;
}

.book-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.4);
}

.book-cover {
    width: 100%;
    height: 350px;
    object-fit: cover;
    border-bottom: 4px solid var(--yellow);
}

.book-info {
    padding: 20px;
}

.book-title {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 8px;
    color: var(--black);
}

.book-author {
    color: #666;
    font-size: 14px;
    margin-bottom: 12px;
}

.book-description {
    color: #555;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
}

.book-price {
    font-size: 24px;
    font-weight: bold;
    background: linear-gradient(135deg, var(--yellow-dark), var(--yellow));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.btn-view {
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--black), var(--black-light));
    color: var(--yellow);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.btn-view:hover {
    background: linear-gradient(135deg, var(--yellow), var(--yellow-light));
    color: var(--black);
    transform: scale(1.05);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    overflow-y: auto;
}

.modal-content {
    background: var(--white);
    margin: 50px auto;
    padding: 0;
    border-radius: 20px;
    max-width: 900px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 35px;
    font-weight: bold;
    color: var(--black);
    cursor: pointer;
    z-index: 10;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--yellow);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close:hover {
    background: var(--yellow-light);
    transform: rotate(90deg);
}

.modal-body {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 30px;
    padding: 30px;
}

.modal-cover {
    width: 100%;
    height: 500px;
    object-fit: cover;
    border-radius: 15px;
    border: 4px solid var(--yellow);
}

.modal-details {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-details h2 {
    font-size: 32px;
    color: var(--black);
}

.modal-author {
    font-size: 18px;
    color: #666;
}

.modal-category {
    font-size: 16px;
    color: #555;
}

.modal-description, .modal-benefits {
    background: var(--gray);
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid var(--yellow);
}

.modal-description h3, .modal-benefits h3 {
    margin-bottom: 10px;
    color: var(--black);
}

.modal-price {
    display: flex;
    align-items: center;
    gap: 15px;
}

.price-tag {
    font-size: 36px;
    font-weight: bold;
    background: linear-gradient(135deg, var(--yellow-dark), var(--yellow));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#paypalButtonContainer {
    margin-top: 20px;
}

.download-btn {
    padding: 15px 30px;
    background: linear-gradient(135deg, var(--yellow), var(--yellow-light));
    color: var(--black);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.download-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.5);
}

/* Loading */
.loading {
    text-align: center;
    padding: 50px;
    font-size: 20px;
    color: var(--yellow);
}

/* Admin Styles */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--black), var(--yellow-dark));
}

.login-box {
    background: var(--white);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 400px;
}

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

.login-box input {
    width: 100%;
    padding: 15px;
    margin-bottom: 15px;
    border: 2px solid var(--yellow);
    border-radius: 10px;
    font-size: 16px;
}

.btn-primary {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--yellow), var(--yellow-light));
    color: var(--black);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.5);
}

.error-message {
    color: #e74c3c;
    text-align: center;
    margin-top: 10px;
    font-weight: bold;
}

.success-message {
    color: #27ae60;
    text-align: center;
    margin-top: 10px;
    font-weight: bold;
}

.admin-header {
    background: linear-gradient(90deg, var(--black), var(--yellow-dark));
}

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

.btn-logout {
    padding: 10px 20px;
    background: var(--white);
    color: var(--black);
    border: 2px solid var(--yellow);
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: var(--yellow);
}

.admin-main {
    padding: 40px 0;
}

.admin-actions {
    margin-bottom: 30px;
}

.admin-table-container {
    background: var(--white);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px var(--shadow);
}

.admin-table-container h2 {
    margin-bottom: 20px;
    color: var(--black);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th {
    background: linear-gradient(135deg, var(--yellow), var(--yellow-light));
    padding: 15px;
    text-align: left;
    font-weight: bold;
    color: var(--black);
}

.admin-table td {
    padding: 15px;
    border-bottom: 1px solid var(--gray);
}

.admin-table tbody tr:hover {
    background: var(--gray);
}

.book-thumbnail {
    width: 60px;
    height: 80px;
    object-fit: cover;
    border-radius: 5px;
    border: 2px solid var(--yellow);
}

.btn-edit, .btn-delete {
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    margin-right: 10px;
    transition: all 0.3s ease;
}

.btn-edit {
    background: var(--yellow);
    color: var(--black);
}

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

.btn-delete {
    background: #e74c3c;
    color: var(--white);
}

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

/* Book Form Modal */
.modal-large {
    max-width: 700px;
    padding: 40px;
}

.book-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.form-group label {
    font-weight: bold;
    color: var(--black);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px;
    border: 2px solid var(--yellow);
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.char-count {
    color: #666;
    font-size: 12px;
}

.form-actions {
    display: flex;
    gap: 15px;
}

.btn-secondary {
    padding: 15px 30px;
    background: var(--gray);
    color: var(--black);
    border: 2px solid var(--yellow);
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
}

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

/* Responsive */
@media (max-width: 1024px) {
    .main-content .container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .modal-body {
        grid-template-columns: 1fr;
    }

    .modal-cover {
        height: 400px;
    }
}

@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
    }

    .search-container {
        max-width: 100%;
    }

    .book-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .admin-table {
        font-size: 14px;
    }

    .admin-table th,
    .admin-table td {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .book-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        margin: 20px;
    }

    .modal-body {
        padding: 20px;
    }
}