/* /styles/myprofile.css */

/* ============================================================
   1. GLOBAL TOKENS & RESET
   ============================================================ */
:root {
  --bs-body-font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  --bs-primary: #b08a48;
  --bs-primary-rgb: 176,138,72;
  --bs-link-color: var(--bs-primary);
  --bs-link-hover-color: #9a773f;
  --color-bg: #fff;
  --color-accent: var(--brand-gold, #b08a48);
  --bs-body-color: #000;
  --bs-heading-color: #000;
  --bs-body-bg: #fff;
  --brand-gold: #b08a48;
}

html, body {
  height: 100%;
  margin: 0;
  background: #ffffff !important; /* Force white background globally */
  background-repeat: no-repeat !important;
  background-position: left top !important;
  background-size: auto !important;
}

/* ============================================================
   2. HEADER & AUTH CONTROLS
   ============================================================ */
header #userAuthControls {
  position: absolute !important;
  top: 10px !important;
  right: 10px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-end !important;
  gap: 12px !important;
}

/* Stack order */
#userAuthControls #profileDiv { order: 1; }
#userAuthControls #loginButton,
#userAuthControls #logoutButton { order: 2; }
#userAuthControls #buyCreditsLink { order: 3; }
#userAuthControls #googleDocsLoginBtn { order: 4; }

#userAuthControls > button {
  grid-column: 1 / -1;
  grid-row: 2;
  justify-self: end;
  margin-left: 0 !important;
}

/* ============================================================
   3. MAIN LAYOUT (Left/Right Rails)
   ============================================================ */
#hubMain {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  width: calc(100% - 200px);
  margin-left: 200px;
  padding: 20px;
}

#mainContainer {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap; /* allow wrap on smaller screens */
  gap: 16px;
}

#leftColumn #app > * {
  margin: 0 !important;
  max-width: none !important;
  width: 100% !important;
}

#rightColumn {
  flex: 0 0 300px;
  margin-left: auto;
  border-left: 1px solid #b08a48;
  padding-left: 20px;
  box-sizing: border-box;
}

#rightColumn h2 {
  margin-bottom: 10px;
}

/* ============================================================
   4. SIDEBAR
   ============================================================ */
#dashboardSidebar {
  position: fixed;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  top: 260px;
  overflow-y: auto;
  padding: 5px 0;
  z-index: 100;
}

#dashboardSidebar::-webkit-scrollbar-thumb {
  background-color: #b08a48;
  border-radius: 6px;
}

.dashboard-tab {
  background: none;
  border: none;
  cursor: pointer;
  text-align: center;
  opacity: 0.6;
  transition: opacity 0.3s ease, transform 0.2s ease;
  padding: 0;
}

.dashboard-tab img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 10px;
  display: block;
  border: 2px solid transparent;
}

.dashboard-tab span {
  display: block;
  font-size: 14px;
  font-weight: bold;
  color: #000;
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dashboard-tab:hover { opacity: 0.9; transform: scale(1.05); }
.dashboard-tab.active { opacity: 1; }
.dashboard-tab.active img { border-color: #b08a48; }

/* ============================================================
   5. HUB NAVIGATION (Buttons & Tiles)
   ============================================================ */
#hubNav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem !important;   
  margin-bottom: 16px;
}

#hubNav button,
#hubNav .hub-btn,
#hubNav .nav-link {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.5rem !important;
  padding: 6px 10px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  border-radius: 8px !important;
  border: 1px solid #b08a48 !important;
  cursor: pointer !important;
  transition: background-color 0.2s ease !important;
}

#hubNav .focus-goals::before,
#hubNav button:contains("Herb Profiles")::before { content: "🎯"; margin-right: 6px; }
#hubNav .notes::before,
#hubNav button:contains("Cultivation Journal")::before { content: "📝"; margin-right: 6px; }
#hubNav .blocks::before,
#hubNav button:contains("Blocks")::before { content: "📦"; margin-right: 6px; }

/* ============================================================
   6. RESPONSIVE LAYOUTS (Mobile/Tablet)
   ============================================================ */
@media (max-width: 900px) {
  #mainContainer { flex-direction: column; }
  #rightColumn {
    margin-left: 0;
    border-left: none;
    padding-left: 0;
    position: static;
  }
}

@media (max-width: 600px) {
  #hubMain {
    margin-left: 0 !important;
    width: 100% !important;
    padding: 12px 12px 20px !important;
  }
  
  #dashboardSidebar {
    position: static !important;
    top: auto;
    left: auto;
    width: 100% !important;
    height: auto;
    border-right: 0 !important;
    border-bottom: 1px solid #b08a48 !important;
    padding: 10px !important;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  footer { margin-left: 0 !important; }
  .header { justify-content: center !important; padding: 8px 12px !important; }
  #clariiaLogo { position: static !important; height: 40px !important; margin: 6px 8px 6px 0 !important; }

  #hubNav,
  #hubNav .nav {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)) !important;
    gap: 8px !important;
  }
  
  #hubNav button,
  #hubNav .nav-link {
    width: 100% !important;
    height: 100% !important;
    padding: 0.5rem !important;
    font-size: 0.9rem !important;
    white-space: normal !important;
    text-align: center !important;
    justify-content: center !important;
  }
}

/* ============================================================
   7. MY DASHBOARDS
   ============================================================ */
#myDashboardsView { padding: 16px 20px; }
#myDashboardsView .md-header { display:flex; flex-direction:column; gap:4px; margin-bottom:12px; }
#myDashboardsView .md-header h2 { margin:0; font-size:1.4rem; font-weight:600; }
#myDashboardsView .md-grid { display:grid; grid-template-columns:repeat(5, minmax(0,1fr)); gap:14px; }

@media (max-width:1400px){ #myDashboardsView .md-grid{ grid-template-columns:repeat(4,1fr);} }
@media (max-width:1100px){ #myDashboardsView .md-grid{ grid-template-columns:repeat(3,1fr);} }
@media (max-width:800px){  #myDashboardsView .md-grid{ grid-template-columns:repeat(2,1fr);} }
@media (max-width:520px){  #myDashboardsView .md-grid{ grid-template-columns:repeat(1,1fr);} }

#myDashboardsView .md-card {
  display:block; border-radius:10px; overflow:hidden; text-decoration:none;
  border:1px solid rgba(0,0,0,0.08); background:#fff; box-shadow:0 1px 2px rgba(0,0,0,0.04);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
#myDashboardsView .md-card:hover { transform: translateY(-2px); box-shadow:0 8px 16px rgba(0,0,0,0.08); }
#myDashboardsView .md-card__imageWrap { position:relative; aspect-ratio:16 / 9; background:#f6f6f6; }
#myDashboardsView .md-card__imageWrap img { width:100%; height:100%; object-fit:cover; display:block; }
#myDashboardsView .md-card__meta { padding:10px 12px 12px; }
#myDashboardsView .md-card__title { margin:0; font-size:1rem; font-weight:600; color:#111; }

/* ============================================================
   8. GLOBAL BUTTON RESCUE (Gradient Hack)
   ============================================================ */
header .btn,
header button,
#userAuthControls .btn,
#userAuthControls button,
.navbar .btn,
.navbar .nav-link,
#hubNav button, 
#hubNav .hub-btn, 
#hubNav .nav-link,
.hub-tiles button {
    color-scheme: only light !important; 
    color: #000000 !important;
    -webkit-text-fill-color: #000000 !important;
    background-image: linear-gradient(#ffffff, #ffffff) !important;
    background-color: #ffffff !important;
    border: 1px solid #b08a48 !important;
    text-shadow: none !important;
    box-shadow: none !important;
    opacity: 1 !important;
}

header .btn:hover,
header button:hover,
#userAuthControls .btn:hover,
#userAuthControls button:hover,
#hubNav button:hover, 
#hubNav .hub-btn:hover,
.hub-tiles button:hover {
    background-image: linear-gradient(#f2f2f2, #f2f2f2) !important;
    background-color: #f2f2f2 !important;
    color: #000000 !important;
}

#hubNav button.active,
#hubNav .hub-btn.active {
    background-image: linear-gradient(rgba(176,138,72,0.1), rgba(176,138,72,0.1)) !important;
    background-color: rgba(176,138,72,0.1) !important;
}
/* ============================================================
   9. MY PROFILE ASSISTANT CHAT (Fixes Size & Dark Mode)
   ============================================================ */

/* 1. Fix the "Inch Inside" Sizing Issue */
/* The loader JS adds 'container-fluid' and 'px-3', which squeezes the chat.
   We override that here to make it full-width. */
#leftRail .rail-body,
#rightRail .rail-body {
  width: 100% !important;
  max-width: 100% !important;
  padding: 15px !important; /* Reset padding to be consistent */
  margin: 0 !important;
  
  /* 2. Fix the Black Background (Gradient Hack) */
  background-image: linear-gradient(#ffffff, #ffffff) !important;
  background-color: #ffffff !important;
  color: #000000 !important;
  
  border: 1px solid rgba(176, 138, 72, 0.5) !important;
  border-radius: 12px !important;
  box-sizing: border-box !important;
}

/* The Wrapper for the Chat Content */
.chat-wrap {
  width: 100% !important;
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* Ensure this container is also forced White */
  background-image: linear-gradient(#ffffff, #ffffff) !important;
  background-color: #ffffff !important;
  color: #000 !important;
}

/* The Message Scroll Area - Fix "Too Small" vertical height */
.chat-messages {
  width: 100% !important;
  height: 400px !important;       /* Force a good height */
  min-height: 300px !important;
  overflow-y: auto;
  
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 15px;
  
  /* Force Light Background */
  background-image: linear-gradient(#f9f9f9, #f9f9f9) !important; 
  background-color: #f9f9f9 !important;
  color: #000000 !important;
}

/* Input Row Layout */
.chat-form {
  width: 100% !important;
  display: flex;
  gap: 8px;
  align-items: center;
}

/* The Input Field */
.chat-input {
  flex-grow: 1;
  width: 100%;
  border: 1px solid #b08a48 !important;
  border-radius: 8px;
  padding: 12px;
  min-height: 50px;
  
  /* Force White */
  background-image: linear-gradient(#ffffff, #ffffff) !important;
  background-color: #ffffff !important;
  color: #000000 !important;
}

/* Chat Buttons (Send/Record) */
.chat-btn {
  white-space: nowrap;
  padding: 0 1.2rem;
  border: 1px solid #b08a48 !important;
  border-radius: 8px;
  height: 50px; /* Match input height */
  
  /* Force White Button with Gold Text */
  background-image: linear-gradient(#ffffff, #ffffff) !important;
  background-color: #ffffff !important;
  color: #b08a48 !important;
  font-weight: 600;
  cursor: pointer;
}

.chat-btn:hover {
  background-image: linear-gradient(#f2f2f2, #f2f2f2) !important;
}

/* Individual Messages */
.msg {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eee;
}
.msg__who {
  font-weight: bold;
  font-size: 0.85rem;
  margin-bottom: 4px;
  color: #b08a48;
}
.msg__text {
  font-size: 1rem;
  line-height: 1.5;
  color: #000 !important;
}