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

body {
    font-family: 'Amiri', serif;
    background: url('paper-texture.jpg');
    background-size: cover;
    background-attachment: fixed;
    color: #3E2723;
    line-height: 1.6;
    overflow-x: hidden;
}



/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(139, 69, 19, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    transition: all 0.3s ease;
}

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

.logo {
    font-family: 'Scheherazade New', serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: #F5E6D3;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.auth-buttons {
    display: flex;
    gap: 1rem;
}

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

.auth-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    color: #F5E6D3;
    border: 2px solid #F5E6D3;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.auth-btn:hover {
    background: #F5E6D3;
    color: #8B4513;
    transform: translateY(-2px);
    text-decoration: none;
}

.user-only, .admin-only {
    display: none;
}

.user-only.show {
    display: block;
}

.admin-only.show {
    display: block;
}

.nav-menu .user-only.show, .nav-menu .admin-only.show {
    display: list-item;
}

.auth-buttons .user-only.show {
    display: inline-block;
}

/* Hide add book section for admin */
.admin-role .user-only {
    display: none !important;
}

.nav-link {
    color: #F5E6D3;
    text-decoration: none;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link:hover {
    color: #DDD;
    transform: translateY(-2px);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: #F5E6D3;
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: transparent;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="paper" patternUnits="userSpaceOnUse" width="100" height="100"><rect width="100" height="100" fill="%23F5E6D3" opacity="0.1"/><path d="M0 0L100 100M100 0L0 100" stroke="%23D2B48C" stroke-width="0.5" opacity="0.2"/></pattern></defs><rect width="100" height="100" fill="url(%23paper)"/></svg>') repeat;
    opacity: 0.3;
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(1deg); }
}

.hero-content {
    max-width: 800px;
    padding: 2rem;
    animation: fadeInUp 1s ease-out;
    position: relative;
    z-index: 2;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-title {
    font-family: 'Scheherazade New', serif;
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #3E2723;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    animation: slideInRight 1s ease-out 0.3s both;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.hero-subtitle {
    font-size: 1.3rem;
    margin-bottom: 2rem;
    color: #5D4037;
    animation: slideInLeft 1s ease-out 0.6s both;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.search-container {
    display: flex;
    max-width: 500px;
    margin: 0 auto 2rem;
    animation: fadeIn 1s ease-out 0.9s both;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

#search-input {
    flex: 1;
    padding: 1rem;
    border: 2px solid #8B4513;
    border-radius: 25px 0 0 25px;
    font-size: 1rem;
    background: rgba(245, 230, 211, 0.9);
    color: #3E2723;
    outline: none;
    transition: all 0.3s ease;
}

#search-input:focus {
    background: rgba(245, 230, 211, 1);
    box-shadow: 0 0 15px rgba(139, 69, 19, 0.3);
}

#search-btn {
    padding: 1rem 2rem;
    background: #8B4513;
    color: #F5E6D3;
    border: none;
    border-radius: 0 25px 25px 0;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

#search-btn:hover {
    background: #A0522D;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.filters {
    animation: fadeIn 1s ease-out 1.2s both;
}

#category-filter {
    padding: 0.8rem 1.5rem;
    border: 2px solid #8B4513;
    border-radius: 25px;
    background: rgba(245, 230, 211, 0.9);
    color: #3E2723;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

#category-filter:focus {
    outline: none;
    box-shadow: 0 0 15px rgba(139, 69, 19, 0.3);
}

/* Sections */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.section-title {
    font-family: 'Scheherazade New', serif;
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 3rem;
    color: #3E2723;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background: linear-gradient(90deg, #8B4513, #D2B48C);
    border-radius: 2px;
}

/* Gallery */
.gallery {
    padding: 5rem 0;
    background: rgba(245, 230, 211, 0.3);
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.book-card {
    background: rgba(245, 230, 211, 0.9);
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 2px solid rgba(139, 69, 19, 0.2);
    position: relative;
    overflow: visible;
    animation: slideInUp 0.6s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.book-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(139, 69, 19, 0.05) 50%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.book-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.book-card:hover::before {
    opacity: 1;
}

.book-cover {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}

.book-card:hover .book-cover {
    transform: scale(1.05);
}

.book-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #3E2723;
}

.book-author {
    color: #5D4037;
    margin-bottom: 0.5rem;
}

.book-year {
    color: #8B4513;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.book-category {
    display: inline-block;
    background: #8B4513;
    color: #F5E6D3;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    margin-bottom: 1rem;
}

.order-btn {
    width: 100%;
    padding: 0.8rem;
    background: linear-gradient(45deg, #8B4513, #A0522D);
    color: #F5E6D3;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.order-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.order-btn:hover::before {
    left: 100%;
}

.order-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* Add Book Form */
.add-book {
    padding: 5rem 0;
    background: rgba(210, 180, 140, 0.2);
}

.book-form {
    max-width: 600px;
    margin: 0 auto;
    background: rgba(245, 230, 211, 0.9);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    animation: fadeInUp 0.8s ease-out;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #3E2723;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid #D2B48C;
    border-radius: 8px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.8);
    color: #3E2723;
    transition: all 0.3s ease;
    font-family: 'Amiri', serif;
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #8B4513;
    box-shadow: 0 0 10px rgba(139, 69, 19, 0.2);
}

.cover-preview {
    margin-top: 1rem;
    text-align: center;
}

.cover-preview img {
    max-width: 200px;
    max-height: 250px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.submit-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(45deg, #8B4513, #A0522D);
    color: #F5E6D3;
    border: none;
    border-radius: 25px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

/* Footer */
.footer {
    background: #3E2723;
    color: #F5E6D3;
    text-align: center;
    padding: 2rem 0;
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.book-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    position: relative;
    z-index: 10;
}

.edit-btn, .delete-btn {
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    position: relative;
    z-index: 999;
    pointer-events: auto;
}

.edit-btn {
    background: #007bff;
    color: white;
}

.edit-btn:hover {
    background: #0056b3;
}

.delete-btn {
    background: #dc3545;
    color: white;
}

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

/* Sales Summary */
.sales-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.summary-card h3 {
    margin: 0 0 10px 0;
    color: #333;
}

.summary-card p {
    font-size: 24px;
    font-weight: bold;
    color: #007bff;
    margin: 0;
}

/* Sales Details Table */
.sales-details table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sales-details th, .sales-details td {
    padding: 12px;
    text-align: right;
    border-bottom: 1px solid #ddd;
}

.sales-details th {
    background: #f8f9fa;
    font-weight: bold;
}

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

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 20px;
    border-radius: 8px;
    width: 80%;
    max-width: 500px;
    position: relative;
}

.close {
    position: absolute;
    right: 10px;
    top: 10px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #999;
}

#editForm input, #editForm textarea {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

#editForm button {
    background: #007bff;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
}

/* Status Styles */
.status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.status.pending {
    background: #fff3cd;
    color: #856404;
}

.status.approved {
    background: #d4edda;
    color: #155724;
}

.status.rejected {
    background: #f8d7da;
    color: #721c24;
}

.status.shipped {
    background: #d1ecf1;
    color: #0c5460;
}

/* Filter Tabs */
.filter-tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.tab-btn {
    padding: 0.8rem 1.5rem;
    background: transparent;
    color: #8B4513;
    border: 2px solid #8B4513;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.tab-btn.active,
.tab-btn:hover {
    background: #8B4513;
    color: #F5E6D3;
    transform: translateY(-2px);
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .nav-menu {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 1rem;
        text-align: center;
        justify-content: center;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .search-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    #search-input,
    #search-btn {
        border-radius: 25px;
    }
    
    .books-grid {
        grid-template-columns: 1fr;
    }
    
    .container {
        padding: 0 1rem;
    }
    
    .auth-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .nav-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .sales-summary {
        grid-template-columns: 1fr;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(245, 230, 211, 0.3);
    border-radius: 50%;
    border-top-color: #F5E6D3;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}