:root {
    --bg-base: #ffffff; --bg-panel: #f8fafc; --bg-hover: #f1f5f9;
    --text-main: #0f172a; --text-muted: #64748b; --text-light: #94a3b8;
    --border: #e2e8f0; --border-focus: #cbd5e1;
    --accent: #0f172a; --accent-hover: #334155; --accent-text: #ffffff;
    --code-bg: #0f172a; --code-text: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --radius-md: 8px; --radius-lg: 12px;
}
html.dark {
    --bg-base: #020617; --bg-panel: #0f172a; --bg-hover: #1e293b;
    --text-main: #f8fafc; --text-muted: #94a3b8; --text-light: #64748b;
    --border: #1e293b; --border-focus: #334155;
    --accent: #f8fafc; --accent-hover: #e2e8f0; --accent-text: #0f172a;
    --code-bg: #0f172a; --code-text: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg-base); color: var(--text-main); display: flex; min-height: 100vh; line-height: 1.5; transition: background-color 0.2s, color 0.2s; }

/* Fixed Sidebar Layout */
aside { width: 280px; background: var(--bg-panel); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; height: 100vh; z-index: 100; transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); overflow: hidden; }
.brand { padding: 1.5rem 1.5rem 1rem 1.5rem; margin: 0; font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; gap: 0.5rem; color: var(--text-main); flex-shrink: 0; }
.brand svg { width: 24px; height: 24px; color: var(--accent); }
#sidebar-nav { flex-grow: 1; overflow-y: auto; padding: 0 1.5rem 1.5rem 1.5rem; }

main { margin-left: 280px; flex-grow: 1; display: flex; flex-direction: column; min-height: 100vh; width: calc(100% - 280px); }
.main-content { padding: 2rem 4rem; max-width: 1000px; width: 100%; flex-grow: 1; }

/* Navigation Links */
.nav-section { margin-bottom: 1.5rem; }
.nav-section:first-child h4 { margin-top: 0; }
.nav-section h4 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-light); margin: 0 0 0.5rem 0; font-weight: 600; }
.nav-link { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.75rem; color: var(--text-muted); text-decoration: none; border-radius: var(--radius-md); font-size: 0.9rem; font-weight: 500; transition: all 0.1s; margin-bottom: 0.2rem; cursor: pointer; }
.nav-link svg { width: 16px; height: 16px; opacity: 0.7; }
.nav-link:hover { background: var(--bg-hover); color: var(--text-main); }
.nav-link.active { background: var(--bg-hover); color: var(--text-main); font-weight: 600; }
.nav-link.active svg { opacity: 1; color: var(--accent); }

/* Top Header in Main */
.top-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.breadcrumbs { font-size: 0.85rem; color: var(--text-muted); display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.search-box { display: flex; align-items: center; background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0.4rem 0.75rem; color: var(--text-muted); font-size: 0.85rem; width: 250px; cursor: pointer; transition: border-color 0.2s; }
.search-box:hover { border-color: var(--text-light); }
.search-box svg { width: 14px; height: 14px; margin-right: 0.5rem; flex-shrink: 0; }
.search-shortcut { margin-left: auto; background: var(--bg-base); border: 1px solid var(--border); padding: 0.1rem 0.3rem; border-radius: 4px; font-size: 0.7rem; }

/* Content */
h1 { font-size: 2.25rem; font-weight: 800; margin: 0 0 1rem 0; letter-spacing: -0.02em; }
p { color: var(--text-muted); font-size: 1rem; line-height: 1.7; margin-bottom: 1.5rem; }
.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; background: var(--bg-panel); border: 1px solid var(--border); color: var(--text-muted); margin-right: 0.5rem; margin-bottom: 0.5rem; }

/* Code Block */
.code-container { position: relative; margin: 2rem 0; box-shadow: var(--shadow-sm); border-radius: var(--radius-lg); overflow: hidden; }
.code-header { background: #1e293b; border-bottom: 1px solid #334155; padding: 0.5rem 1rem; display: flex; align-items: center; gap: 0.5rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.r { background: #ef4444; } .dot.y { background: #eab308; } .dot.g { background: #22c55e; }
pre { background: var(--code-bg); color: var(--code-text); margin: 0; padding: 1.25rem; font-family: "JetBrains Mono", Menlo, monospace; font-size: 0.85rem; overflow-x: auto; }
.btn-copy { position: absolute; top: 0.4rem; right: 0.5rem; background: transparent; border: 1px solid #334155; color: #94a3b8; border-radius: 6px; padding: 0.3rem; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.btn-copy:hover { color: #fff; border-color: #64748b; background: #334155; }
.btn-copy svg { width: 16px; height: 16px; }

/* Downloads */
.downloads-grid { display: grid; gap: 1rem; margin-top: 1.5rem; }
.download-card { border: 1px solid var(--border); padding: 1.25rem; border-radius: var(--radius-lg); background: var(--bg-base); display: flex; justify-content: space-between; align-items: center; box-shadow: var(--shadow-sm); transition: box-shadow 0.2s; }
.download-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-focus); }
.file-info { display: flex; align-items: center; gap: 1rem; }
.file-icon { background: var(--bg-panel); border: 1px solid var(--border); padding: 0.75rem; border-radius: var(--radius-md); color: var(--accent); flex-shrink: 0; }
.file-icon svg { width: 24px; height: 24px; }
.file-name { font-weight: 600; font-size: 0.95rem; margin: 0 0 0.25rem 0; color: var(--text-main); word-break: break-all; }
.file-meta { font-size: 0.8rem; color: var(--text-light); font-family: Menlo, monospace; word-break: break-all; }
.btn-download { background: var(--accent); color: var(--accent-text); border: none; padding: 0.5rem 1rem; border-radius: var(--radius-md); cursor: pointer; font-weight: 600; font-size: 0.85rem; display: flex; align-items: center; gap: 0.5rem; transition: opacity 0.2s; flex-shrink: 0; }
.btn-download:hover { opacity: 0.9; }
.btn-download svg { width: 16px; height: 16px; }

/* Fixed Status Widget Fix */
.status-widget { padding: 1.25rem 1.5rem; border-top: 1px solid var(--border); font-size: 0.85rem; display: flex; justify-content: space-between; align-items: center; background: var(--bg-panel); flex-shrink: 0; }
.status-left { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; color: var(--text-muted); }
.status-indicator { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 8px rgba(34, 197, 94, 0.4); }
.theme-toggle { background: transparent; border: none; color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0.4rem; border-radius: 6px; transition: 0.2s; }
.theme-toggle:hover { color: var(--text-main); background: var(--border); }
.theme-toggle svg { width: 18px; height: 18px; }

/* Corporate Footer */
.corporate-footer { border-top: 1px solid var(--border); background: var(--bg-panel); padding: 3rem 4rem; margin-top: auto; width: 100%; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; max-width: 1000px; }
.footer-col h5 { margin: 0 0 1rem 0; color: var(--text-main); font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.footer-col a { display: block; color: var(--text-muted); text-decoration: none; font-size: 0.85rem; margin-bottom: 0.5rem; transition: 0.1s; }
.footer-col a:hover { color: var(--text-main); }
.footer-bottom { margin-top: 3rem; pt: 1.5rem; border-top: 1px solid var(--border); display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-light); align-items: center; padding-top: 1.5rem; max-width: 1000px; flex-wrap: wrap; gap: 1rem; }

/* Search Modal */
.search-modal { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px); z-index: 200; align-items: flex-start; justify-content: center; padding-top: 12vh; opacity: 0; transition: opacity 0.2s; }
.search-modal.active { display: flex; opacity: 1; }
.search-modal-content { background: var(--bg-base); width: 100%; max-width: 600px; border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25); overflow: hidden; transform: scale(0.98); transition: transform 0.2s; margin: 0 1rem; }
.search-modal.active .search-modal-content { transform: scale(1); }
.search-header { display: flex; align-items: center; padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); background: var(--bg-panel); }
.search-header svg { width: 20px; height: 20px; color: var(--text-light); margin-right: 1rem; flex-shrink: 0;}
#search-input { flex-grow: 1; background: transparent; border: none; outline: none; font-size: 1.1rem; color: var(--text-main); font-family: inherit; min-width: 0; }
.search-close { background: var(--bg-base); border: 1px solid var(--border); color: var(--text-light); padding: 0.25rem 0.5rem; border-radius: 6px; font-size: 0.75rem; cursor: pointer; transition: 0.2s; font-weight: 600;}
.search-close:hover { color: var(--text-main); border-color: var(--text-muted); }
.search-results { max-height: 400px; overflow-y: auto; padding: 0.5rem; background: var(--bg-base); }
.search-result-item { display: flex; flex-direction: column; padding: 1rem; border-radius: var(--radius-md); cursor: pointer; border: 1px solid transparent; transition: 0.1s; margin-bottom: 0.25rem; }
.search-result-item:hover { background: var(--bg-hover); border-color: var(--border); }
.search-result-title { font-weight: 600; color: var(--text-main); font-size: 0.95rem; margin-bottom: 0.25rem; display: flex; align-items: center; gap: 0.5rem; }
.search-result-title svg { width: 16px; height: 16px; color: var(--text-light); flex-shrink: 0; }
.search-result-item:hover .search-result-title svg { color: var(--accent); }
.search-result-path { font-size: 0.75rem; color: var(--text-muted); }
.search-empty { padding: 3rem; text-align: center; color: var(--text-light); font-size: 0.95rem; }

/* Mobile Navigation Header */
.mobile-header { display: none; }
.mobile-overlay { display: none; }

/* Responsive Adjustments */
@media (max-width: 768px) {
    aside { transform: translateX(-100%); }
    aside.open { transform: translateX(0); box-shadow: 4px 0 25px rgba(0,0,0,0.1); }
    main { margin-left: 0; width: 100%; }
    
    .mobile-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; background: var(--bg-panel); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 40; }
    .mobile-header .brand { margin-bottom: 0; padding: 0; }
    .hamburger { background: transparent; border: 1px solid var(--border); color: var(--text-main); border-radius: 6px; padding: 0.4rem; cursor: pointer; display: flex; align-items: center; justify-content: center; }
    .hamburger svg { width: 20px; height: 20px; }
    
    .mobile-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.4); backdrop-filter: blur(2px); z-index: 90; display: block; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
    .mobile-overlay.active { opacity: 1; pointer-events: auto; }
    
    .main-content { padding: 1.5rem; }
    .top-header { flex-direction: column; align-items: flex-start; gap: 1rem; border-bottom: none; padding-bottom: 0; }
    .search-box { width: 100%; }
    h1 { font-size: 1.75rem; }
    
    .download-card { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .btn-download { width: 100%; justify-content: center; }
    
    .corporate-footer { padding: 2rem 1.5rem; }
    .footer-grid { grid-template-columns: 1fr; gap: 1.5rem; }
    .footer-bottom { flex-direction: column; align-items: center; text-align: center; }
}
