/* ========================================
   LAYOUT.CSS - Grid, Flexbox, Responsive
   ======================================== */

/* ========================================
   LOGIN SCREEN
   ======================================== */

.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-screen.hidden {
  display: none;
}

.login-container {
  text-align: center;
  max-width: 400px;
}

.login-container h1 {
  font-size: 40px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--accent), #A78BFA);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-container p {
  color: var(--text-secondary);
  margin-bottom: 32px;
}

/* ========================================
   APP CONTAINER
   ======================================== */

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-container.hidden {
  display: none;
}

/* ========================================
   TOPBAR
   ======================================== */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  height: 53px;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.logo {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--accent), #A78BFA);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
  flex-shrink: 0;
}

.context-toggle {
  display: flex;
  background: var(--surface-2);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
}

.context-btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: none;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  background: transparent;
  color: var(--text-secondary);
}

.context-btn.active-azul,
.context-btn.active-personal {
  background: var(--accent);
  color: white;
}

.context-btn:not(.active-azul):not(.active-personal):hover {
  background: rgba(124, 92, 252, 0.1);
}

.mobile-context-label {
  display: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.score-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.score-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.score-dot.work {
  background: var(--accent);
}

.score-dot.health {
  background: var(--green);
}

.score-dot.personal {
  background: var(--personal-accent);
}

.theme-toggle,
.logout-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.theme-toggle:hover,
.logout-btn:hover {
  background: var(--surface-3);
  border-color: var(--border-hover);
}

/* ========================================
   PAGE NAV
   ======================================== */

.page-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}

.page-nav::-webkit-scrollbar {
  display: none;
}

.nav-btn {
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.nav-btn:hover {
  color: var(--text);
  background: rgba(124, 92, 252, 0.05);
}

.nav-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* ========================================
   MAIN LAYOUT
   ======================================== */

.main-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  flex: 1;
  overflow: hidden;
}

/* ========================================
   BRIEF PANEL
   ======================================== */

.brief-panel {
  padding: 24px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ========================================
   CHAT PANEL
   ======================================== */

.chat-panel {
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 53px);
}

.chat-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.chat-header-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
}

.chat-header-text {
  font-size: 14px;
  font-weight: 600;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-input-area {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px 4px 4px 16px;
}

.chat-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  padding: 8px 0;
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.chat-send {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  transition: all 0.2s;
}

.chat-send:hover {
  background: linear-gradient(135deg, var(--accent), #9A7DFF);
  box-shadow: 0 4px 12px rgba(124, 92, 252, 0.4);
}

.chat-send:active {
  transform: scale(0.95);
}

/* ========================================
   MOBILE CHAT FAB
   ======================================== */

.chat-fab {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--accent);
  color: white;
  border: none;
  font-size: 22px;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 24px rgba(124, 92, 252, 0.4);
  cursor: pointer;
  z-index: 150;
  transition: all 0.3s;
}

.chat-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 32px rgba(124, 92, 252, 0.5);
}

.chat-close {
  display: none;
  position: fixed;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  z-index: 205;
  transition: all 0.2s;
}

.chat-close:hover {
  background: var(--surface-2);
}

/* ========================================
   RESPONSIVE: TABLET (max 1100px)
   ======================================== */

@media (max-width: 1100px) {
  .main-layout {
    grid-template-columns: 1fr 320px;
  }

  .brief-panel {
    padding: 20px;
    gap: 20px;
  }

  .topbar {
    padding: 10px 16px;
    gap: 12px;
  }

  .score-pill {
    padding: 5px 12px;
    font-size: 12px;
  }
}

/* ========================================
   RESPONSIVE: MOBILE (max 900px)
   ======================================== */

@media (max-width: 900px) {
  .page-nav {
    padding: 0 12px;
  }

  .nav-btn {
    padding: 8px 10px;
    font-size: 11px;
  }

  .main-layout {
    grid-template-columns: 1fr;
  }

  .chat-panel {
    display: none;
    position: fixed;
    top: 53px;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    z-index: 200;
    border-left: none;
    border-radius: 0;
    max-height: calc(100vh - 53px);
  }

  .chat-panel.open {
    display: flex;
  }

  .chat-fab {
    display: flex;
  }

  .chat-close {
    display: flex;
  }

  .brief-panel {
    padding: 16px;
    gap: 16px;
    max-height: none;
  }

  .context-toggle {
    display: none;
  }

  .mobile-context-label {
    display: block;
  }

  .topbar {
    padding: 10px 16px;
    height: auto;
  }

  .topbar-left {
    gap: 12px;
  }

  .topbar-right {
    gap: 8px;
  }

  .score-pill {
    padding: 4px 10px;
    font-size: 12px;
  }

  .logo {
    font-size: 16px;
  }

  .theme-toggle,
  .logout-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
}

/* ========================================
   RESPONSIVE: SMALL MOBILE (max 480px)
   ======================================== */

@media (max-width: 480px) {
  .brief-panel {
    padding: 12px;
    gap: 12px;
  }

  .topbar {
    padding: 8px 12px;
  }

  .topbar-left {
    gap: 8px;
  }

  .topbar-right {
    gap: 6px;
  }

  .logo {
    font-size: 14px;
  }

  .score-pill {
    padding: 3px 8px;
    font-size: 11px;
  }

  .theme-toggle,
  .logout-btn {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  h1 {
    font-size: 20px;
  }
}

/* ========================================
   PRINT
   ======================================== */

@media print {
  .topbar,
  .page-nav,
  .chat-panel,
  .chat-fab,
  .chat-close {
    display: none;
  }

  .main-layout {
    grid-template-columns: 1fr;
  }

  .brief-panel {
    max-height: none;
    overflow-y: visible;
  }
}
