/* Custom styles for Book Management Application */

/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --accent-color: #4895ef;
    --success-color: #2ecc71;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --dark-color: #2d3436;
    --light-color: #f8f9fa;
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --shadow-light: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 10px 30px rgba(0, 0, 0, 0.15);
    --shadow-heavy: 0 15px 50px rgba(0, 0, 0, 0.2);
    --font-serif: 'Playfair Display', Georgia, serif;
    --font-sans: 'Inter', 'Segoe UI', sans-serif;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    font-family: var(--font-sans);
}

.container {
    flex: 1;
}

.footer {
    margin-top: auto;
    background: var(--gradient-1) !important;
    color: white;
}

.footer a {
    color: #ffeaa7;
    font-weight: 600;
}

/* Navbar Styling */
.navbar {
    background: var(--gradient-1) !important;
    box-shadow: var(--shadow-medium);
    padding: 1rem 2rem;
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.8rem;
    color: white !important;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.navbar .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500;
    margin: 0 0.5rem;
    padding: 0.5rem 1rem !important;
    border-radius: 25px;
    transition: all 0.3s ease;
}

.navbar .nav-link:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white !important;
    transform: translateY(-2px);
}

.navbar .navbar-text {
    color: white !important;
}

/* Page Title */
.page-title {
    background: var(--gradient-1);
    color: white;
    padding: 2rem;
    border-radius: 20px;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-medium);
    text-align: center;
}

.page-title h2 {
    margin: 0;
    font-weight: 700;
    font-size: 2rem;
}

/* Search Box */
.search-box {
    background: white;
    padding: 1.5rem 2rem;
    border-radius: 15px;
    box-shadow: var(--shadow-light);
    margin-bottom: 2rem;
}

.search-box .form-control {
    border-radius: 25px;
    padding: 0.75rem 1.5rem;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
}

.search-box .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
}

.search-box .btn {
    border-radius: 25px;
    padding: 0.75rem 2rem;
    font-weight: 600;
}

/* Book Cards Grid */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    padding: 1rem 0;
}

/* Book Card */
.book-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-light);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.book-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-heavy);
}

.book-card-header {
    background: var(--gradient-2);
    padding: 0;
    position: relative;
    aspect-ratio: 3 / 4;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.book-card-header img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.book-card-header .book-icon {
    font-size: 4rem;
    color: rgba(255, 255, 255, 0.8);
}

.book-card-header .book-id {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary-color);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
}

.book-card-header .book-icon {
    font-size: 3rem;
    color: white;
    opacity: 0.9;
}

.book-card-body {
    padding: 1.5rem;
}

.book-card-body .book-title {
    font-family: var(--font-serif);
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-card-body .book-author {
    color: #7f8c8d;
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.book-card-body .book-author i {
    margin-right: 0.5rem;
    color: var(--accent-color);
}

.book-card-body .book-category {
    display: inline-block;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: var(--dark-color);
    padding: 0.25rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.book-card-body .book-price {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--success-color);
    margin-bottom: 1rem;
}

.book-card-body .book-price span {
    font-size: 0.9rem;
    color: #95a5a6;
    font-weight: 400;
}

.book-card-actions {
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.book-card-actions .btn {
    border-radius: 25px;
    padding: 0.5rem 1.25rem;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.book-card-actions .btn:hover {
    transform: scale(1.05);
}

/* Buttons */
.btn-primary {
    background: var(--gradient-1);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    box-shadow: 0 5px 15px rgba(67, 97, 238, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    border: none;
}

.btn-success:hover {
    background: linear-gradient(135deg, #0e8a80 0%, #2ecc71 100%);
    box-shadow: 0 5px 15px rgba(46, 204, 113, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border: none;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #e080eb 0%, #e54860 100%);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    border: none;
    color: white;
}

.btn-outline-success {
    border: 2px solid var(--success-color);
    color: var(--success-color);
    background: transparent;
}

.btn-outline-success:hover {
    background: var(--success-color);
    color: white;
}

.btn-outline-danger {
    border: 2px solid white;
    color: white;
    background: transparent;
}

.btn-outline-danger:hover {
    background: white;
    color: var(--danger-color);
}

/* Pagination */
.pagination {
    margin-top: 2rem;
}

.pagination .page-link {
    border: none;
    padding: 0.75rem 1rem;
    margin: 0 0.25rem;
    border-radius: 10px;
    color: var(--primary-color);
    font-weight: 600;
    transition: all 0.3s ease;
}

.pagination .page-link:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.pagination .page-item.active .page-link {
    background: var(--gradient-1);
    color: white;
}

/* Table Styling (for Cart) */
.table {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow-light);
    margin-top: 1rem;
}

.table thead {
    background: var(--gradient-1);
    color: white;
}

.table thead th {
    border: none;
    padding: 1rem 1.5rem;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

.table tbody td {
    padding: 1rem 1.5rem;
    vertical-align: middle;
    border-bottom: 1px solid #f0f0f0;
}

.table tbody tr:hover {
    background: #f8f9fa;
}

/* Cart Specific */
.cart-total {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: var(--shadow-light);
    margin-top: 1.5rem;
}

.cart-total h3 {
    color: var(--dark-color);
    font-weight: 700;
    margin-bottom: 1rem;
}

.cart-total h3 span {
    color: var(--success-color);
    font-size: 2rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-light);
}

.empty-state i {
    font-size: 5rem;
    color: #dfe6e9;
    margin-bottom: 1.5rem;
}

.empty-state h3 {
    color: var(--dark-color);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: #7f8c8d;
    margin-bottom: 1.5rem;
}

/* Forms */
.form-container {
    background: white;
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: var(--shadow-medium);
}

.form-container .form-label {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.form-container .form-control {
    border-radius: 10px;
    padding: 0.75rem 1rem;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
}

.form-container .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
}

/* Loading Animation */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem;
}

.loading-spinner::after {
    content: "";
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .books-grid {
        grid-template-columns: 1fr;
    }

    .page-title {
        padding: 1.5rem;
    }

    .page-title h2 {
        font-size: 1.5rem;
    }

    .navbar-brand {
        font-size: 1.4rem;
    }
}

/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Quantity Input */
.quantity {
    width: 80px;
    text-align: center;
    border-radius: 10px;
    border: 2px solid var(--primary-color);
}

.quantity:focus {
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
}

/* Header Search Styles */
.header-search-input {
    border: none;
    border-radius: 25px 0 0 25px !important;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.95);
    transition: all 0.3s ease;
}

.header-search-input:focus {
    background: white;
    box-shadow: none;
    outline: none;
}

.header-search-input::placeholder {
    color: #aaa;
}

#header-search-form {
    position: relative;
}

#header-search-form .btn {
    border-radius: 0 25px 25px 0 !important;
    border: none;
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary-color);
}

#header-search-form .btn:hover {
    background: white;
    color: var(--secondary-color);
}

/* Search Autocomplete Suggestions */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 15px;
    box-shadow: var(--shadow-medium);
    z-index: 1000;
    display: none;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 5px;
}

.search-suggestions.show {
    display: block;
}

.search-suggestion-item {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.search-suggestion-item:last-child {
    border-bottom: none;
}

.search-suggestion-item:hover {
    background: #f8f9fa;
}

.search-suggestion-item img {
    width: 40px;
    height: 53px;
    object-fit: cover;
    border-radius: 4px;
}

.search-suggestion-item .book-info {
    flex: 1;
}

.search-suggestion-item .book-info .title {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--dark-color);
    margin-bottom: 2px;
}

.search-suggestion-item .book-info .author {
    font-size: 0.8rem;
    color: #7f8c8d;
}

/* Category Filter Tabs */
.filter-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.filter-tab {
    padding: 0.5rem 1.25rem;
    border-radius: 25px;
    background: white;
    color: var(--dark-color);
    font-weight: 500;
    font-size: 0.9rem;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-light);
}

.filter-tab:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-tab.active {
    background: var(--gradient-1);
    color: white;
    border-color: transparent;
}

/* Mobile Responsive for Header Search */
@media (max-width: 991px) {
    #header-search-form {
        margin-top: 1rem;
        width: 100%;
    }

    #header-search-form .input-group {
        width: 100% !important;
    }
}