:root {
    /* Light Mode Colors */
    --background-color-light: #e9eaed;
    --text-color-light: #1f2324;
    --card-bg-light: #f2f2f6;
    --border-color-light: #dcdde1;

    /* Dark Mode Colors */
    --background-color-dark: #121212;
    --text-color-dark: #f5f0f0;
    --card-bg-dark: #202020;
    --border-color-dark: #333333;

    /* Default to Light Mode */
    --background-color: var(--background-color-light);
    --text-color: var(--text-color-light);
    --card-bg: var(--card-bg-light);
    --border-color: var(--border-color-light);

    /* Default Colors */
    --primary-color: #31455a;
    --secondary-color: #3498db;
    --accent-color: #df3f2d;
    --success-color: #2ad471;
    --warning-color: #f39c12;
}

/* Dark Mode Styles */
@media (prefers-color-scheme: dark) {
    :root {
        --background-color: var(--background-color-dark);
        --text-color: var(--text-color-dark);
        --card-bg: var(--card-bg-dark);
        --border-color: var(--border-color-dark);
    }
}

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

body {
    font-family: "Segoe UI", "Roboto", "Arial", "sans-serif";
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-y: auto;
}

/* Navigation Styles */
.navbar {
    background-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

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

.logo {
    color: white;
    font-size: 1.5rem;
    display: flex;
}

.logo a {
    margin-right: 10px;
}

.nav-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: nowrap;
}

.nav-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    text-align: center;
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color var(--transition-speed);
    gap: 0.5rem;
}

.nav-links a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.mobile-menu-toggle {
    display: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    margin-right: 10px;
}

#mobile-notification {
    padding-right: 15px;
}

/* Main Content */
.main-content {
    max-width: auto;
    margin: 0 auto;
    padding: 1rem;
}

/* Sort Selection */
.select-container {
    position: relative;
    display: inline-block;
}

.select-container i {
    font-size: 24px;
    cursor: pointer;
    color: #555;
}

.select-container select {
    position: absolute;
    left: 0;
    top: 100%;
    width: 50%;
    display: none;
    background: var(--primary-color);
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 8px 12px;
    font-size: 16px;
    z-index: 10;
}

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

.book-card {
    height: auto;
    color: var(--text-color);
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform var(--transition-speed),
        box-shadow var(--transition-speed);
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.book-image {
    display: none;
    width: 100%;
    height: auto;
    object-fit: cover;
}

.book-image.active {
    display: block;
}

.book-image-container {
    position: relative;
}

.prev-image-btn,
.next-image-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    z-index: 10;
}

.prev-image-btn {
    left: 0;
}

.next-image-btn {
    right: 0;
}

.book-info {
    background: var(--card-bg);
    padding: 1rem;
}

.book-title {
    font-size: 1.25rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.book-author {
    color: var(--text-color);
    opacity: 0.7;
    margin-bottom: 1rem;
}

.book-status {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
}

.status-available {
    background-color: var(--success-color);
    color: var(--text-color);
}

.status-borrowed, 
.status-pending {
    background-color: var(--warning-color);
    color: var(--text-color);
}

.book-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.borrow-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.borrow-modal {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    color: var(--text-color);
    position: relative;
}

.borrow-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.button-group {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

/* Image Preview */
.image-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.image-preview-item {
    position: relative;
    width: 150px;
    height: 150px;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-item .delete-btn {
    position: absolute;
    top: 0;
    right: 0;
    background: rgba(255, 0, 0, 0.8);
    color: white;
    border: none;
    border-top-right-radius: 5px;
    border-bottom-left-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    width: 25%;
    height: 10%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    z-index: 10;
    opacity: 0.9;
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

.image-preview-item .delete-btn:hover {
    opacity: 1;
    background: red;
}

/* Authentication Styles */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: auto;
}

.auth-form {
    color: var(--text-color);
    background: var(--card-bg);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    padding: 2rem;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

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

.error-message {
    color: var(--accent-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Buttons */
.btn {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 4px;
    background-color: var(--background-color);
    color: var(--text-color);
    cursor: pointer;
    transition: background-color var(--transition-speed);
}

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

.btn-secondary {
    background-color: var(--background-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn:hover {
    background-color: #44aff6;
}

.btn-danger:hover {
    opacity: 1;
    background-color: red;
}

.btn-ok:hover {
    opacity: 1;
    background-color: rgb(17, 236, 17);
}

.clickable-links a {
    color: #007bff;
    text-decoration: underline;
}

.clickable-links a:hover {
    color: #0056b3;
}

#loadMoreButton {
    width: 50%;
    display: block;
    margin: 20px auto;
    padding: 10px 20px;
    background-color: var(--background-color);
    color: var(--text-color);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-align: center;
    justify-content: center;
}

#loadMoreButton:hover {
    background-color: #44aff6;
}

/* Google Button Styles */
.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    color: #757575;
    border: 1px solid #ddd;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-top: 10px;
    width: 100%;
}

.btn-google:hover {
    background-color: #f8f8f8;
}

.btn-google:active {
    background-color: #f1f1f1;
}

.google-logo {
    width: 20px;
    height: 20px;
    margin-right: 10px;
}

/* Profile Section */
.profile-container {
    width: fit-content;
    height: auto;
    margin: 0 auto;
    color: var(--text-color);
    background: var(--card-bg);
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    justify-items: center;
    overflow-y: auto;
}

.profile-details {
    color: var(--text-color);
    background-color: var(--card-bg);
    display: block;
    gap: 2rem;
}

.profile-image img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
}

.notification-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 1rem;
}

.notification-card {
    width: 100%;
    height: auto;
    color: var(--text-color);
    background: var(--card-bg);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.notification-info h2,
.notification-info h3,
.notification-info h4 {
    margin: 0;
    font-weight: bold;
    padding-bottom: 0.5rem;
}

.notification-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.notification-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 1rem;
}

.notification-actions button {
    width: 100%;
    padding: 8px;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
}

.notification-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
}

.notification-nav {
    margin-top: -25px;
    margin-left: -85px;
}

.notification-mobile-nav {
    margin-top: -8px;
}

.notification-badge {
    position: absolute;
    background-color: red;
    color: white;
    font-size: 12px;
    font-weight: bold;
    border-radius: 50%;
    padding: 4px 8px;
    min-width: 20px;
    text-align: center;
    line-height: 1;
    animation: pulse 1s infinite;
}

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

.about-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.about-modal {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    color: var(--text-color);
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
}

.about-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.about-link {
    color: var(--secondary-color);
    text-decoration: underline;
    cursor: pointer;
}

.about-link:hover {
    color: var(--accent-color);
}

.btn-close {
    align-self: flex-end;
    padding: 0.5rem 1rem;
    background: var(--accent-color);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--background-color);
    border-top: 5px solid var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
}

.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem;
    background-color: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.toast-error {
    background-color: var(--accent-color);
}

.toast.show {
    opacity: 1;
}

/* Responsive Design */
@media screen and (max-width: 1080px) {
    .navbar-content {
        position: relative;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        flex-direction: column;
        z-index: 1000;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    }

    .nav-links.mobile-active {
        display: flex;
        background-color: var(--primary-color);
    }

    .nav-links a {
        padding: 8px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .mobile-menu-toggle {
        display: block;
    }

    .profile-details {
        flex-direction: column;
        align-items: center;
    }

    .stat-card {
        margin: 0.5rem 0;
    }
}

#shareBookFormContainer {
    width: fit-content;
    height: auto;
    margin: 0 auto;
    padding: 20px;
    color: var(--text-color);
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    justify-items: center;
    overflow-y: auto;
}

#shareBookForm .form-group {
    margin-bottom: 15px;
}

#shareBookForm label {
    display: block;
    margin-bottom: 5px;
}

#shareBookForm input,
#shareBookForm textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#shareBookForm button {
    width: 100%;
    padding: 10px;
}

.no-books-message {
    font-size: 1.2rem;
    color: var(--text-color);
    text-align: center;
    grid-column: span 3;
}

.books-section {
    margin-bottom: 3rem;
}

.books-section h2 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.empty-state {
    text-align: center;
    padding: 3rem;
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.empty-state p {
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.book-owner,
.book-borrower,
.book-wishlist-count {
    font-size: 0.875rem;
    color: var(--text-color);
    margin-top: 0.5rem;
}

.book-details-overlay,
.user-profile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.book-details-modal,
.user-profile-modal {
    background: var(--card-bg);
    border-radius: 8px;
    width: 90%;
    max-height: 90%;
    overflow-y: auto;
    position: relative;
    padding: 20px;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 24px;
    background: none;
    border: none;
    cursor: pointer;
}

.book-details-header {
    display: block;
    align-items: center;
    margin-bottom: 20px;
}

.book-image-carousel {
    position: relative;
}

.book-details-image {
    display: none;
    width: 100%;
    height: auto;
    object-fit: cover;
}

.book-details-image.active {
    display: block;
}

.book-meta-details a {
    color: var(--secondary-color);
    text-decoration: underline;
    cursor: pointer;
}

.borrow-history-item,
.wishlist-users {
    margin-bottom: 10px;
}

* {
    scrollbar-width: none;
}

select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 16px;
    background-color: white;
    cursor: pointer;
}

select:focus {
    border-color: var(--border-color);
    outline: none;
}

.info-group input,
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 16px;
    background-color: white;
    cursor: pointer;
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.password-wrapper {
    position: relative;
}

input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.error-message {
    color: red;
    font-size: 12px;
    margin-top: 5px;
}
.password-wrapper i {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #777;
}

.password-wrapper i:hover {
    color: #333;
}
