/* ========================================================
   TamilAI Workspace Core Engine Global System Styles
   ======================================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  transition:
    background 0.3s ease,
    box-shadow 0.3s ease,
    transform 0.3s ease,
    border-color 0.3s ease;
}

body {
  background:
    radial-gradient(circle at top left, #00e5ff30, transparent 45%),
    radial-gradient(circle at bottom right, #0066ff30, transparent 45%),
    linear-gradient(135deg, #02060d, #071120);
  color: #ffffff;
  overflow: hidden; /* CRITICAL: Prevents total page scrolling */
  height: 100vh;
  width: 100vw;
}

#particles-js {
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: -1;
  opacity: 0.85;
  filter: none;
}

.app-container {
  height: calc(100vh - 30px); /* Adjusted cleanly relative to the footer */
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Prevents awkward outer layout scroll bars */
}

/* ======================================== */
/* TOPBAR HEADER DESIGN                     */
/* ======================================== */
.topbar {
  z-index: 9999;
  overflow: visible; /* Allows dropdown menu lists to drop below without clipping */
  height: 85px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 24px;
  background: rgba(6, 12, 26, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0, 229, 255, 0.15);
  box-shadow: 0 4px 30px rgba(0, 229, 255, 0.05);
  flex-shrink: 0;
}

.top-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-box {
  padding: 12px 20px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(0, 229, 255, 0.2);
}

.logo-box h2 {
  color: #00e5ff;
  font-size: 22px;
  text-shadow: 0 0 15px rgba(0, 229, 255, 0.6);
}

.new-chat {
  padding: 12px 22px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #00e5ff, #00b7ff);
  color: #00111f;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.new-chat:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 20px #00e5ff;
}

/* HORIZONTAL CHAT HISTORY TRACK */
.top-history {
  display: flex;
  overflow-x: auto;
  overflow-y: visible;
  position: relative;
  margin: 0 30px;
  z-index: 50;
  gap: 12px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: #00eaff22 transparent;
  flex: 1;
}

.top-history::-webkit-scrollbar {
  display: none; /* Hides internal track for sleek interface design */
  height: 5px;
}

.chat-history-list {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  list-style: none;
  overflow-y: visible;
}
/* FIX: Ensure desktop dropdown menus slide over the chat workspace area cleanly */
.chat-menu-dropdown,
.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: #091724;
  border: 1px solid rgba(0, 229, 255, 0.25);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  min-width: 120px;

  /* Elevate to maximum priority */
  z-index: 99999 !important;
}

.chat-tab {
  flex: 0 0 auto;
  position: relative;
  overflow: visible;
}

.chat-history-list li {
  position: relative;
  min-width: 170px;
  max-width: 220px;
  padding: 10px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(0, 229, 255, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-history-list li:hover {
  background: rgba(0, 229, 255, 0.08);
  border-color: #00e5ff;
  box-shadow: 0 0 15px rgba(0, 229, 255, 0.2);
}

.chat-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
}

.active-chat {
  background: linear-gradient(135deg, #00e5ff, #00b7ff) !important;
  color: #000000 !important;
  font-weight: 700;
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.4);
  border-color: #00e5ff !important;
}

.chat-menu-btn {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}

/* SYSTEM INTERACTIVE 3-DOT DROPDOWNS */
.chat-dropdown {
  position: absolute;
  top: 45px;
  right: 0;
  min-width: 120px;
  background: rgba(5, 20, 40, 0.95);
  border: 1px solid #00eaff;
  border-radius: 12px;
  display: none;
  z-index: 999999;
}

.chat-dropdown.show-dropdown {
  display: block;
}

.dropdown-item {
  padding: 8px 12px;
  color: #ffffff;
  font-size: 13px;
  cursor: pointer;
  border-radius: 8px;
}

.dropdown-item:hover {
  background: rgba(0, 229, 255, 0.15);
  color: #00e5ff;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.top-btn,
.theme-btn {
  padding: 10px 16px;
  border: 1px solid rgba(0, 229, 255, 0.2);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  color: white;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.top-btn:hover,
.theme-btn:hover {
  border-color: #00e5ff;
  background: rgba(0, 229, 255, 0.05);
  box-shadow: 0 0 15px rgba(0, 229, 255, 0.2);
}

.user-profile {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(0, 229, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
}

.user-profile:hover {
  border-color: #00e5ff;
  box-shadow: 0 0 15px rgba(0, 229, 255, 0.3);
}

/* ======================================== */
/* WORKSPACE & FEATURE SIDEBAR SECTIONS     */
/* ======================================== */
.workspace {
  flex: 1;
  display: flex;
  overflow: hidden;
  height: calc(
    100vh - 85px - 30px
  ); /* Dynamic view bounds protection tracking */
}

.sidebar {
  width: 90px;
  background: rgba(5, 11, 22, 0.6);
  border-right: 1px solid rgba(0, 229, 255, 0.15);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  justify-content: center;
  padding-top: 24px;
  flex-shrink: 0;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tool-card {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 22px;
}

.tool-card:hover {
  transform: translateY(-3px);
  background: rgba(0, 229, 255, 0.08);
  border-color: #00e5ff;
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.25);
}

/* ======================================== */
/* CORE CHAT SCREEN DESIGN                  */
/* ======================================== */
.main-chat {
  flex: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Prevents input controls from slipping past layouts */
}

.conversation-workspace {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: rgba(6, 15, 30, 0.15);
  border: 1px solid rgba(0, 229, 255, 0.15);
  border-radius: 24px;
  padding: 24px;
  box-shadow: inset 0 0 30px rgba(0, 229, 255, 0.02);
  overflow: hidden;
}

.conversation-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 15px;
  flex-shrink: 0;
}

.conversation-ai-info h2,
.conversation-user-info h3 {
  color: #00e5ff;
  font-size: 20px;
  font-weight: 600;
  text-shadow: 0 0 12px rgba(0, 229, 255, 0.4);
  margin-bottom: 4px;
}

.conversation-user-info {
  text-align: right;
}

.chat-box {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.03);
  scroll-behavior: smooth;
  overflow-x: hidden;
  margin-bottom: 16px;
}

/* MESSAGE LAYOUT BALLOONS */
.ai-message {
  max-width: 70%;
  padding: 16px 20px;
  border-radius: 4px 20px 20px 20px;
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.2);
  align-self: flex-start;
  font-size: 16px;
  line-height: 1.6;
  word-wrap: break-word;
}

.user-message {
  max-width: 70%;
  padding: 16px 20px;
  border-radius: 20px 4px 20px 20px;
  background: rgba(0, 102, 255, 0.15);
  border: 1px solid rgba(0, 102, 255, 0.25);
  align-self: flex-end;
  font-size: 16px;
  line-height: 1.6;
  word-wrap: break-word;
  text-align: left;
}

.message-date {
  color: #2184e0;
  text-align: right;
  font-size: 18px !important; /* Adjust this to whatever feels perfect for your bubbles */
  opacity: 0.75 !important; /* Gives it a clean, legible contrast balance */
  margin-top: 6px !important;
}

/* ======================================== */
/* INFINITE WORD INPUT AREA ARCHITECTURE    */
/* ======================================== */
.input-area {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(0, 229, 255, 0.15);
  padding: 10px 16px;
  border-radius: 20px;
  flex-shrink: 0;
  width: 100%; /* Ensures full fluid distribution across the screen */
}

.input-area textarea {
  flex: 1;
  height: 52px;
  min-height: 52px;
  max-height: 200px;
  resize: none;
  border: none;
  outline: none;
  color: #ffffff;
  background: transparent;
  font-size: 15px;
  line-height: 24px;
  padding: 12px 4px;
}

/* FIX: Align the buttons horizontally next to the textarea */
.input-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.action-btn {
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-btn:hover {
  background: rgba(0, 229, 255, 0.1);
  border-color: #00e5ff;
  transform: translateY(-2px);
}

.send-btn {
  height: 48px;
  padding: 0 24px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #00e5ff, #00b7ff);
  color: #00111f;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.send-btn:hover {
  box-shadow: 0 0 20px #00e5ff;
  transform: translateY(-2px);
}

/* MEDIA & METADATA PREVIEWS */
.chat-box img,
.chat-box video {
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid rgba(0, 229, 255, 0.2);
  margin-top: 8px;
  display: block;
}

.file-attachment-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  color: #00e5ff;
  text-decoration: none;
  font-size: 14px;
  margin-top: 8px;
  border: 1px dashed rgba(0, 229, 255, 0.3);
}

/* MODERN SYSTEM SCROLLBARS */
.chat-box::-webkit-scrollbar {
  width: 6px;
}
.chat-box::-webkit-scrollbar-track {
  background: transparent;
}
.chat-box::-webkit-scrollbar-thumb {
  background: rgba(0, 229, 255, 0.2);
  border-radius: 10px;
}
.chat-box::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 229, 255, 0.5);
}

/* POPUPS & GLOBAL OVERLAYS */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(3, 7, 15, 0.7);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.popup-box {
  width: 90%;
  max-width: 400px;
  background: #060d1a;
  padding: 28px;
  border-radius: 20px;
  border: 1px solid #00e5ff;
  box-shadow: 0 0 30px rgba(0, 229, 255, 0.25);
}

.popup-box h2 {
  color: #00e5ff;
  margin-bottom: 16px;
  font-size: 20px;
}

.popup-box input {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  background: #111b2c;
  border: 1px solid rgba(0, 229, 255, 0.2);
  color: white;
  margin-bottom: 18px;
  outline: none;
}

.popup-buttons {
  display: flex;
  gap: 12px;
}

.popup-buttons button {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
}

#popupOk {
  background: #00e5ff;
  color: #00111f;
}

#popupCancel {
  background: #ff3366;
  color: white;
}

/* ======================================== */
/* AI PREMIUM FEATURES PANEL DESIGN         */
/* ======================================== */
.ai-features-box {
  max-width: 450px !important;
  background: rgba(10, 20, 36, 0.95) !important;
  border: 1px solid rgba(0, 229, 255, 0.35) !important;
  box-shadow: 0 0 35px rgba(0, 229, 255, 0.2) !important;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.feature-item-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.feature-item-card span {
  font-size: 24px;
  display: block;
  margin-bottom: 8px;
}

.feature-item-card h4 {
  font-size: 13px;
  font-weight: 500;
  color: #e3edf7;
}

.feature-item-card:hover {
  background: rgba(0, 229, 255, 0.08);
  border-color: #00e5ff;
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 229, 255, 0.1);
}

/* ======================================== */
/* PREMIUM GLOW & INTERACTIVE CLICK EFFECTS */
/* ======================================== */

/* Dynamic Ambient Mouse Glow Tracker */
.cursor-glow {
  position: fixed;
  width: 400px; /* Increased size for a wider, softer ambient aura */
  height: 400px;
  background: radial-gradient(
    circle,
    rgba(0, 229, 255, 0.12) 0%,
    rgba(0, 102, 255, 0.03) 45%,
    transparent 70%
  );
  border-radius: 50%;
  pointer-events: none; /* Let clicks pass right through it */
  transform: translate(-50%, -50%);
  z-index: 1; /* Sits perfectly behind your text content panels */
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 0.6s ease; /* Smoothly fades in when mouse enters window */
}

/* Glassmorphism Panel Hover Glows */
.logo-box:hover,
.chat-history-list li:hover,
.tool-card:hover,
.conversation-workspace:hover,
.input-area:hover {
  box-shadow:
    0 0 25px rgba(0, 229, 255, 0.15),
    inset 0 0 15px rgba(0, 229, 255, 0.05);
  border-color: rgba(0, 229, 255, 0.4) !important;
}

/* Interactive Dynamic Click Ripple Element */
.click-ripple {
  position: fixed;
  border: 2px solid #00e5ff;
  background: radial-gradient(
    circle,
    rgba(0, 229, 255, 0.2) 0%,
    transparent 70%
  );
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999; /* Ensures it bursts over elements smoothly */
  transform: translate(-50%, -50%) scale(0);
  animation: ripple-burst 0.5s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.6);
}

@keyframes ripple-burst {
  0% {
    width: 0px;
    height: 0px;
    opacity: 1;
    transform: translate(-50%, -50%) scale(0);
  }
  50% {
    border-color: #0066ff;
    box-shadow: 0 0 30px rgba(0, 102, 255, 0.8);
  }
  100% {
    width: 120px;
    height: 120px;
    opacity: 0;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* SYSTEM STATUS APP FOOTER */
.footer {
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 11, 20, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  border-top: 1px solid rgba(0, 229, 255, 0.1);
  letter-spacing: 0.5px;
  position: relative;
  z-index: 110;
  flex-shrink: 0; /* CRITICAL: Tells the browser NEVER to compress or hide the footer */
}
/* ======================================================== */
/* GLOBAL FLOATING MENU STYLES (BUG FIX)                    */
/* ======================================================== */
.global-chat-menu {
  position: absolute;
  display: none;
  background: #091724;
  border: 1px solid rgba(0, 229, 255, 0.3);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  padding: 4px;
  min-width: 110px;
  z-index: 999999 !important; /* Forces layout to ride on top layer always */
}

.global-chat-menu.active {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.global-menu-item {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 12px;
  padding: 6px 12px;
  text-align: left;
  cursor: pointer;
  border-radius: 4px;
  width: 100%;
  display: flex;
  align-items: center;
}

.global-menu-item:hover {
  background: rgba(0, 229, 255, 0.15);
  color: #00e5ff;
}

.global-menu-item.delete-item:hover {
  background: rgba(255, 74, 74, 0.15);
  color: #ff4a4a;
}
/* Floating Attachment Menu Wrapper */
.attach-context-menu {
  display: none;
  position: absolute;
  bottom: 80px; /* Sits perfectly above the message box */
  right: 140px; /* Aligns smoothly above your '+' button region */
  background: #09111e;
  border: 1px solid rgba(0, 229, 255, 0.25);
  border-radius: 12px;
  padding: 6px;
  width: 210px;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.5),
    0 0 15px rgba(0, 229, 255, 0.1);
  z-index: 9999;
  flex-direction: column;
  gap: 2px;
}

/* Menu Items Styles */
.attach-menu-item {
  width: 100%;
  background: transparent;
  border: none;
  color: #ffffff;
  padding: 10px 12px;
  text-align: left;
  font-size: 13px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
}

.attach-menu-item:hover {
  background: rgba(0, 229, 255, 0.12);
  color: #00e5ff;
}

.attach-menu-item .icon {
  font-size: 16px;
}

/* Dynamic display tracking toggle class via JavaScript */
.attach-context-menu.active {
  display: flex !important;
}

/* Quick adjustment for mobile panels screens */
@media screen and (max-width: 768px) {
  .attach-context-menu {
    right: auto;
    left: 16px;
    bottom: 75px;
    width: calc(100% - 32px);
    max-width: 260px;
  }
}
/* ========================================================
   TAMILAI WORKSPACE - DESKTOP ONLY NEON ANIMATED SCROLLBAR
   ======================================================== */
@media screen and (min-width: 769px) {
  /* 1. Track setup */
  ::-webkit-scrollbar {
    width: 8px !important;
  }

  /* 2. Track background */
  ::-webkit-scrollbar-track {
    background: #040811 !important;
  }

  /* 3. The Neon Handle */
  ::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #00e5ff, #0066ff) !important;
    border-radius: 10px !important;
    border: 1px solid rgba(0, 229, 255, 0.2) !important;
    /* Adding a subtle glow */
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.5) !important;
  }

  /* 4. Animation for the Neon effect */
  ::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #39ff14, #00e5ff) !important;
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.8) !important;
    transition: all 0.3s ease !important;
  }
}
.ai-message h1,
.ai-message h2,
.ai-message h3 {
  color: #00e5ff;
  margin: 12px 0;
}

.ai-message p {
  line-height: 1.8;
}

.ai-message ul,
.ai-message ol {
  margin-left: 20px;
}

.ai-message li {
  margin: 6px 0;
}

.ai-message pre {
  background: rgba(0, 0, 0, 0.4);
  padding: 15px;
  border-radius: 10px;
  overflow: auto;
  margin: 10px 0;
}

.ai-message code {
  background: rgba(0, 229, 255, 0.1);
  padding: 2px 5px;
  border-radius: 5px;
}
/* =====================================
   TAMILAI THINKING ANIMATION
===================================== */

.thinking-message {
  animation: thinkingFloat 3s ease-in-out infinite;

  position: relative;
}

@keyframes thinkingFloat {
  0% {
    transform: translateY(0px);
  }

  50% {
    transform: translateY(-8px);
  }

  100% {
    transform: translateY(0px);
  }
}

.thinking-brain {
  display: inline-block;

  animation: brainPulse 1.5s infinite;
}

@keyframes brainPulse {
  0% {
    transform: scale(1);

    filter: drop-shadow(0 0 5px #00e5ff);
  }

  50% {
    transform: scale(1.25);

    filter: drop-shadow(0 0 20px #00e5ff);
  }

  100% {
    transform: scale(1);

    filter: drop-shadow(0 0 5px #00e5ff);
  }
}

.thinking-dots {
  color: #00e5ff;

  font-weight: bold;

  min-width: 35px;

  display: inline-block;
}
