@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* --- Premium Modern Design System --- */
:root {
    /* Colors */
    --lms-primary: #4338ca;
    /* Indigo 700 */
    --lms-primary-hover: #3730a3;
    --lms-secondary: #0f172a;
    /* Slate 900 */
    --lms-text-main: #0f172a;
    --lms-text-muted: #64748b;
    --lms-bg-body: #f8fafc;
    --lms-white: #ffffff;
    --lms-border: #e2e8f0;
    --lms-danger: #ef4444;
    --lms-success: #10b981;

    --lms-radius: 12px;
    --lms-font-family: 'Plus Jakarta Sans', sans-serif;
    --lms-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    --lms-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --lms-shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--lms-bg-body);
    font-family: var(--lms-font-family);
    color: var(--lms-text-main);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

/* --- LAYOUT: Top Navbar Style --- */
.lms-app-layout {
    display: block;
    /* No more grid */
    min-height: 100vh;
}

/* Navbar */
.lms-navbar {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--lms-border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 16px 0;
}

.lms-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

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

.lms-brand h2 {
    font-size: 24px;
    font-weight: 800;
    margin: 0;
    background: linear-gradient(135deg, var(--lms-primary) 0%, #818cf8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: -0.02em;
}

.lms-nav-links {
    display: flex;
    gap: 32px;
    align-items: center;
}

.lms-nav-item {
    text-decoration: none;
    color: var(--lms-text-muted);
    font-weight: 600;
    font-size: 15px;
    transition: var(--lms-transition);
}

.lms-nav-item:hover,
.lms-nav-item.active {
    color: var(--lms-primary);
}

.lms-auth-btn {
    background: var(--lms-secondary);
    color: #fff;
    padding: 10px 24px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: var(--lms-transition);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}

.lms-auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.3);
}

/* Profile Dropdown (Simplified) */
.lms-user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lms-user-profile img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--lms-white);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* --- Hero Section --- */
.lms-hero-wrapper {
    padding: 60px 0 40px 0;
}

.lms-hero-slider {
    display: flex;
    gap: 32px;
    overflow-x: auto;
    padding: 10px 4px 40px 4px;
    /* Space for shadow */
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.lms-hero-slider::-webkit-scrollbar {
    display: none;
}

.lms-hero-slide {
    flex: 0 0 100%;
    min-height: 400px;
    background: #0f172a;
    border-radius: 24px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    padding: 60px;
    color: white;
    box-shadow: var(--lms-shadow-lg);
    scroll-snap-align: center;
}

.lms-hero-content {
    flex: 1;
    z-index: 2;
    max-width: 600px;
}

.lms-hero-badge {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.lms-hero-title {
    font-size: 48px;
    font-weight: 800;
    margin: 24px 0;
    line-height: 1.1;
    background: linear-gradient(to right, #ffffff, #cbd5e1);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.lms-hero-image {
    flex: 0 0 280px;
    z-index: 2;
    transform: rotate(3deg) translateY(0);
    transition: transform 0.5s ease;
    filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.5));
}

.lms-hero-slide:hover .lms-hero-image {
    transform: rotate(0deg) translateY(-10px);
}

.lms-hero-image img {
    width: 100%;
    border-radius: 8px;
}

.lms-hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
}

.lms-hero-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.3;
    filter: blur(40px);
    transform: scale(1.1);
}

/* --- Sections --- */
.lms-section {
    margin-bottom: 80px;
}

.lms-section-header {
    display: flex;
    justify-content: space-between;
    align-items: end;
    margin-bottom: 32px;
}

.lms-section-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
    color: var(--lms-secondary);
}

/* --- Cards --- */
.lms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 32px;
}

.lms-book-card {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    transition: transform 0.3s ease;
}

.lms-book-card:hover {
    transform: translateY(-8px);
}

.lms-book-cover {
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 16px;
    aspect-ratio: 2/3;
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.1);
    background-size: cover;
    background-position: center;
    position: relative;
    transition: box-shadow 0.3s ease;
}

.lms-book-card:hover .lms-book-cover {
    box-shadow: 0 20px 30px -10px rgba(79, 70, 229, 0.3);
}

.lms-book-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: 0.3s;
}

.lms-book-card:hover .lms-book-overlay {
    opacity: 1;
}

.lms-book-meta {
    padding: 0 4px;
}

.lms-book-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--lms-secondary);
    margin: 0 0 4px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Category Pills --- */
.lms-category-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.lms-cat-pill {
    background: white;
    border: 1px solid var(--lms-border);
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 14px;
    color: var(--lms-text-main);
    cursor: pointer;
    transition: var(--lms-transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.lms-cat-pill:hover {
    background: var(--lms-secondary);
    color: white;
    border-color: var(--lms-secondary);
    transform: translateY(-2px);
}

/* --- Utils --- */
.lms-btn {
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
}

.lms-btn-light {
    background: white;
    color: var(--lms-secondary);
    padding: 10px 20px;
}

.lms-btn-light:hover {
    background: #f1f5f9;
}

.lms-btn-primary {
    background: var(--lms-primary);
    color: white;
    padding: 12px 24px;
}

/* Hide scrollbar for layout */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* --- Modal (Restored) --- */
.lms-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
}

.lms-modal.open {
    display: flex;
}

.lms-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
}

.lms-modal-content {
    background: white;
    width: 90%;
    max-width: 500px;
    border-radius: 20px;
    z-index: 2;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: modalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.lms-modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--lms-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lms-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--lms-secondary);
}

.lms-modal-header button {
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--lms-text-muted);
    cursor: pointer;
}

.lms-modal-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}

.lms-modal-footer {
    padding: 24px;
    background: #f8fafc;
    border-top: 1px solid var(--lms-border);
    text-align: right;
}

#lms-cart-list {
    list-style: none;
    padding: 0;
    margin: 0 0 24px 0;
}

#lms-cart-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--lms-border);
    border-radius: 12px;
    margin-bottom: 8px;
    font-weight: 500;
}

#lms-cart-list button {
    background: #fee2e2;
    color: #b91c1c;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lms-cart-manage label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--lms-text-muted);
}

.lms-cart-manage input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--lms-border);
    border-radius: 8px;
    font-family: inherit;
    font-weight: 600;
}

/* -------------------------------------------------------------------------- */
/*                                ADMIN LAYOUT                                */
/* -------------------------------------------------------------------------- */

.lms-app-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.lms-sidebar {
    background: #ffffff;
    border-right: 1px solid var(--lms-border);
    padding: 24px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* Collapsed State */
.lms-app-layout.collapsed {
    grid-template-columns: 88px 1fr;
}

.lms-app-layout.collapsed .lms-sidebar {
    padding: 24px 12px;
}

.lms-app-layout.collapsed .lms-brand h2 span:last-child,
.lms-app-layout.collapsed .lms-nav-link span:not(.material-icons-round),
.lms-app-layout.collapsed .lms-user-mini strong,
.lms-app-layout.collapsed .lms-user-mini small,
.lms-app-layout.collapsed .lms-user-mini a span:last-child {
    display: none !important;
}

.lms-app-layout.collapsed .lms-nav-link {
    justify-content: center;
    padding: 12px;
}

.lms-app-layout.collapsed .lms-nav-link .material-icons-round {
    margin: 0;
    font-size: 24px;
}

.lms-app-layout.collapsed .lms-brand h2 {
    justify-content: center;
}

.lms-app-layout.collapsed .lms-user-mini {
    text-align: center;
}

.lms-app-layout.collapsed .lms-user-mini a {
    justify-content: center;
}

.lms-main {
    padding: 40px;
    background: #f8fafc;
    overflow-y: auto;
}

.lms-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 24px;
}

.lms-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    text-decoration: none;
    color: var(--lms-text-muted);
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.2s;
    white-space: nowrap;
}

.lms-nav-link:hover {
    background: var(--lms-bg-body);
    color: var(--lms-primary);
}

.lms-nav-link.active {
    background: var(--lms-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.lms-nav-link .material-icons-round {
    font-size: 20px;
}

/* User Mini Profile in Sidebar */
.lms-user-mini {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--lms-border);
}

/* Responsive Admin */
@media (max-width: 1024px) {
    .lms-app-layout {
        grid-template-columns: 1fr;
    }

    .lms-sidebar {
        height: auto;
        position: relative;
        padding: 24px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .lms-nav {
        flex-direction: row;
        overflow-x: auto;
        width: 100%;
        margin-top: 16px;
        padding-bottom: 4px;
    }

    .lms-nav-link {
        white-space: nowrap;
        font-size: 14px;
        padding: 8px 12px;
    }

    .lms-user-mini {
        display: none;
    }
}