/* ==========================================================================
   LibraryPlus Design System - Modern Clean SaaS UI (Bootstrap 5 Enhanced)
   Tone: Crisp White (#ffffff), Soft Slate (#f8fafc), Royal Blue (#3b5bdb / #2563eb)
   ========================================================================== */

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

:root {
    --lp-bg: #f6f8fc;
    --lp-surface: #ffffff;
    --lp-border: #e6ebf2;
    --lp-text: #0f172a;
    --lp-muted: #64748b;
    --lp-primary: #365cf5;
    --lp-primary-hover: #2548d8;
    --lp-primary-soft: #eef3ff;
    --lp-success: #0f9f6e;
    --lp-success-soft: #e6f7f0;
    --lp-warning: #d97706;
    --lp-warning-soft: #fef3c7;
    --lp-danger: #dc2626;
    --lp-danger-soft: #fee2e2;
    --lp-sidebar-w: 256px;
    --lp-radius: 16px;
    --lp-radius-sm: 10px;
    --lp-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 6px 20px rgba(15, 23, 42, 0.03);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--lp-bg);
    color: var(--lp-text);
    margin: 0;
    font-size: 0.925rem;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ================= ADMIN SHELL LAYOUT ================= */
.lp-app {
    display: flex;
    min-height: 100vh;
}

.lp-sidebar {
    width: var(--lp-sidebar-w);
    background: var(--lp-surface);
    border-right: 1px solid var(--lp-border);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1030;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.lp-brand {
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--lp-border);
}

.lp-brand-logo {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: linear-gradient(135deg, #365cf5, #4f46e5);
    color: #fff;
    font-weight: 800;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(54, 92, 245, 0.28);
    flex-shrink: 0;
}

.lp-brand-title {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
    color: #0f172a;
    line-height: 1.15;
}

.lp-brand-sub {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: #94a3b8;
    text-transform: uppercase;
}

.lp-nav-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
}

.lp-nav-scroll::-webkit-scrollbar {
    width: 5px;
}
.lp-nav-scroll::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 99px;
}

.lp-nav-section {
    font-size: 0.68rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 12px 12px 6px;
}

.lp-nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9.5px 12px;
    border-radius: 10px;
    color: #475569;
    font-weight: 500;
    font-size: 0.89rem;
    margin-bottom: 2px;
    transition: all 0.16s ease;
    position: relative;
}

.lp-nav-link i {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
    color: #64748b;
    transition: color 0.16s ease;
}

.lp-nav-link:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.lp-nav-link:hover i {
    color: var(--lp-primary);
}

.lp-nav-link.active {
    background: var(--lp-primary-soft);
    color: var(--lp-primary);
    font-weight: 600;
}

.lp-nav-link.active i {
    color: var(--lp-primary);
}

.lp-nav-link.active::after {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--lp-primary);
    margin-left: auto;
}

.lp-sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--lp-border);
}

.lp-smart-banner {
    background: linear-gradient(135deg, #eff5ff 0%, #f5f3ff 100%);
    border: 1px solid #dbeafe;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 8px;
}

.lp-smart-banner-title {
    font-weight: 700;
    font-size: 0.82rem;
    color: #1e293b;
}

.lp-smart-banner-sub {
    font-size: 0.74rem;
    color: #64748b;
}

/* ================= MAIN AREA & TOPBAR ================= */
.lp-main {
    flex: 1;
    margin-left: var(--lp-sidebar-w);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.lp-topbar {
    height: 66px;
    background: var(--lp-surface);
    border-bottom: 1px solid var(--lp-border);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1010;
}

.lp-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.86rem;
    color: #64748b;
}

.lp-breadcrumb strong {
    color: #0f172a;
    font-weight: 600;
}

.lp-top-search {
    position: relative;
    width: 270px;
}

.lp-top-search input {
    width: 100%;
    padding: 8px 14px 8px 36px;
    border-radius: 999px;
    border: 1px solid var(--lp-border);
    background: #f8fafc;
    font-size: 0.84rem;
    transition: all 0.18s ease;
}

.lp-top-search input:focus {
    outline: none;
    background: #fff;
    border-color: var(--lp-primary);
    box-shadow: 0 0 0 3px rgba(54, 92, 245, 0.12);
}

.lp-top-search i {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.88rem;
}

.lp-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--lp-border);
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    position: relative;
    transition: all 0.15s;
}

.lp-icon-btn:hover {
    background: #f8fafc;
    color: var(--lp-primary);
}

.lp-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--lp-primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-transform: lowercase;
}

.lp-content {
    padding: 26px 30px 40px;
    flex: 1;
}

.lp-footer {
    padding: 16px 30px;
    border-top: 1px solid var(--lp-border);
    background: var(--lp-surface);
    font-size: 0.8rem;
    color: #94a3b8;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ================= PAGE HEADERS & CARDS ================= */
.lp-eyebrow {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--lp-primary);
    margin-bottom: 3px;
}

.lp-page-title {
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: #0f172a;
    margin-bottom: 4px;
}

.lp-page-desc {
    color: var(--lp-muted);
    font-size: 0.9rem;
    margin-bottom: 0;
}

.lp-card {
    background: var(--lp-surface);
    border: 1px solid var(--lp-border);
    border-radius: var(--lp-radius);
    box-shadow: var(--lp-shadow);
}

/* Hero Banner on Dashboard */
.lp-hero {
    background: linear-gradient(125deg, #3454d1 0%, #4361ee 52%, #5e72eb 100%);
    border-radius: 20px;
    padding: 28px 34px;
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(54, 92, 245, 0.2);
}

.lp-hero::before {
    content: '';
    position: absolute;
    right: -60px;
    top: -60px;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.16) 0%, rgba(255,255,255,0) 70%);
}

.lp-hero-eyebrow {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.85;
    margin-bottom: 6px;
}

.lp-hero-title {
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}

.lp-hero-sub {
    opacity: 0.9;
    font-size: 0.92rem;
    margin-bottom: 18px;
}

.lp-hero-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    color: #2548d8;
    font-weight: 700;
    font-size: 0.86rem;
    padding: 9px 18px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.lp-hero-btn:hover {
    transform: translateY(-1px);
    color: #1e3a8a;
    box-shadow: 0 6px 16px rgba(0,0,0,0.14);
}

/* Stat Cards */
.lp-stat-card {
    background: var(--lp-surface);
    border: 1px solid var(--lp-border);
    border-radius: var(--lp-radius);
    padding: 20px 22px;
    box-shadow: var(--lp-shadow);
    height: 100%;
    transition: transform 0.16s ease, border-color 0.16s ease;
}

.lp-stat-card:hover {
    transform: translateY(-2px);
    border-color: #cbd5e1;
}

.lp-stat-label {
    font-size: 0.84rem;
    color: #64748b;
    font-weight: 500;
}

.lp-stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
}

.lp-stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #0f172a;
    margin: 8px 0 4px;
    line-height: 1.15;
}

.lp-stat-meta {
    font-size: 0.78rem;
    color: #94a3b8;
}

/* Quick Action Cards */
.lp-action-card {
    background: var(--lp-surface);
    border: 1px solid var(--lp-border);
    border-radius: 14px;
    padding: 15px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--lp-shadow);
    transition: all 0.18s ease;
}

.lp-action-card:hover {
    border-color: #bfdbfe;
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.08);
}

/* Tables & Badges */
.lp-table {
    width: 100%;
    margin-bottom: 0;
}

.lp-table thead th {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    background: #f8fafc;
    border-bottom: 1px solid var(--lp-border);
    padding: 13px 16px;
    white-space: nowrap;
}

.lp-table tbody td {
    padding: 14px 16px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.89rem;
}

.lp-table tbody tr:last-child td {
    border-bottom: none;
}

.lp-table tbody tr:hover {
    background-color: #fafcff;
}

.lp-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
}

.lp-badge-success { background: var(--lp-success-soft); color: var(--lp-success); }
.lp-badge-warning { background: var(--lp-warning-soft); color: var(--lp-warning); }
.lp-badge-danger  { background: var(--lp-danger-soft);  color: var(--lp-danger); }
.lp-badge-primary { background: var(--lp-primary-soft); color: var(--lp-primary); }
.lp-badge-neutral { background: #f1f5f9; color: #475569; }

/* Buttons */
.btn-lp-primary {
    background: var(--lp-primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 8.5px 16px;
    font-weight: 600;
    font-size: 0.87rem;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all 0.16s ease;
}

.btn-lp-primary:hover {
    background: var(--lp-primary-hover);
    color: #fff;
    transform: translateY(-1px);
}

.btn-lp-soft {
    background: #f8fafc;
    color: #334155;
    border: 1px solid var(--lp-border);
    border-radius: 10px;
    padding: 8px 14px;
    font-weight: 600;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
}

.btn-lp-soft:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.lp-book-thumb {
    width: 40px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
    background: #e2e8f0;
    flex-shrink: 0;
}

/* ================= READER PORTAL / PUBLIC CATALOG ================= */
.lp-portal-nav {
    background: #fff;
    border-bottom: 1px solid var(--lp-border);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.lp-portal-link {
    padding: 8px 13px;
    border-radius: 9px;
    font-weight: 600;
    font-size: 0.88rem;
    color: #475569;
    transition: all 0.15s;
}

.lp-portal-link:hover, .lp-portal-link.active {
    color: var(--lp-primary);
    background: var(--lp-primary-soft);
}

.lp-catalog-card {
    background: #fff;
    border: 1px solid var(--lp-border);
    border-radius: 16px;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.2s ease;
}

.lp-catalog-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.08);
    border-color: #cbd5e1;
}

.lp-catalog-cover-wrap {
    background: linear-gradient(180deg, #eff4fb 0%, #f8fafc 100%);
    padding: 24px 20px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    height: 235px;
}

.lp-catalog-cover-wrap img {
    height: 185px;
    width: auto;
    max-width: 138px;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.22);
    transition: transform 0.25s ease;
}

.lp-catalog-card:hover .lp-catalog-cover-wrap img {
    transform: scale(1.04);
}

.lp-catalog-cat-bar {
    background: #f1f5fb;
    color: #365cf5;
    font-size: 0.74rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 7px;
    margin-bottom: 10px;
}

/* Progress bars in Reports */
.lp-progress-track {
    height: 9px;
    background: #eef2f7;
    border-radius: 99px;
    overflow: hidden;
}

.lp-progress-fill {
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, #365cf5 0%, #10b981 100%);
}

/* ================= FLOATING GEMINI AI CHATBOT WIDGET ================= */
.lp-chat-fab {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, #365cf5 0%, #6366f1 100%);
    color: #fff;
    border: none;
    box-shadow: 0 10px 26px rgba(54, 92, 245, 0.42);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45rem;
    z-index: 1080;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.lp-chat-fab:hover {
    transform: scale(1.07) translateY(-2px);
    box-shadow: 0 14px 32px rgba(54, 92, 245, 0.52);
}

.lp-chat-panel {
    position: fixed;
    right: 24px;
    bottom: 94px;
    width: 390px;
    max-width: calc(100vw - 32px);
    height: 545px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border: 1px solid var(--lp-border);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
    z-index: 1080;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: lpChatSlideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.lp-chat-panel.open {
    display: flex;
}

@keyframes lpChatSlideUp {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.lp-chat-header {
    background: linear-gradient(135deg, #3454d1 0%, #4f46e5 100%);
    color: #fff;
    padding: 15px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.lp-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lp-chat-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.86rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.lp-chat-bubble.bot {
    align-self: flex-start;
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #1e293b;
    border-bottom-left-radius: 4px;
}

.lp-chat-bubble.user {
    align-self: flex-end;
    background: var(--lp-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.lp-chat-chips {
    padding: 8px 14px;
    background: #f8fafc;
    border-top: 1px solid #eef2f7;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    white-space: nowrap;
}

.lp-chat-chips::-webkit-scrollbar {
    height: 3px;
}

.lp-chat-chip {
    background: #fff;
    border: 1px solid #dbeafe;
    color: #2563eb;
    border-radius: 999px;
    padding: 4px 11px;
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.lp-chat-chip:hover {
    background: #eff6ff;
    border-color: #93c5fd;
}

.lp-chat-input-bar {
    padding: 12px 14px;
    background: #fff;
    border-top: 1px solid var(--lp-border);
    display: flex;
    gap: 8px;
}

/* Responsive Mobile Sidebar */
@media (max-width: 991.98px) {
    .lp-sidebar {
        transform: translateX(-100%);
    }
    .lp-sidebar.show {
        transform: translateX(0);
    }
    .lp-main {
        margin-left: 0;
    }
    .lp-content {
        padding: 20px 16px;
    }
    .lp-topbar {
        padding: 0 16px;
    }
    .lp-top-search {
        width: 180px;
    }
}
