/* ════════════════════════════════════════════════════════════════════
   OM · Oficina de Monitoreo · styles.css
   Estilo: Ultra-Minimalista, Cabecera centrada, 100% Responsivo.
   ════════════════════════════════════════════════════════════════════ */

:root {
  /* Dark Theme Tokens (Default) */
  --bg-primary:   #212121;
  --bg-secondary: #2f2f2f;
  --bg-message:   #2f2f2f;
  --border:       rgba(255, 255, 255, 0.1);
  --text-main:    #ececec;
  --text-muted:   #b4b4b4;
  --accent:       #ffffff;
  --accent-muted: rgba(255, 255, 255, 0.1);
  --input-bg:     #2f2f2f;
  
  --header-height: 60px;
  --max-width:     800px;
  
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 28px;
  
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-primary:   #ffffff;
  --bg-secondary: #f0f0f0;
  --bg-message:   #f7f7f8;
  --border:       rgba(0, 0, 0, 0.1);
  --text-main:    #0d0d0d;
  --text-muted:   #676767;
  --accent:       #000000;
  --accent-muted: rgba(0, 0, 0, 0.05);
  --input-bg:     #ffffff;
}

/* ── BASE ── */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.6;
}

/* ── LAYOUT ── */
.main {
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ── HEADER ── */
.header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background-color: var(--bg-primary);
  z-index: 10;
}

.header__left, .header__right {
  display: flex;
  align-items: center;
  width: 40px;
}

.header__center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header__logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.2px;
}

.logo-om {
  background-color: var(--text-main);
  color: var(--bg-primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 800;
  font-size: 13px;
}

.logo-sep {
  width: 1px;
  height: 14px;
  background-color: var(--border);
}

.logo-text {
  color: var(--text-main);
  opacity: 0.9;
}

/* ── CHAT CONTENT ── */
.chat-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.messages {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 30px 20px 140px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* ── MESSAGES ── */
.message {
  display: flex;
  gap: 16px;
  font-size: 16px;
  animation: fadeIn 0.3s ease-out;
}

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

.message--bot p {
  color: var(--text-main);
}

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

.message__content {
  max-width: 88%;
}

.message--user .message__content {
  background-color: var(--bg-message);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

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

.chat-list {
  margin: 12px 0 16px 20px;
  list-style-type: disc;
}
.chat-list li {
  margin-bottom: 8px;
  padding-left: 4px;
}
.chat-list li::marker {
  color: var(--text-muted);
}

strong { font-weight: 600; color: var(--accent); }

/* ── INPUT AREA ── */
.input-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding-bottom: 40px;
  background: linear-gradient(transparent, var(--bg-primary) 40%);
  pointer-events: none;
}

.input-bounds {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  pointer-events: auto;
}

.input-wrap {
  display: flex;
  align-items: flex-end;
  background-color: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 14px 12px 20px;
  gap: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input-wrap:focus-within {
  border-color: var(--text-muted);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
}

.chat-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.5;
  padding: 4px 0;
  max-height: 180px;
}

.send-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background-color: var(--accent);
  color: var(--bg-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--transition), transform 0.1s;
}

.send-btn:active { transform: scale(0.95); }
.send-btn:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}

.input-disclaimer {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 14px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  opacity: 0.6;
}

/* ── UI ELEMENTS ── */
.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition), background var(--transition);
}

.icon-btn:hover {
  color: var(--text-main);
  background-color: var(--accent-muted);
}

/* Tables & SQL */
.result-table-wrap {
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
  background: var(--bg-message);
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.result-table th {
  background: var(--accent-muted);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.result-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.sql-details { margin: 16px 0; }
.sql-details summary {
  padding: 8px 0;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

.sql-details pre {
  padding: 16px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: #a5d6ff;
  font-family: var(--font-mono);
  font-size: 13px;
  overflow-x: auto;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  :root { --max-width: 100%; }
  .header { padding: 0 12px; }
  .logo-text { display: none; }
  .logo-sep { display: none; }
  .messages { padding: 20px 16px 160px; }
  .message__content { max-width: 92%; }
  .input-container { padding-bottom: 24px; }
  .input-bounds { padding: 0 12px; }
}

@media (max-width: 480px) {
  .message { font-size: 15px; gap: 12px; }
  .message--user .message__content { padding: 10px 16px; }
  .input-wrap { padding: 10px 12px 10px 16px; }
  .chat-textarea { font-size: 15px; }
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
