/* ==========================================
   CIRDI - SCIENTIFIC DOCUMENT RAG STYLES
   Layout for: body, nav, header, main, footer
   ========================================== */

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

:root {
  /* Base */
  --color-bg: #f9fafb;
  --color-surface: #ffffff;
  --color-border: #d1d5db;
  --color-text: #1f2937;
  --color-text-soft: #6b7280;

  /* Primary */
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-bg: #eff6ff;

  /* Feedback */
  --color-success: #059669;
  --color-error: #dc2626;
  --color-error-bg: #fef2f2;

  /* Panels */
  --color-panel-bg: #e0f2f1;
  --color-profile-dialog-bg: #dbeafe;

  --shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

body {
  background-color: var(--color-bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  margin: 0;
}

/* ==========================================
   Page Layout
   ========================================== */

/* Desktop */

body > nav {
  width: 48rem;

  display: grid;
  grid-template-columns: auto 1fr auto auto;
  grid-template-areas: "settings spacer help profile";
  gap: 1rem;
  align-items: center;

  padding: 0;
  margin: 0.5rem auto;
}

body > header {
  width: 48rem;
  margin: 2rem auto;
  padding: 0.5rem;
}

body > main {
  max-width: 48rem;
  margin-left: auto;
  margin-right: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 0.5rem;
}

body > footer {
  max-width: 64rem;
  margin: 1rem auto;
  padding: 0.5rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--color-text-soft);
}

/* Tablet */

/* Use the same layout as desktop */

/* Mobile */

@media (max-width: 48rem) {
  body > nav {
    width: 100%;
  }

  body > header {
    width: 100%;
  }
}


/* ==========================================
   Header contents
   ========================================== */

#input {
  display: flex;
  gap: 0;
  margin-bottom: 0.25rem;

  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  background-color: var(--color-surface);
  transition: border-color 0.2s, box-shadow 0.2s;
}


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

#user-input {
  flex: 1;
  padding: 0.75rem 1rem;
  /* Remove individual styling */
  border: none;
  border-radius: 0;
  resize: none;
  font-family: inherit;
  min-height: 64px;
  max-height: 120px;
  background: transparent;
  outline: none;
}

#send-btn {
  font-size: 1.125rem;
  line-height: 1;
  margin: 0;

  /* Integration styling */
  border: none;
  background: none;
  border-radius: 0;
  border-left: 1px solid #e5e7eb;
  padding: 0.75rem 1rem;

  color: var(--color-text-soft);
  transition: color 0.2s, background-color 0.2s;
}

/* Help text - tight under input */
#input-help {
  text-align: center;
  font-size: 0.75rem;
  color: var(--color-text-soft);
  line-height: 1.3;
  margin: 0;
  padding: 0;
}

/* ==========================================
   Footer contents
   ========================================== */

body > footer a {
  color: var(--color-primary);
  text-decoration: none;
}

body > footer a:hover {
  color: var(--color-primary-hover);
}

/* ==========================================
   Nav contents
   ========================================== */

#settings-btn {grid-area: settings;}
.spacer {grid-area: spacer;}
#help-btn {grid-area: help;}
#profile-btn {grid-area: profile;}

/* Styling for buttons (everywhere for consistency) */
button {
  margin: 0;
  padding: 0.5rem 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}

button:hover{
  transform: translateY(-1px);
}

.primary-button {
  background-color: var(--color-primary);
  color: var(--color-surface);
  border-color: var(--color-primary);
}

.primary-button:hover {
  background-color: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

.secondary-button {
  background-color: var(--color-surface);
  color: var(--color-text-soft);
  border-color: var(--color-border);
}

.secondary-button:hover {
  background-color: var(--color-border);
  border-color: var(--color-text-soft);
}

.ghost-button {
  background: none;
  font-size: 1rem;
}

.ghost-button:hover {
  border-color: var(--color-border);
  background-color: var(--color-surface);
}


/* Make form elements match button border-radius */
input,
select,
textarea {
  border-radius: 0.375rem;
}

/* All interactive elements */

:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--color-primary);
}

/* ==========================================
   Main contents
   ========================================== */

/* see main.css */

/* ==========================================
   Panels and Modals
   ========================================== */

/* see aside.css */
/* They are on their own layer z-index 1000 and positioned absolutely, no interference */
