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

/* Reset and Base Styles */
body { 
    font-family: 'Inter', sans-serif; 
    background-color: #f0f4f1;
    overflow-x: hidden;
    margin: 0;
}

/* The MJM Background Pattern - Clean Dot Grid */
.bg-pattern {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -2;
    background-image: radial-gradient(rgba(16, 185, 129, 0.25) 1.5px, transparent 1.5px);
    background-size: 28px 28px;
    pointer-events: none;
}

/* --- New Fibre Optics Data Center Sparks (Moving Background Lights) --- */
.fibre-optics {
    position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden;
}
.spark { position: absolute; opacity: 0; }
.spark.h-1 {
    top: 20%; left: -200px; width: 200px; height: 1px;
    background: linear-gradient(90deg, transparent, #10b981, transparent);
    animation: sparkH 6s infinite linear 1s;
}
.spark.h-2 {
    top: 65%; left: -200px; width: 150px; height: 2px;
    background: linear-gradient(90deg, transparent, #34d399, transparent);
    animation: sparkH 9s infinite linear 4s;
}
.spark.h-3 {
    top: 85%; left: -200px; width: 300px; height: 1px;
    background: linear-gradient(90deg, transparent, #059669, transparent);
    animation: sparkH 7s infinite linear 2s;
}
.spark.v-1 {
    left: 15%; top: -200px; width: 1px; height: 200px;
    background: linear-gradient(180deg, transparent, #059669, transparent);
    animation: sparkV 8s infinite linear 3s;
}
.spark.v-2 {
    left: 80%; top: -200px; width: 2px; height: 150px;
    background: linear-gradient(180deg, transparent, #10b981, transparent);
    animation: sparkV 10s infinite linear 0.5s;
}

@keyframes sparkH {
    0% { left: -200px; opacity: 0; box-shadow: 0 0 0 transparent; }
    10% { opacity: 1; box-shadow: 0 0 12px #10b981; }
    90% { opacity: 1; box-shadow: 0 0 12px #10b981; }
    100% { left: 100vw; opacity: 0; }
}

@keyframes sparkV {
    0% { top: -200px; opacity: 0; box-shadow: 0 0 0 transparent; }
    10% { opacity: 1; box-shadow: 0 0 12px #10b981; }
    90% { opacity: 1; box-shadow: 0 0 12px #10b981; }
    100% { top: 100vh; opacity: 0; }
}

/* --- Lightning Strike & AI Explosion Animation from Nursery --- */
@keyframes lightning-strike {
    0% { transform: translate(-180px, -20px) scale(0.5) rotate(-45deg); opacity: 0; }
    2% { opacity: 1; filter: drop-shadow(0 0 10px #10b981) brightness(2); }
    4% { transform: translate(-120px, 30px) scale(1.2) rotate(20deg); opacity: 0; }
    6% { opacity: 1; filter: drop-shadow(0 0 15px #10b981) brightness(2.5); }
    8% { transform: translate(-60px, -30px) scale(0.8) rotate(-10deg); opacity: 0; }
    10% { opacity: 1; filter: drop-shadow(0 0 15px #10b981) brightness(2.5); }
    12% { transform: translate(0px, 20px) scale(1.4) rotate(45deg); opacity: 0; }
    14% { opacity: 1; filter: drop-shadow(0 0 20px #34d399) brightness(3); }
    16% { transform: translate(110px, 0px) scale(2.5) rotate(90deg); opacity: 1; filter: drop-shadow(0 0 40px #fff) brightness(4); } 
    18% { transform: translate(110px, 0px) scale(3.5); opacity: 0; } 
    100% { opacity: 0; }
}

@keyframes ai-box-explosion {
    0%, 14% { opacity: 0.4; transform: scale(1); filter: brightness(1); }
    16% { opacity: 1; transform: scale(1.3); filter: brightness(2); background-color: #34d399; }
    25%, 100% { opacity: 0.4; transform: scale(1); filter: brightness(1); background-color: #34d399; }
}

.lightning-spark { 
    position: absolute; 
    top: 50%; 
    left: 50%; 
    margin-top: -12px; 
    margin-left: -12px; 
    color: #10b981; 
    animation: lightning-strike 3s linear infinite; 
    z-index: 30; 
    pointer-events: none; 
}

.ai-explosion-glow { 
    animation: ai-box-explosion 3s linear infinite; 
}

/* Glassmorphism Panel Effect */
.glass-panel {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 15px 35px rgba(0,0,0,0.05);
}

/* Button & Input Styling */
.btn-primary {
    background: #1b4332;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: #2d6a4f;
    transform: translateY(-1px);
}

.input-style {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.input-style:focus {
    border-color: #10b981;
    background: white;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

/* --- Bookshelf Expansion Logic --- */
#shelf-content {
    max-height: 0;
    transition: max-height 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
    overflow: hidden;
    opacity: 0;
}

#shelf-content.open {
    max-height: 2000px;
    opacity: 1;
    padding-bottom: 2rem;
}

/* --- Active Tab Highlighting --- */
.category-btn {
    transition: all 0.3s ease;
}

.active-tab {
    background-color: #059669 !important; 
    color: white !important;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.2);
}

/* --- Drag & Drop Visual States --- */
#drop-zone.drag-over {
    border-color: #10b981; 
    background-color: rgba(16, 185, 129, 0.05);
    transform: scale(1.01);
}

/* Chatbox Scrollbar Customization */
#chat-box::-webkit-scrollbar { width: 5px; }
#chat-box::-webkit-scrollbar-track { background: transparent; }
#chat-box::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
#chat-box::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* File Card Animations */
#bookshelf-grid div { animation: fadeIn 0.4s ease forwards; }

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

/* --- AI Markdown Content Styling --- */
.ai-markdown-content { font-size: 0.875rem; line-height: 1.6; }
.ai-markdown-content h1, .ai-markdown-content h2, .ai-markdown-content h3 { font-weight: 900; color: #065f46; margin-top: 1.5rem; margin-bottom: 0.75rem; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.05em; }
.ai-markdown-content p { margin-bottom: 1rem; }
.ai-markdown-content p:last-child { margin-bottom: 0; }
.ai-markdown-content strong { font-weight: 700; color: #064e3b; }
.ai-markdown-content ul { list-style-type: disc; margin-left: 1.5rem; margin-bottom: 1rem; }
.ai-markdown-content ol { list-style-type: decimal; margin-left: 1.5rem; margin-bottom: 1rem; }
.ai-markdown-content li { margin-bottom: 0.35rem; }
.ai-markdown-content hr { border-color: #e2e8f0; margin: 1.5rem 0; }
.ai-markdown-content table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; font-size: 0.75rem; }
.ai-markdown-content th, .ai-markdown-content td { border: 1px solid #e2e8f0; padding: 0.5rem; text-align: left; }
.ai-markdown-content th { background-color: #f8fafc; font-weight: bold; }

/* --- Custom Scrollbar for Mobile Slider --- */
.custom-scrollbar::-webkit-scrollbar { height: 6px; width: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

@media (max-width: 768px) {
    .custom-scrollbar::-webkit-scrollbar { display: none; }
}
