/* ========================================
   AI Career Agent
   Dark theme, teal accent, professional
   ======================================== */

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

:root {
    --bg: #0c1220;
    --bg-surface: #111827;
    --bg-card: #1a2332;
    --bg-card-hover: #1f2b3d;
    --bg-input: #0f1a2a;
    --border: #1e2d42;
    --border-light: #2a3a52;
    --text: #e2e8f0;
    --text-muted: #8892a4;
    --text-faint: #4a5568;
    --accent: #0d9488;
    --accent-light: #14b8a6;
    --accent-glow: rgba(13, 148, 136, 0.15);
    --accent-text: #5eead4;
    --error: #ef4444;
    --success: #22c55e;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --font-body: 'Inter', 'General Sans', -apple-system, sans-serif;
    --font-display: 'General Sans', 'Inter', -apple-system, sans-serif;
    --transition: 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    background:
        linear-gradient(rgba(6, 10, 18, 0.78), rgba(6, 10, 18, 0.82)),
        url("assets/linkedin-banner.png") center center / cover no-repeat fixed;
    overflow: hidden;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(
        circle at center,
        rgba(0,0,0,0) 40%,
        rgba(0,0,0,0.35) 100%
    );
}

a {
    color: var(--accent-text);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover {
    color: var(--accent-light);
}

button {
    cursor: pointer;
    background: none;
    border: none;
    font: inherit;
    color: inherit;
}

/* ========================================
   Layout: Sidebar + Main
   ======================================== */

#app {
    display: flex;
    height: 100dvh;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: 64px;
    min-width: 64px;
    background: rgba(17, 24, 39, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    gap: 8px;
}

.sidebar-top {
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    width: 100%;
    display: flex;
    justify-content: center;
}

.sidebar-logo {
    display: block;
    transition: transform var(--transition);
}
.sidebar-logo:hover {
    transform: scale(1.05);
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding-top: 16px;
}

.sidebar-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: all var(--transition);
}
.sidebar-btn:hover {
    background: var(--bg-card);
    color: var(--text);
}
.sidebar-btn.active {
    background: var(--accent-glow);
    color: var(--accent-text);
}

.sidebar-bottom {
    padding-top: 16px;
    border-top: 1px solid var(--border);
    width: 100%;
    display: flex;
    justify-content: center;
}

/* Main Content */
.main-content {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: rgba(12, 18, 32, 0.18);
}

.view {
    display: none;
    height: 100%;
    overflow-y: auto;
}
.view.active {
    display: block;
}

textarea:focus {
    outline: none;
    box-shadow: 0 0 0 1px var(--accent),
                0 0 20px var(--accent-glow);
}

/* ========================================
   Chat View
   ======================================== */

.chat-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 32px 24px 48px;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    position: relative;
}

.chat-header {
    text-align: center;
    margin-bottom: 32px;
    padding-top: 24px;
}

.chat-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--accent-text);
    display: block;
    margin-bottom: 12px;
}

.chat-title {
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 1.2rem + 2vw, 2.5rem);
    font-weight: 700;
    line-height: 1.15;
    color: var(--text);
    margin-bottom: 12px;
}

.chat-title .accent {
    background: linear-gradient(135deg, var(--accent-light), var(--accent-text));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.chat-subtitle {
    font-size: 15px;
    color: var(--text-muted);
    max-width: 480px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Chat Messages */
.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.message {
    animation: fadeUp 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

.message-user {
    align-self: flex-end;
    max-width: 85%;
}

.message-user .message-bubble {
    background: var(--accent);
    color: white;
    border-radius: var(--radius) var(--radius) 4px var(--radius);
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.5;
}

.message-ai {
    align-self: flex-start;
    max-width: 95%;
}

.message-ai .message-bubble {
    background: rgba(26, 35, 50, 0.86);
    border: 1px solid var(--border);
    border-radius: 4px var(--radius) var(--radius) var(--radius);
    padding: 16px 20px;
    font-size: 14px;
    line-height: 1.7;
}

.message-ai .message-bubble p {
    margin-bottom: 10px;
}
.message-ai .message-bubble p:last-child {
    margin-bottom: 0;
}

.message-ai .message-bubble strong {
    color: var(--accent-text);
    font-weight: 600;
}

.message-ai .message-bubble ul,
.message-ai .message-bubble ol {
    padding-left: 20px;
    margin: 8px 0;
}

.message-ai .message-bubble li {
    margin-bottom: 4px;
}

.message-ai .message-bubble h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-text);
    margin: 16px 0 8px;
}

.message-ai .message-bubble h3:first-child {
    margin-top: 0;
}

.message-ai .message-bubble h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin: 12px 0 6px;
}

.message-ai .message-bubble code {
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'JetBrains Mono', monospace;
}

.message-ai .message-bubble blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 12px;
    margin: 8px 0;
    color: var(--text-muted);
    font-style: italic;
}

.message-sources {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-faint);
}

/* Thinking indicator */
.thinking-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px var(--radius) var(--radius) var(--radius);
    color: var(--text-muted);
    font-size: 14px;
    animation: fadeUp 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

.dot-loader {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.dot-loader span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-text);
    animation: dotPulse 1.4s infinite ease-in-out both;
}

.dot-loader span:nth-child(1) { animation-delay: -0.32s; }
.dot-loader span:nth-child(2) { animation-delay: -0.16s; }
.dot-loader span:nth-child(3) { animation-delay: 0s; }

@keyframes dotPulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

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

/* Input Card */
.input-card {
    background: rgba(17, 24, 39, 0.72);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.input-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    transition: all 180ms ease;
}

.input-card-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 12px 12px 16px;
    transition: border-color var(--transition);
}

.chat-input-wrapper:focus-within {
    border-color: var(--accent);
}

#chat-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    resize: none;
    min-height: 24px;
    max-height: 120px;
    font-family: var(--font-body);
}

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

.send-btn {
    flex-shrink: 0;
    background: var(--accent);
    color: white;
    font-weight: 600;
    font-size: 14px;
    padding: 8px 20px;
    border-radius: 999px;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.send-btn:hover:not(:disabled) {
    background: var(--accent-light);
}

.send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.send-btn-loading {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.action-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    transition: all var(--transition);
}

.action-chip:hover {
    border-color: var(--border-light);
    color: var(--text);
    background: var(--bg-card-hover);
}

.action-chip svg {
    flex-shrink: 0;
}

/* Suggested Questions */
.suggested-section {
    margin-bottom: 32px;
}

.suggested-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
    margin-bottom: 12px;
}

.suggested-questions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.suggested-q {
    text-align: left;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
    line-height: 1.4;
    transition: all var(--transition);
}

.suggested-q:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
    transform: translateX(4px);
}

/* Footer */
.chat-footer {
    text-align: center;
    padding: 24px 0;
    margin-top: auto;
}

.chat-footer p {
    font-size: 12px;
    color: var(--text-faint);
}

/* ========================================
   Admin View
   ======================================== */

.admin-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 48px 24px;
}

.admin-panel {
    animation: fadeUp 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

.admin-header {
    text-align: center;
    margin-bottom: 32px;
}

.admin-icon {
    color: var(--text-faint);
    margin-bottom: 16px;
}

.admin-header h2 {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.admin-header p {
    color: var(--text-muted);
    font-size: 14px;
}

.admin-form {
    display: flex;
    gap: 10px;
    max-width: 400px;
    margin: 0 auto;
}

.admin-form input {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 15px;
    outline: none;
    transition: border-color var(--transition);
}

.admin-form input:focus {
    border-color: var(--accent);
}

.btn-primary {
    padding: 12px 24px;
    background: var(--accent);
    color: white;
    font-weight: 600;
    font-size: 14px;
    border-radius: var(--radius);
    transition: all var(--transition);
}

.btn-primary:hover {
    background: var(--accent-light);
}

.btn-secondary {
    display: block;
    margin: 32px auto 0;
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 13px;
    transition: all var(--transition);
}

.btn-secondary:hover {
    border-color: var(--border-light);
    color: var(--text);
}

.error-text {
    color: var(--error);
    font-size: 13px;
    text-align: center;
    margin-top: 12px;
}

/* Upload Section */
.upload-section {
    margin-bottom: 32px;
}

.upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 24px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text-muted);
    text-align: center;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--accent);
    background: var(--accent-glow);
    color: var(--accent-text);
}

.upload-text {
    font-size: 14px;
    font-weight: 500;
}

.upload-hint {
    font-size: 12px;
    color: var(--text-faint);
}

.upload-status {
    margin-top: 12px;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    text-align: center;
}

.upload-status.success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.upload-status.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.upload-status.loading {
    background: rgba(13, 148, 136, 0.1);
    color: var(--accent-text);
    border: 1px solid rgba(13, 148, 136, 0.2);
}

/* Documents List */
.documents-section {
    margin-bottom: 24px;
}

.documents-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
}

.documents-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.doc-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.doc-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.doc-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

.doc-icon.core {
    background: var(--accent-glow);
    color: var(--accent-text);
}

.doc-icon.uploaded {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
}

.doc-name {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-size {
    font-size: 11px;
    color: var(--text-faint);
}

.doc-delete {
    padding: 6px;
    color: var(--text-faint);
    border-radius: 4px;
    transition: all var(--transition);
}

.doc-delete:hover {
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.vectorstore-info {
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-faint);
    text-align: center;
}

.loading-docs {
    text-align: center;
    color: var(--text-faint);
    font-size: 13px;
    padding: 20px;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 768px) {
    .sidebar {
        width: 52px;
        min-width: 52px;
    }

    .chat-container {
        padding: 20px 16px 32px;
    }

    .chat-header {
        margin-bottom: 24px;
    }

    .input-card {
        padding: 16px;
    }

    .admin-container {
        padding: 32px 16px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        display: none;
    }

    /* Add mobile nav at bottom */
    #app {
        flex-direction: column;
    }

    #app::after {
        content: '';
        display: block;
        height: 56px;
    }

    body::after {
        content: '';
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 56px;
        background: var(--bg-surface);
        border-top: 1px solid var(--border);
        z-index: 100;
    }
}

/* ========================================
   Scrollbar
   ======================================== */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* Selection */
::selection {
    background: rgba(13, 148, 136, 0.3);
    color: var(--text);
}
