/* This file is intentionally blank. Styles will be added in the next step. */

/* 
  Kustodian Assistant - Unified Stylesheet
  Author: Clara, UI/UX Designer
*/

@font-face {
  font-family: 'FKGroteskNeue';
  src: url('https://www.perplexity.ai/fonts/FKGroteskNeue.woff2') format('woff2');
  font-display: swap;
}

/* 1. CSS Variables & Base Setup */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --border-color: #e5e7eb;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

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

body {
    font-family: 'FKGroteskNeue', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* 2. Main Layout (Header, Chat, Footer) */
.header {
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-md);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    background-color: transparent;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.logo-icon img {
    width: 40px;
    height: 40px;
}

.header-text h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.header-text p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    background-color: #fee2e2;
    color: #b91c1c;
}

.status-badge.online {
    background-color: #f0fdf4;
    color: #166534;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #ef4444;
}
.status-dot.online {
    background-color: #22c55e;
}

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 800px;
    width: 100%;
    margin: 1rem auto 4rem;
    padding: 0 1rem;
    overflow: hidden;
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.chat-history-header {
    display: flex;
    justify-content: flex-end;
    padding: 0 0.5rem 0.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
    visibility: hidden; /* Hide by default */
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.chat-history-header.visible {
    visibility: visible;
    opacity: 1;
}

.chat-history-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.footer {
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: 2rem 1.5rem 0;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.footer-section h3 {
    color: var(--text-primary);
    margin: 0 0 1rem 0;
    font-size: 1.125rem;
}

.footer-section p {
    color: var(--text-secondary);
    margin: 0.5rem 0;
    font-size: 0.875rem;
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.social-link {
    color: var(--text-secondary);
    font-size: 1.25rem;
    transition: color 0.2s ease;
}

.social-link:hover {
    color: var(--primary-color);
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 0.5rem;
    margin-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* 3. Chat Messages */
.message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-lg);
    line-height: 1.6;
    transition: box-shadow 0.2s ease;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    font-weight: 500;
}

.message.user .message-header {
    color: rgba(255, 255, 255, 0.85);
}

.message.assistant .message-header {
    color: var(--text-secondary);
}

.message.user {
    align-self: flex-end;
    background: var(--primary-color);
    color: white;
    border-radius: var(--radius-lg) var(--radius-lg) 0 var(--radius-lg);
    box-shadow: 0 4px 14px 2px rgba(37, 99, 235, 0.25);
}

.message.assistant {
    align-self: flex-start;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 0;
    box-shadow: 0 4px 14px 2px rgba(0, 0, 0, 0.07);
}

.message.assistant.error {
    background-color: #fff5f5;
    border: 1px solid #ef4444;
    color: #b91c1c;
}

.message.assistant.error .message-header {
    color: #b91c1c;
}

.welcome-message {
    text-align: center;
    padding: 2rem 1rem;
}
.welcome-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* 4. Chat Input Bar (Matches Reference) */
.input-section {
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.input-bar {
  display: flex;
  align-items: center;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 1.5rem;
  padding: 0.5rem 0.75rem 0.5rem 1.25rem;
  position: relative;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-bar:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.5;
  min-height: 2.2rem; /* 35px */
  max-height: 120px;
  resize: none;
  outline: none;
  padding-right: 0.5rem;
  font-family: inherit;
  overflow-y: auto;
}

.chat-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.9;
}

.send-btn {
  background: var(--primary-color);
  border: none;
  color: white;
  border-radius: 50%;
  width: 2rem; /* 32px */
  height: 2rem; /* 32px */
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}

.send-btn:hover, .send-btn:focus {
  background: var(--primary-dark);
  color: #fff;
}

.send-btn i {
  font-size: 1rem;
}

.loading-spinner {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* 5. Quick Actions & Sample Questions */
.quick-actions, .sample-questions {
    padding: 1rem 0.25rem;
}

.sample-questions h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0 0 0.75rem 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.sample-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.btn, .sample-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:hover, .sample-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    padding: 0.5rem;
    border-radius: var(--radius-md);
}

.btn-icon:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* 6. Responsive Design */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    .chat-area {
        margin: 1rem auto;
        height: calc(100vh - 180px); /* Adjust based on header/footer */
    }
    .header-text h1 {
        font-size: 1.25rem;
    }
}