/* ==========================================================================
   Arefa-1 Hermes Memory Vault Dashboard — Modern Minimalistic Stylesheet
   ========================================================================== */

:root {
    /* Color Palette */
    --bg-base: #060913;
    --card-bg: rgba(15, 23, 42, 0.68);
    --card-bg-hover: rgba(30, 41, 59, 0.82);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-border-hover: rgba(139, 92, 246, 0.45);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-purple: #8b5cf6;
    --accent-indigo: #6366f1;
    --accent-cyan: #06b6d4;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-pink: #ec4899;
    
    --glow-purple: rgba(139, 92, 246, 0.3);
    --glow-cyan: rgba(6, 182, 212, 0.3);
    --glow-emerald: rgba(16, 185, 129, 0.3);
    
    --radius-xl: 20px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    
    --font-head: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 2.5rem 1.5rem;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* Background Ambient Lighting Blobs */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
    animation: blobFloat 20s infinite ease-in-out alternate;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: var(--accent-indigo);
}

.blob-2 {
    top: 10%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: var(--accent-purple);
    animation-delay: -7s;
}

.blob-3 {
    bottom: -15%;
    left: 30%;
    width: 700px;
    height: 700px;
    background: var(--accent-cyan);
    animation-delay: -14s;
}

@keyframes blobFloat {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(40px, 60px) scale(1.1); }
    100% { transform: translate(-30px, 20px) scale(0.95); }
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    animation: fadeInPage 0.8s ease-out forwards;
}

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

/* Header Area */
header {
    margin-bottom: 2.25rem;
    position: relative;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.avatar-glow {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    position: relative;
    box-shadow: 0 0 25px rgba(139, 92, 246, 0.45);
    flex-shrink: 0;
}

.pulse-ring {
    position: absolute;
    inset: -4px;
    border-radius: calc(var(--radius-md) + 4px);
    border: 2px solid var(--accent-cyan);
    opacity: 0.5;
    animation: ringPulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes ringPulse {
    0%, 100% { transform: scale(1); opacity: 0.4; }
    50% { transform: scale(1.06); opacity: 0.8; }
}

.title-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

h1 {
    font-family: var(--font-head);
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #ffffff 20%, #c084fc 60%, #38bdf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% auto;
    animation: gradientShift 8s linear infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.version-tag {
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: #c084fc;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.3rem;
}

/* Status Indicator */
.status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.8rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.status-active {
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.3);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: #34d399;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px #34d399;
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(52, 211, 153, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.btn-secondary {
    background: rgba(30, 41, 59, 0.7);
    color: var(--text-primary);
    border-color: var(--card-border);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(51, 65, 85, 0.85);
    border-color: var(--accent-purple);
    box-shadow: 0 0 15px var(--glow-purple);
    transform: translateY(-2px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-indigo));
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.35);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
    transform: translateY(-2px);
}

/* Grid Layout for Stat Cards */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2.25rem;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent-purple), var(--accent-cyan), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card:hover {
    background: var(--card-bg-hover);
    border-color: var(--card-border-hover);
    transform: translateY(-4px);
    box-shadow: 0 14px 28px -10px rgba(0, 0, 0, 0.6), 0 0 20px var(--glow-purple);
}

.card:hover::before {
    opacity: 1;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.85rem;
}

.card-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    transition: transform 0.3s ease;
}

.card:hover .card-icon {
    transform: scale(1.1) rotate(5deg);
}

.card-purple .card-icon { color: var(--accent-purple); background: rgba(139, 92, 246, 0.15); box-shadow: 0 0 12px rgba(139, 92, 246, 0.25); }
.card-cyan .card-icon { color: var(--accent-cyan); background: rgba(6, 182, 212, 0.15); box-shadow: 0 0 12px rgba(6, 182, 212, 0.25); }
.card-emerald .card-icon { color: var(--accent-emerald); background: rgba(16, 185, 129, 0.15); box-shadow: 0 0 12px rgba(16, 185, 129, 0.25); }
.card-amber .card-icon { color: var(--accent-amber); background: rgba(245, 158, 11, 0.15); box-shadow: 0 0 12px rgba(245, 158, 11, 0.25); }

.card .number {
    font-family: var(--font-head);
    font-size: 2.6rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 0.4rem;
}

.card-purple .number { background: linear-gradient(135deg, #e9d5ff 0%, #c084fc 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.card-cyan .number { background: linear-gradient(135deg, #bae6fd 0%, #38bdf8 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.card-emerald .number { background: linear-gradient(135deg, #a7f3d0 0%, #34d399 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.card-amber .number { background: linear-gradient(135deg, #fde68a 0%, #fbbf24 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.card .label {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.trend.positive {
    color: #34d399;
    font-weight: 600;
}

/* Section Titles */
.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--font-head);
    color: var(--text-primary);
    margin: 2.5rem 0 1.25rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-title h2 {
    font-size: 1.3rem;
    font-weight: 700;
}

.section-title.small h2 {
    font-size: 1.15rem;
}

.section-title-left {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.section-icon {
    font-size: 1.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Live Search Box */
.search-filter-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 0.45rem 0.85rem;
    width: 320px;
    transition: all 0.25s ease;
}

.search-input-wrapper:focus-within {
    border-color: var(--accent-purple);
    box-shadow: 0 0 15px var(--glow-purple);
    background: rgba(30, 41, 59, 0.9);
}

.search-input-wrapper svg {
    color: var(--text-muted);
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.search-input-wrapper input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    width: 100%;
}

.search-input-wrapper input::placeholder {
    color: var(--text-muted);
}

.clear-search-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    display: none;
    padding: 0 0.25rem;
}

.clear-search-btn:hover {
    color: var(--text-primary);
}

/* 3D Knowledge Graph Panel */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    transition: border-color 0.3s ease;
    position: relative;
}

.glass-panel:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.graph-wrapper {
    position: relative;
    width: 100%;
    height: 560px;
    background-color: #040711;
    background-image: 
        radial-gradient(circle at 50% 50%, rgba(139, 92, 246, 0.09) 0%, transparent 70%),
        radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 100% 100%, 30px 30px;
}

#3d-graph {
    width: 100%;
    height: 100%;
}

.graph-overlay-hint {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    color: var(--text-secondary);
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 10;
}

.graph-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.graph-legend {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    padding: 0.6rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    display: flex;
    gap: 0.85rem;
    align-items: center;
    z-index: 10;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.38rem;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.legend-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
}

.graph-btn {
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(8px);
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    padding: 0.45rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.graph-btn:hover {
    background: rgba(30, 41, 59, 0.95);
    color: var(--text-primary);
    border-color: var(--accent-purple);
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.35);
}

/* Two Column Layout */
.two-col-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1rem;
}

/* Table Styling */
table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    background: rgba(30, 41, 59, 0.55);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--card-border);
}

td {
    padding: 0.95rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.9rem;
    color: #cbd5e1;
    transition: background 0.2s ease;
}

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

tbody tr {
    transition: background 0.2s ease;
}

tbody tr:hover td {
    background: rgba(139, 92, 246, 0.08);
    color: #ffffff;
}

.badge-mono {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
}

.tag-badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 600;
}

/* Modal Drawer Styling */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 7, 17, 0.75);
    backdrop-filter: blur(12px);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    opacity: 0;
    visibility: hidden;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-card {
    width: 520px;
    max-width: 90vw;
    height: 100vh;
    background: #0b1120;
    border-left: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -15px 0 40px rgba(0, 0, 0, 0.7);
}

.modal-overlay.active .modal-card {
    transform: translateX(0);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    background: rgba(15, 23, 42, 0.6);
}

.modal-title-box {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.modal-badge {
    align-self: flex-start;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.modal-header h3 {
    font-family: var(--font-head);
    font-size: 1.4rem;
    color: var(--text-primary);
    font-weight: 700;
}

.modal-close-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    font-size: 1.5rem;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.4);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.modal-meta-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    background: rgba(15, 23, 42, 0.8);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--card-border);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.modal-content-preview h4,
.modal-connections h4 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.markdown-rendered {
    background: rgba(4, 7, 17, 0.9);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 1rem;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #cbd5e1;
}

.markdown-rendered p {
    margin-bottom: 0.75rem;
}

.markdown-rendered code {
    font-family: var(--font-mono);
    background: rgba(139, 92, 246, 0.15);
    color: #c084fc;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.82rem;
}

.connection-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chip {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid var(--card-border);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.chip:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: var(--accent-purple);
    color: #ffffff;
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--card-border);
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    justify-content: flex-end;
}

/* Footer */
.footer {
    margin-top: 3.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-time {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.vault-badge {
    font-size: 0.8rem;
    color: var(--accent-cyan);
    font-weight: 500;
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-link {
    color: var(--accent-cyan);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: color 0.2s ease;
    font-weight: 500;
}

.footer-link:hover {
    color: #38bdf8;
    text-decoration: underline;
}

/* Responsive Styles */
@media (max-width: 900px) {
    .two-col-grid {
        grid-template-columns: 1fr;
    }

    .search-input-wrapper {
        width: 100%;
    }

    .section-title {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 640px) {
    body {
        padding: 1.5rem 1rem;
    }

    h1 {
        font-size: 1.8rem;
    }

    .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.85rem;
    }

    .card {
        padding: 1.1rem;
    }

    .card .number {
        font-size: 1.9rem;
    }

    .graph-wrapper {
        height: 400px;
    }

    .modal-card {
        width: 100vw;
    }

    .footer {
        flex-direction: column;
        align-items: flex-start;
    }
}
