/* assets/css/style.css
   Thème inspiré du site MayaBay (palette vert + rose poudré, typo élégante).
*/

@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600&family=Montserrat:wght@300;400;500;600&display=swap");

:root {
  --green: #2f3f33;        /* proche du header (≈ #304030) */
  --green-2: #243427;
  --cream: #f6f1ec;
  --cream-2: #fbf7f4;
  --pink: #e7c0c4;         /* rose poudré */
  --pink-2: #d9aab0;

  --text: #141414;
  --muted: rgba(20, 20, 20, 0.65);
  --border: rgba(47, 63, 51, 0.18);
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.12);

  --radius: 18px;

  --font-serif: "Cormorant Garamond", serif;
  --font-sans: "Montserrat", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

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

html,
body {
  height: 100%;
}

html.no-scroll,
body.no-scroll {
  overflow: hidden;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--cream);
  color: var(--text);
}

/* ----------------------------
   Header (Mayabay-like)
---------------------------- */

.site-header {
  background: var(--green);
  color: rgba(255, 255, 255, 0.92);
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
}

.site-left,
.site-center,
.site-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 400;
  font-size: 0.9rem;
  opacity: 0.95;
}

.site-logo {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.95;
}

.site-logo img {
  width: 26px;
  height: auto;
  display: block;
}

.site-right {
  gap: 10px;
}

.primary-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 16px;
  border-radius: 0px;
  background: var(--pink);
  color: rgba(20, 20, 20, 0.92);
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1px solid rgba(231, 192, 196, 0.9);
}

.primary-cta:hover {
  background: var(--pink-2);
  border-color: rgba(217, 170, 176, 0.95);
}

/* Burger */
.burger:hover {
  border-color: rgba(255, 255, 255, 0.35);
}

/* Subnav row */
.subnav {
  background: var(--cream-2);
  border-bottom: 1px solid rgba(47, 63, 51, 0.12);
  display: flex;
  justify-content: center;
  gap: 22px;
  padding: 10px 12px;
}

.subnav a {
  color: rgba(20, 20, 20, 0.72);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
}

.subnav a:hover {
  color: rgba(20, 20, 20, 0.92);
}

.subnav a.active {
  color: rgba(20, 20, 20, 0.92);
}

/* ----------------------------
   Menu overlay
---------------------------- */

.hidden {
  display: none !important;
}

.menu-links a:hover {
  color: rgba(231, 192, 196, 0.95);
}

/* ----------------------------
   Page container
---------------------------- */

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 26px 16px 30px;
}

.app {
  background: var(--cream-2);
  border: 1px solid rgba(47, 63, 51, 0.16);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Header in card */
.app-header {
  padding: 18px 18px 12px;
  border-bottom: 1px solid rgba(47, 63, 51, 0.12);
}

.app-header h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 1.55rem;
  color: rgba(20, 20, 20, 0.92);
}

.app-subtitle {
  margin: 8px 0 0;
  color: rgba(20, 20, 20, 0.62);
  line-height: 1.45;
  font-size: 0.9rem;
}

code {
  background: rgba(47, 63, 51, 0.06);
  border: 1px solid rgba(47, 63, 51, 0.12);
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 0.85em;
}

/* Chat area */
.chat {
  padding: 16px 18px 18px;
}

.chat-log {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 56vh;
  overflow: auto;
  padding-right: 8px;
}

.chat-log::-webkit-scrollbar {
  width: 10px;
}
.chat-log::-webkit-scrollbar-thumb {
  background: rgba(47, 63, 51, 0.18);
  border-radius: 999px;
}
.chat-log::-webkit-scrollbar-track {
  background: transparent;
}

/* Bubbles */
.msg {
  display: flex;
  max-width: 100%;
}

.msg-user {
  justify-content: flex-end;
}

.msg-bot {
  justify-content: flex-start;
}

.msg-bubble {
  max-width: 82%;
  padding: 10px 12px;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
  border: 1px solid rgba(47, 63, 51, 0.12);
}

.msg-bot .msg-bubble {
  background: #ffffff;
  color: rgba(20, 20, 20, 0.92);
  border-top-left-radius: 6px;
}

.msg-user .msg-bubble {
  background: var(--green);
  color: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(47, 63, 51, 0.45);
  border-top-right-radius: 6px;
}

.msg-bubble a {
  color: rgba(231, 192, 196, 0.95);
  text-decoration: underline;
}

.msg-bot .msg-bubble a {
  color: rgba(47, 63, 51, 0.92);
}

.small-muted {
  font-size: 0.8rem;
  color: rgba(20, 20, 20, 0.62);
}

/* Input */
.chat-form {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.chat-input {
  flex: 1 1 auto;
  resize: vertical;
  min-height: 54px;
  max-height: 140px;
  padding: 10px 12px;
  font-family: var(--font-sans);
  border-radius: 0px;
  border: 1px solid rgba(47, 63, 51, 0.20);
  background: #fff;
  outline: none;
}

.chat-input:focus {
  border-color: rgba(231, 192, 196, 0.95);
  box-shadow: 0 0 0 4px rgba(231, 192, 196, 0.22);
}

.chat-submit {
  height: 54px;
  padding: 0 16px;
  border-radius: 0px;
  border: 1px solid rgba(231, 192, 196, 0.95);
  background: var(--pink);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  font-weight: 500;
  color: rgba(20, 20, 20, 0.92);
}

.chat-submit:hover {
  background: var(--pink-2);
}

.chat-submit:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Footer */
.app-footer {
  padding: 12px 18px 16px;
  border-top: 1px solid rgba(47, 63, 51, 0.12);
  color: rgba(20, 20, 20, 0.62);
  font-size: 0.85rem;
}

/* Pills (admin) */
.tag-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(47, 63, 51, 0.10);
  border: 1px solid rgba(47, 63, 51, 0.18);
  color: rgba(20, 20, 20, 0.80);
  font-size: 0.72rem;
  margin-right: 6px;
  margin-bottom: 4px;
}

/* Utility */
.sr-only {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  width: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  position: absolute;
}

/* Mobile */
@media (max-width: 720px) {
  .chat-form {
    flex-direction: column;
    align-items: stretch;
  }
  .chat-submit {
    width: 100%;
    height: 46px;
  }
  .chat-input {
    min-height: 84px;
  }
  }


/* ============================
   History sidebar (index)
============================ */
.app-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 70vh;
}

.sidebar {
  border-right: 1px solid rgba(47, 63, 51, 0.12);
  background: rgba(47, 63, 51, 0.03);
  display: flex;
  flex-direction: column;
  padding: 14px 12px;
  gap: 12px;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sidebar-title {
  font-family: var(--font-serif);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.95rem;
  color: rgba(20, 20, 20, 0.78);
}

.sidebar-new {
  width: 34px;
  height: 34px;
  border-radius: 0px;
  border: 1px solid rgba(231, 192, 196, 0.95);
  background: var(--pink);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  color: rgba(20, 20, 20, 0.92);
}

.sidebar-new:hover {
  background: var(--pink-2);
}

.sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
  padding-right: 6px;
  flex: 1 1 auto;
}

.sidebar-empty {
  color: rgba(20, 20, 20, 0.55);
  font-size: 0.9rem;
  padding: 10px 6px;
}

.conv-item {
  text-align: left;
  padding: 10px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(47, 63, 51, 0.12);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1.3;
  color: rgba(20, 20, 20, 0.88);
}

.conv-item:hover {
  border-color: rgba(231, 192, 196, 0.95);
}

.conv-item.active {
  border-color: rgba(231, 192, 196, 0.95);
  box-shadow: 0 0 0 4px rgba(231, 192, 196, 0.20);
}

.sidebar-bottom {
  border-top: 1px solid rgba(47, 63, 51, 0.12);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-user {
  font-size: 0.85rem;
  color: rgba(20, 20, 20, 0.62);
  word-break: break-word;
}

.sidebar-logout {
  height: 40px;
  border-radius: 0px;
  border: 1px solid rgba(47, 63, 51, 0.18);
  background: rgba(47, 63, 51, 0.06);
  cursor: pointer;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.74rem;
}

.sidebar-logout:hover {
  border-color: rgba(231, 192, 196, 0.95);
  background: rgba(231, 192, 196, 0.18);
}

/* Chat padding inside layout */
.app-layout .chat {
  padding: 16px 18px 18px;
}

/* Responsive */
@media (max-width: 860px) {
  .app-layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid rgba(47, 63, 51, 0.12);
  }
}

/* ============================
   Auth pages
============================ */
.auth {
  padding: 16px 18px 20px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-label {
  font-size: 0.85rem;
  color: rgba(20, 20, 20, 0.65);
}

.auth-input {
  height: 44px;
  padding: 10px 12px;
  border-radius: 0px;
  border: 1px solid rgba(47, 63, 51, 0.18);
  background: #fff;
  font-family: var(--font-sans);
}

.auth-input:focus {
  outline: none;
  border-color: rgba(231, 192, 196, 0.95);
  box-shadow: 0 0 0 4px rgba(231, 192, 196, 0.22);
}

.auth-submit {
  height: 46px;
  margin-top: 4px;
  border-radius: 0px;
  border: 1px solid rgba(231, 192, 196, 0.95);
  background: var(--pink);
  cursor: pointer;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 500;
  color: rgba(20, 20, 20, 0.92);
}

.auth-submit:hover {
  background: var(--pink-2);
}

.auth-links {
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.auth-links a {
  color: rgba(47, 63, 51, 0.9);
  text-decoration: underline;
  font-size: 0.85rem;
}

.auth-error,
.auth-success {
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  border: 1px solid rgba(47, 63, 51, 0.18);
  background: rgba(255, 255, 255, 0.75);
  color: rgba(20, 20, 20, 0.88);
}

.auth-error {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.08);
}

.auth-success {
  border-color: rgba(34, 197, 94, 0.30);
  background: rgba(34, 197, 94, 0.08);
}

.turnstile {
  margin-top: 6px;
}

.reset-link {
  margin-top: 14px;
  border-radius: 12px;
  padding: 12px;
  border: 1px solid rgba(47, 63, 51, 0.18);
  background: rgba(255, 255, 255, 0.75);
}

.reset-title {
  font-family: var(--font-serif);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
  color: rgba(20, 20, 20, 0.75);
}

.reset-link a {
  word-break: break-all;
  color: rgba(47, 63, 51, 0.9);
  text-decoration: underline;
}
