/* ORF Research Chat - Clean Modern Design */

:root {
    --bg: #0a0a0a;
    --bg-secondary: #111111;
    --bg-card: #1a1a1a;
    --text: #ffffff;
    --text-secondary: #888888;
    --text-muted: #555555;
    --border: #222222;
    --accent: #e94560;
    --accent-hover: #ff6b7a;
    --radius: 12px;
    --radius-sm: 8px;
}

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

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

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

/* Header */
.header {
    background: #000000;
    height: 56px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo-text {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
}

.nav-main {
    display: flex;
    gap: 8px;
}

.nav-link {
    color: rgba(255, 255, 255, 0.7);
    padding: 8px 16px;
    font-size: 14px;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
}

.nav-link:hover, .nav-link.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-email {
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
}

.nav-icon {
    color: rgba(255, 255, 255, 0.6) !important;
    padding: 8px;
    font-size: 14px;
}

.nav-icon:hover {
    color: #ffffff !important;
    background: transparent;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 20px;
    cursor: pointer;
}

/* Main Content */
.main {
    padding-top: 56px;
    min-height: 100vh;
}

/* Login Page */
.login-container {
    min-height: calc(100vh - 56px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 32px;
}

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

.login-header h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    color: var(--text);
    transition: border-color 0.15s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--accent);
}

.login-form input::placeholder {
    color: var(--text-muted);
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

.btn-login {
    width: 100%;
    padding: 12px 24px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 500;
    color: white;
    cursor: pointer;
    transition: background 0.15s;
}

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

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

.success-message {
    text-align: center;
    padding: 24px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--radius-sm);
    margin-top: 24px;
    color: #10b981;
}

.success-message i {
    font-size: 32px;
    margin-bottom: 12px;
}

.error-message {
    text-align: center;
    padding: 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
    margin-top: 16px;
    color: #ef4444;
    font-size: 14px;
}

/* Chat Container */
.chat-container {
    height: calc(100vh - 56px);
    display: flex;
    flex-direction: column;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    padding: 0 24px;
}

/* Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 0;
}

.welcome-message {
    text-align: center;
    padding: 80px 24px;
}

.welcome-message h1 {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 12px;
}

.welcome-message p {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 32px;
}

.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.chip {
    padding: 10px 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 100px;
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
}

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

/* Messages */
.message {
    margin-bottom: 24px;
    animation: fadeIn 0.2s ease;
}

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

.user-message {
    display: flex;
    justify-content: flex-end;
}

.user-message .message-content {
    max-width: 80%;
    background: var(--accent);
    padding: 12px 18px;
    border-radius: var(--radius);
    border-bottom-right-radius: 4px;
}

.assistant-message .message-content {
    max-width: 100%;
}

.message-text {
    font-size: 15px;
    line-height: 1.6;
}

.message-text p {
    margin-bottom: 12px;
}

.message-text p:last-child {
    margin-bottom: 0;
}

/* Sources */
.message-sources {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.source-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all 0.15s;
    max-width: 280px;
}

.source-card:hover {
    border-color: var(--text-muted);
    background: var(--bg-card);
}

.source-image {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    background: var(--bg-card);
}

.source-info {
    flex: 1;
    min-width: 0;
}

.source-department {
    display: block;
    font-size: 11px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.source-title {
    display: block;
    font-size: 13px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Input Area */
.chat-input-container {
    padding: 16px 0 24px;
    border-top: 1px solid var(--border);
}

.chat-input-form {
    display: flex;
    flex-direction: column;
}

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

.input-wrapper:focus-within {
    border-color: var(--text-muted);
}

#userInput {
    flex: 1;
    background: transparent;
    border: none;
    font-size: 15px;
    color: var(--text);
    resize: none;
    line-height: 1.5;
    max-height: 200px;
}

#userInput:focus {
    outline: none;
}

#userInput::placeholder {
    color: var(--text-muted);
}

.btn-send {
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

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

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

.btn-send svg {
    stroke: white;
}

/* Loading indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 0;
}

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

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Admin Page */
.admin-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 24px;
}

.admin-header h1 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
}

.admin-header p {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.admin-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}

.admin-section h2 {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 16px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.stat-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
}

.stat-value {
    font-size: 28px;
    font-weight: 600;
    color: var(--accent);
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Mobile */
@media (max-width: 768px) {
    .nav-main, .nav-right {
        display: none;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .welcome-message {
        padding: 40px 16px;
    }
    
    .welcome-message h1 {
        font-size: 24px;
    }
    
    .suggestion-chips {
        flex-direction: column;
    }
    
    .chip {
        width: 100%;
    }
    
    .source-card {
        max-width: 100%;
    }
}

/* Mobile Menu */
.mobile-menu {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    background: #000;
    padding: 16px 24px;
    z-index: 99;
}

.mobile-menu.open {
    display: block;
}

.mobile-menu-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mobile-user-email {
    color: var(--text-secondary);
    font-size: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.mobile-nav-link {
    color: #fff;
    font-size: 15px;
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    border: none;
    cursor: pointer;
}
