/* --- Global Reset for Atlas --- */
html, body {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: #282a36;
    font-family: sans-serif;
}

#graph-container {
    width: 100%;
    height: 100%;
}

/* --- Search Interface --- */
.index-nav {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 100;
    padding: 15px;
}

#command-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    z-index: 1200;
}

#command-overlay.open {
    display: flex;
}

#command-panel {
    width: min(780px, 92vw);
    background: #1d1e2a;
    border: 1px solid #3a3c52;
    box-shadow: 0 24px 64px rgba(0,0,0,0.55);
    padding: 14px 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.command-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.command-prompt {
    color: #8be9fd;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.4px;
}

#search-input {
    flex: 1;
    padding: 12px 14px;
    background-color: #0f1019;
    color: #f8f8f2;
    border: 1px solid #3a3c52;
    border-radius: 0;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

#search-input:focus {
    border-color: #8be9fd;
    box-shadow: 0 0 0 2px rgba(139, 233, 253, 0.2);
    background-color: #111222;
}

#search-results {
    list-style: none;
    margin: 4px 0 0 0;
    padding: 0;
    background-color: #141522;
    border: 1px solid #3a3c52;
    max-height: 360px;
    overflow-y: auto;
    display: none;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
    width: 100%;
}

#search-results.visible {
    display: block;
}

#search-results li {
    padding: 12px 14px;
    cursor: pointer;
    color: #f8f8f2;
    border-bottom: 1px solid #2a2b3b;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.1s ease, padding 0.1s ease;
}

#search-results li:last-child {
    border-bottom: none;
}

#search-results li:hover,
#search-results li.selected {
    background-color: #1f2233;
    padding-left: 15px;
}

.search-match-type {
    font-size: 0.7rem;
    padding: 3px 6px;
    border-radius: 4px;
    font-weight: bold;
    text-transform: uppercase;
    color: #282a36;
}

.match-type-axiom { background-color: #ff5555; color: #282a36; }
.match-type-definition { background-color: #ffb86c; color: #282a36; }
.match-type-lemma { background-color: #8be9fd; color: #282a36; }
.match-type-theorem { background-color: #bd93f9; color: #282a36; }
.match-type-ghost { background-color: rgba(68, 71, 90, 0.6); color: #282a36; }
.match-type-default { background-color: #6272a4; color: #282a36; }

/* --- Side Panel UI --- */
#side-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 50vw;
    height: 100vh;
    background-color: #282a36; 
    border-left: 1px solid #44475a;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    
    transform: translateX(100%); 
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    
    display: flex;
    flex-direction: column;
}

#side-panel.open {
    transform: translateX(0);
}

#panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 10px;
}

#node-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
    color: #282a36;
}

#close-panel-btn {
    background: none;
    border: none;
    color: #f8f8f2;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 10px;
    transition: color 0.2s ease;
}

#close-panel-btn:hover {
    color: #ff5555;
}

#panel-content {
    padding: 0 20px 20px;
    overflow-y: auto; /* Allows the inside of the panel to scroll */
}

#node-title {
    margin: 0 0 10px 0;
    font-size: 1.5rem;
    color: #f8f8f2;
}

.meta-id {
    color: #6272a4;
    font-family: monospace;
    font-size: 0.9rem;
    margin-top: 0;
    padding-bottom: 15px;
    border-bottom: 1px solid #44475a;
}

#node-math-image {
    width: 100%; /* Semicolon fixed for Chrome */
    max-width: 1200px;
    height: auto;
    display: block;
    margin: 0 auto;
}

#node-body {
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
}

#node-body p {
    color: inherit;
}

.action-btn {
    background-color: #44475a;
    color: #f8f8f2;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background-color 0.2s;
}

.action-btn:hover {
    background-color: #6272a4;
}

/* --- Global Floating Footer --- */
#global-footer {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 500;
    display: flex;
    gap: 10px;
}

#ide-btn {
    display: inline-block;
    padding: 8px 18px;
    background-color: rgba(40, 42, 54, 0.7);
    color: #6272a4;
    text-decoration: none;
    font-family: sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid #44475a;
    border-radius: 20px;
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
}

#ide-btn:hover {
    color: #bd93f9;
    border-color: #bd93f9;
    background-color: rgba(40, 42, 54, 1);
    box-shadow: 0 0 12px rgba(189, 147, 249, 0.2);
}

#contribute-btn {
    display: inline-block;
    padding: 8px 18px;
    background-color: rgba(40, 42, 54, 0.7);
    color: #6272a4;
    text-decoration: none;
    font-family: sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid #44475a;
    border-radius: 20px;
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
}

#contribute-btn:hover {
    color: #8be9fd;
    border-color: #8be9fd;
    background-color: rgba(40, 42, 54, 1);
    box-shadow: 0 0 12px rgba(139, 233, 253, 0.2);
}

/* --- Side Panel Tabs for atlas --- */
.tabs-nav {
    display: flex;
    border-bottom: 1px solid #44475a;
    margin-bottom: 20px;
    gap: 15px;
}

.tab-btn {
    background: none;
    border: none;
    color: #6272a4;
    padding: 10px 5px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: #f8f8f2;
}

.tab-btn.active {
    color: #f8f8f2;
    border-bottom: 2px solid #bd93f9; /* Purple accent */
}

/* --- Tab Panes --- */
.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-pane.active {
    display: block;
}

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

/* --- Source Code Pane --- */
pre {
    background-color: #1e1f29;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #44475a;
    overflow-x: auto;
    margin: 0;
}

#node-raw-code {
    color: #8be9fd;
    font-family: 'Menlo', 'Monaco', monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
}

/* --- Dependencies Pane --- */
.tab-pane h3 {
    color: #ffb86c;
    font-size: 1rem;
    margin-top: 0;
}

.deps-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.deps-list li {
    background: transparent;
    color: #f8f8f2;
    padding: 0;
    border-radius: 0;
    margin: 0;
    font-family: inherit;
    font-size: 1rem;
    border-left: none;
}

.deps-list li.no-deps {
    background: transparent;
    border-left: none;
    color: #6272a4;
    font-style: italic;
    font-family: sans-serif;
    padding-left: 0;
}

.dep-link {
    background: #2f3043;
    color: #f8f8f2;
    border: 1px solid #4c4f68;
    border-radius: 0;
    padding: 12px 18px;
    cursor: pointer;
    font-size: 1rem;
    letter-spacing: 0.2px;
    transition: transform 0.1s ease, box-shadow 0.12s ease, background 0.1s ease, border-color 0.1s ease;
    box-shadow: 0 6px 18px rgba(0,0,0,0.3);
}

.dep-link:hover {
    background: #3b3d55;
    border-color: #6d718d;
    box-shadow: 0 8px 20px rgba(0,0,0,0.38);
}

.dep-link:active {
    transform: translateY(1px);
    box-shadow: 0 5px 14px rgba(0,0,0,0.3);
}

/* --- Clean up from previous edits --- */
#panel-actions {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
}

/* --- Auth & Profile --- */
.nav-auth {
    display: flex;
    align-items: center;
    gap: 15px;
}

.auth-status {
    font-size: 0.9rem;
}

.btn-nav-auth {
    background-color: transparent;
    border: 1px solid #44475a;
    color: #f8f8f2;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-nav-auth:hover {
    background-color: #44475a;
    border-color: #6272a4;
}

.btn-profile {
    background-color: #282a36;
    border-color: #bd93f9;
}

.btn-profile:hover {
    background-color: #44475a;
}

.nav-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

/* --- Profile Modal --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-modal-content {
    background: #282a36;
    width: 400px;
    max-width: 90%;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    border: 1px solid #44475a;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    color: #6272a4;
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #ff5555;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
}

#profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 2px solid #bd93f9;
    object-fit: cover;
}

.profile-info h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #f8f8f2;
}

.profile-stats {
    display: flex;
    justify-content: space-between;
    background: #1e1f29;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #44475a;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.relative-box {
    position: relative;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #8be9fd;
}

#stat-trust {
    color: #50fa7b;
}

.hidden-modal {
    display: none !important;
}

.stat-label {
    font-size: 0.8rem;
    color: #6272a4;
    text-transform: uppercase;
    margin-top: 5px;
    letter-spacing: 0.5px;
}

.btn-logout {
    background: rgba(255, 85, 85, 0.1);
    color: #ff5555;
    border: 1px solid #ff5555;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: #ff5555;
    color: #f8f8f2;
}
