/* Mirle CIM V3 Theme & Anti-Copy Styles */
:root {
    --mirle-blue: #005BAC;
    --mirle-blue-light: #0077D4;
    --mirle-navy: #002B5C;
    --mirle-cyan: #00A3E0;
    --mirle-dark: #0f172a;
}

/* Anti-copy global protection */
.protected-content,
.markdown-body,
#course-reader-content {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    -webkit-touch-callout: none !important;
}

/* Allow text selection in tables, inputs, and admin panel */
table, td, th, input, textarea, select, button, .admin-area, .allow-select {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
}

/* Print protection */
@media print {
    html, body {
        display: none !important;
        visibility: hidden !important;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 91, 172, 0.3);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 91, 172, 0.6);
}

/* Markdown Rendering Enhancements */
.markdown-body h1 {
    font-size: 1.85rem;
    font-weight: 700;
    color: #1e293b;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}
.markdown-body h2 {
    font-size: 1.45rem;
    font-weight: 700;
    color: #005BAC;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 0.4rem;
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
}
.markdown-body h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #334155;
    margin-top: 1.2rem;
    margin-bottom: 0.6rem;
}
.markdown-body p {
    line-height: 1.75;
    margin-bottom: 1rem;
    color: #334155;
}
.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.2rem 0;
    font-size: 0.92rem;
}
.markdown-body th {
    background: #f1f5f9;
    color: #0f172a;
    font-weight: 600;
    padding: 0.75rem 1rem;
    border: 1px solid #cbd5e1;
    text-align: left;
}
.markdown-body td {
    padding: 0.65rem 1rem;
    border: 1px solid #e2e8f0;
    color: #334155;
}
.markdown-body tr:nth-child(even) {
    background: #f8fafc;
}
.markdown-body pre {
    background: #0f172a !important;
    color: #f8fafc !important;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 1rem 0;
    font-family: 'Fira Code', Consolas, Monaco, monospace;
    font-size: 0.88rem;
}
.markdown-body code {
    background: #f1f5f9;
    color: #005BAC;
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.88em;
    font-family: 'Fira Code', Consolas, Monaco, monospace;
}
.markdown-body pre code {
    background: transparent !important;
    color: inherit !important;
    padding: 0;
}
.markdown-body blockquote {
    border-left: 4px solid #005BAC;
    background: #f0f7ff;
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    color: #1e3a8a;
    border-radius: 0 0.375rem 0.375rem 0;
}
.markdown-body hr {
    border: 0;
    height: 1px;
    background: #e2e8f0;
    margin: 1.5rem 0;
}
.markdown-body ul, .markdown-body ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}
.markdown-body li {
    margin-bottom: 0.35rem;
    line-height: 1.6;
}

/* Glassmorphism utility */
.glass-panel {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.dark .glass-panel {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Dark Mode Markdown Styles */
.dark .markdown-body {
    color: #e2e8f0;
}
.dark .markdown-body h1 {
    color: #f8fafc;
    border-bottom: 2px solid #334155;
}
.dark .markdown-body h2 {
    color: #38bdf8;
    border-bottom: 1px solid #334155;
}
.dark .markdown-body h3 {
    color: #cbd5e1;
}
.dark .markdown-body p,
.dark .markdown-body li {
    color: #cbd5e1;
}
.dark .markdown-body strong {
    color: #f8fafc;
}
.dark .markdown-body table th {
    background: #1e293b;
    color: #f8fafc;
    border: 1px solid #334155;
}
.dark .markdown-body table td {
    background: #0f172a;
    color: #cbd5e1;
    border: 1px solid #334155;
}
.dark .markdown-body table tr:nth-child(even) td {
    background: #162032;
}
.dark .markdown-body code {
    background: #1e293b;
    color: #38bdf8;
}
.dark .markdown-body blockquote {
    background: #0f1f38;
    color: #93c5fd;
    border-left-color: #38bdf8;
}
.dark .markdown-body hr {
    background: #334155;
}

/* Toast animation */
@keyframes slideDownFade {
    0% { transform: translate(-50%, -20px); opacity: 0; }
    100% { transform: translate(-50%, 0); opacity: 1; }
}
.animate-toast {
    animation: slideDownFade 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Mobile Safe Area Bottom Utility */
.safe-area-bottom {
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
}
