
/* =========================================================
   AI ASSISTANT WIDGET
   Dedicated stylesheet
   File: assets/aistyle.css
   ========================================================= */


/* =========================================================
   VARIABLES
   ========================================================= */

:root {
  --gen-bg: #ffffff;
  --gen-panel: #f7f8fa;
  --gen-text: #1a1a1a;
  --gen-accent: #4f6df5;
  --gen-bubble-user: #4f6df5;
  --gen-bubble-bot: #eef0f4;

  --my-panel: #0d1117;
  --my-card: #131a24;
  --my-border: #232d3a;
  --my-text: #c9d1d9;
  --my-accent: #2dd9b8;
  --my-accent-dark: #17b89a;
  --my-bubble-user: #16302c;
  --my-bubble-bot: #1a222c;
}


/* =========================================================
   FLOATING LAUNCHER
   ========================================================= */

#ai-launcher {
  position: fixed;

  bottom: 24px;
  right: 24px;

  width: 60px;
  height: 60px;

  border: none;
  border-radius: 50%;

  background: var(--gen-accent);
  color: #ffffff;

  font-size: 26px;
  line-height: 1;

  cursor: pointer;

  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.25);

  z-index: 10000;

  transition:
    background 0.3s ease,
    box-shadow 0.3s ease,
    transform 0.2s ease;
}

#ai-launcher:hover {
  transform: translateY(-2px);
}

#ai-launcher:active {
  transform: translateY(0);
}


/* =========================================================
   CHAT PANEL
   ========================================================= */

#ai-panel {
  position: fixed;

  bottom: 96px;
  right: 24px;

  width: 340px;
  max-width: calc(100vw - 32px);

  height: 480px;
  max-height: calc(100vh - 120px);

  background: var(--gen-panel);

  border-radius: 14px;

  box-shadow:
    0 8px 30px rgba(0, 0, 0, 0.30);

  display: none;
  flex-direction: column;

  overflow: hidden;

  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;

  font-size: 14px;

  z-index: 9999;

  transition:
    background 0.3s ease,
    box-shadow 0.3s ease;
}

#ai-panel.open {
  display: flex;
}


/* =========================================================
   TERMINAL TITLE BAR
   ========================================================= */

#ai-titlebar {
  display: none;

  align-items: center;
  gap: 8px;

  padding: 10px 14px;

  background: var(--my-card);

  border-bottom: 1px solid var(--my-border);

  font-family:
    "SFMono-Regular",
    Consolas,
    "Courier New",
    monospace;

  font-size: 12px;

  color: #6b7684;
}

#ai-panel.hacker-theme #ai-titlebar {
  display: flex;
}

#ai-titlebar .dot {
  width: 11px;
  height: 11px;

  border-radius: 50%;

  flex: 0 0 auto;
}

#ai-titlebar .dot.red {
  background: #ff5f57;
}

#ai-titlebar .dot.yellow {
  background: #febc2e;
}

#ai-titlebar .dot.green {
  background: #28c840;
}


/* =========================================================
   HEADER
   ========================================================= */

#ai-header {
  display: flex;

  justify-content: space-between;
  align-items: center;

  gap: 10px;

  padding: 10px 12px;

  background: var(--gen-accent);

  color: #ffffff;
}

#ai-header strong {
  font-size: 14px;
  white-space: nowrap;
}


/* =========================================================
   MODE TOGGLE
   ========================================================= */

#ai-mode-toggle {
  display: flex;
  gap: 6px;
}

#ai-mode-toggle .mode-btn {
  border: 1px solid rgba(255, 255, 255, 0.6);

  background: transparent;
  color: #ffffff;

  padding: 4px 10px;

  border-radius: 20px;

  font-size: 12px;

  cursor: pointer;

  transition:
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}

#ai-mode-toggle .mode-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

#ai-mode-toggle .mode-btn.active {
  background: #ffffff;

  color: var(--gen-accent);

  font-weight: 600;
}


/* =========================================================
   MESSAGES
   ========================================================= */

#ai-messages {
  flex: 1;

  padding: 12px;

  overflow-y: auto;

  color: var(--gen-text);

  scroll-behavior: smooth;
}

#ai-messages::-webkit-scrollbar {
  width: 6px;
}

#ai-messages::-webkit-scrollbar-track {
  background: transparent;
}

#ai-messages::-webkit-scrollbar-thumb {
  background: rgba(100, 100, 100, 0.25);

  border-radius: 10px;
}


/* =========================================================
   MESSAGE BUBBLES
   ========================================================= */

#ai-messages .msg {
  max-width: 80%;

  padding: 8px 12px;

  border-radius: 12px;

  margin-bottom: 8px;

  line-height: 1.4;

  word-wrap: break-word;
  overflow-wrap: anywhere;

  animation:
    ai-message-in 0.18s ease-out;
}

@keyframes ai-message-in {

  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }

}

#ai-messages .msg.user {
  background: var(--gen-bubble-user);

  color: #ffffff;

  margin-left: auto;
  margin-right: 0;

  border-bottom-right-radius: 2px;
}

#ai-messages .msg.bot {
  background: var(--gen-bubble-bot);

  color: var(--gen-text);

  margin-right: auto;
  margin-left: 0;

  border-bottom-left-radius: 2px;
}


/* =========================================================
   INPUT ROW
   ========================================================= */

#ai-input-row {
  display: flex;

  border-top:
    1px solid rgba(0, 0, 0, 0.08);

  background: var(--gen-panel);
}

#ai-input {
  flex: 1;

  min-width: 0;

  border: none;
  outline: none;

  padding: 12px;

  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;

  font-size: 14px;

  background: transparent;

  color: var(--gen-text);
}

#ai-input::placeholder {
  color: #8b929d;
}

#ai-send {
  border: none;

  background: var(--gen-accent);

  color: #ffffff;

  padding: 0 16px;

  cursor: pointer;

  font-weight: 600;

  transition:
    background 0.2s ease;
}

#ai-send:hover {
  background: #3e5be0;
}

#ai-send:disabled {
  opacity: 0.6;

  cursor: not-allowed;
}


/* =========================================================
   MY AI / SECURE TERMINAL THEME
   ========================================================= */

#ai-panel.hacker-theme {
  background: var(--my-panel);

  font-family:
    "SFMono-Regular",
    Consolas,
    "Courier New",
    monospace;

  border:
    1px solid var(--my-border);

  border-radius: 14px;

  box-shadow:
    0 0 0 1px rgba(45, 217, 184, 0.15),
    0 12px 40px rgba(0, 0, 0, 0.55),
    0 0 30px rgba(45, 217, 184, 0.12);
}

#ai-panel.hacker-theme #ai-header {
  background: var(--my-card);

  border-bottom:
    1px solid var(--my-border);

  color: var(--my-text);
}

#ai-panel.hacker-theme #ai-header strong {
  color: var(--my-accent);

  letter-spacing: 0.3px;
}

#ai-panel.hacker-theme #ai-header strong::after {
  content: "_";

  color: var(--my-accent);

  animation:
    blink-cursor 1s steps(1) infinite;
}

@keyframes blink-cursor {

  50% {
    opacity: 0;
  }

}


/* =========================================================
   HACKER MODE BUTTONS
   ========================================================= */

#ai-panel.hacker-theme #ai-mode-toggle .mode-btn {
  border-color:
    rgba(255, 255, 255, 0.15);

  color: #9aa4b2;
}

#ai-panel.hacker-theme #ai-mode-toggle .mode-btn:hover {
  background:
    rgba(45, 217, 184, 0.08);
}

#ai-panel.hacker-theme #ai-mode-toggle .mode-btn.active {
  background: var(--my-accent);

  color: #06110e;

  border-color: var(--my-accent);
}


/* =========================================================
   HACKER MESSAGE AREA
   ========================================================= */

#ai-panel.hacker-theme #ai-messages {
  color: var(--my-text);

  background: var(--my-panel);
}

#ai-panel.hacker-theme #ai-messages .msg {
  font-size: 13px;

  border-radius: 8px;
}

#ai-panel.hacker-theme #ai-messages .msg.user {
  background: var(--my-bubble-user);

  color: var(--my-accent);

  border:
    1px solid rgba(45, 217, 184, 0.3);
}

#ai-panel.hacker-theme #ai-messages .msg.user::before {
  content: "you@portfolio:~$ ";

  opacity: 0.6;

  font-size: 11px;

  display: block;
}

#ai-panel.hacker-theme #ai-messages .msg.bot {
  background: var(--my-bubble-bot);

  color: var(--my-text);

  border:
    1px solid var(--my-border);
}

#ai-panel.hacker-theme #ai-messages .msg.bot::before {
  content: "my_ai > ";

  opacity: 0.6;

  font-size: 11px;

  display: block;

  color: var(--my-accent);
}


/* =========================================================
   HACKER INPUT
   ========================================================= */

#ai-panel.hacker-theme #ai-input-row {
  border-top:
    1px solid var(--my-border);

  background: var(--my-card);
}

#ai-panel.hacker-theme #ai-input {
  background: var(--my-card);

  color: var(--my-text);

  caret-color: var(--my-accent);

  font-family:
    "SFMono-Regular",
    Consolas,
    "Courier New",
    monospace;
}

#ai-panel.hacker-theme #ai-input::placeholder {
  color: #5b6675;
}

#ai-panel.hacker-theme #ai-send {
  background: var(--my-accent);

  color: #06110e;

  font-weight: 700;
}

#ai-panel.hacker-theme #ai-send:hover {
  background: var(--my-accent-dark);
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 600px) {

  #ai-launcher {
    right: 16px;
    bottom: 16px;

    width: 56px;
    height: 56px;
  }

  #ai-panel {
    right: 16px;
    bottom: 84px;

    width: calc(100vw - 32px);

    height:
      min(480px, calc(100vh - 105px));

    max-width: none;
  }

}


@media (max-width: 380px) {

  #ai-panel {
    right: 10px;

    width:
      calc(100vw - 20px);
  }

  #ai-launcher {
    right: 12px;
  }

  #ai-header {
    padding: 9px 10px;
  }

  #ai-mode-toggle {
    gap: 4px;
  }

  #ai-mode-toggle .mode-btn {
    padding: 4px 7px;

    font-size: 11px;
  }

}
