/* Premium Base Styles */
:root {
    --bg-base: #0b0f19;
    --bg-surface: #151e2e;
    --bg-panel: rgba(21, 30, 46, 0.6);

    --primary: #6366f1;
    --primary-gradient: linear-gradient(135deg, #6366f1, #a855f7);
    --secondary: #ec4899;

    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-faint: #475569;

    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-base);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    line-height: 1.5;
}

/* Layout */
.app-wrapper {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* Chat Panel */
.chat-panel {
    width: 400px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    background-color: var(--bg-surface);
    position: relative;
    z-index: 10;
}

.chat-header {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    font-size: 1.5rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.chat-history {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.chat-history::-webkit-scrollbar {
    width: 4px;
}

.chat-history::-webkit-scrollbar-thumb {
    background-color: var(--border);
    border-radius: 4px;
}

/* Messages */
.message {
    display: flex;
    gap: 1rem;
    animation: fadeIn 0.4s ease forwards;
}

.message.user {
    flex-direction: row-reverse;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.avatar.ai {
    background: var(--primary-gradient);
    color: white;
}

.avatar.user-avatar {
    background: var(--border);
}

.msg-bubble {
    padding: 1rem;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    max-width: 85%;
    line-height: 1.6;
}

.message.ai .msg-bubble {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-main);
    border-top-left-radius: 4px;
}

.message.user .msg-bubble {
    background: var(--primary-gradient);
    color: white;
    border-top-right-radius: 4px;
    margin-left: auto;
}

/* Chat Input Area */
.chat-input-area {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    background-color: var(--bg-base);
}

.usage-meter {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.progress-track {
    height: 4px;
    background-color: var(--border);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-gradient);
    width: 0%;
    transition: width 0.3s ease;
}

.input-box {
    display: flex;
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.5rem;
    transition: all 0.2s ease;
}

.input-box:focus-within {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.chat-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 0.75rem;
    font-size: 0.95rem;
    outline: none;
    resize: none;
    font-family: inherit;
    line-height: 1.5;
}

.chat-input::placeholder {
    color: var(--text-faint);
}

.send-btn {
    background-color: var(--primary);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    align-self: flex-end;
}

.send-btn:hover:not(:disabled) {
    background-color: var(--primary-hover);
    transform: scale(1.05);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--border);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 0.3rem;
    padding: 0.5rem;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background-color: var(--text-muted);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

/* Main Content Area (Results) */
.main-panel {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-base);
    position: relative;
    overflow: hidden;
}

/* Optional Background Decoration */
.bg-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, rgba(15, 23, 42, 0) 70%);
    top: -200px;
    right: -200px;
    z-index: 0;
    pointer-events: none;
}

.results-header {
    padding: 1.5rem 3rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1;
    background-color: rgba(11, 15, 25, 0.8);
    backdrop-filter: blur(12px);
}

.results-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.results-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.results-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 2rem 3rem;
    position: relative;
    z-index: 1;
}

/* Grid & Cards (similar to exemplo.html but elegant) */
.profiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.profile-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    backdrop-filter: var(--glass-blur);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    animation: slideUp 0.4s ease forwards;
    opacity: 0;
}

.profile-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    border-color: var(--border-hover);
}

.profile-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.profile-avatar-img {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background-color: var(--border);
    object-fit: cover;
}

.profile-info h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.profile-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.verified-badge {
    color: #3b82f6;
    font-size: 0.9rem;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    padding: 0.75rem 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profile-bio {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.profile-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
}

.tag {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Cypher Query Box */
.cypher-box {
    margin-bottom: 2rem;
    background: rgba(139, 92, 246, 0.05);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-md);
    padding: 1rem;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    color: #c4b5fd;
    white-space: pre-wrap;
    animation: fadeIn 0.4s ease forwards;
}

.cypher-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: #a78bfa;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
}

/* Empty State / Welcome */
.empty-state {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-align: center;
    max-width: 400px;
    margin: 0 auto;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Modals / Clerk */
.btn-primary {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
    font-size: 0.85rem;
}

.btn-primary:hover {
    opacity: 0.9;
}

.hidden {
    display: none !important;
}

/* Loading Overlay */
#initial-loader {
    position: fixed;
    inset: 0;
    background: var(--bg-base);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: rotate 1s linear infinite;
}

@keyframes rotate {
    to {
        transform: rotate(360deg);
    }
}