/* ============================================================
   LMKTFY - Let Me Kiro That For You
   Kiro IDE-inspired dark theme
   ============================================================ */

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-primary: #1e1e2e;
  --bg-secondary: #181825;
  --bg-sidebar: #11111b;
  --bg-input: #313244;
  --bg-hover: #45475a;
  --bg-card: #1e1e2e;
  --text-primary: #cdd6f4;
  --text-secondary: #a6adc8;
  --text-muted: #7c8da2;
  --accent-purple: #cba6f7;
  --accent-blue: #89b4fa;
  --accent-teal: #94e2d5;
  --accent-green: #a6e3a1;
  --accent-peach: #fab387;
  --border-color: #313244;
  --border-subtle: #45475a;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --font-sans: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "Cascadia Code", "Fira Code", "JetBrains Mono", monospace;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow: hidden;
  overflow-y: auto;
}

/* --- Accessibility Utilities --- */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background-color: var(--accent-purple);
  color: var(--bg-primary);
  padding: 8px 16px;
  z-index: 9999;
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 var(--radius-sm) 0;
}

.skip-link:focus {
  top: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- Layout --- */
#app {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* --- Sidebar --- */
.sidebar {
  width: 220px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 24px;
}

.logo-icon {
  font-size: 1.4rem;
  color: var(--accent-purple);
}

.logo-text {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.nav-item:hover {
  background-color: var(--bg-hover);
}

.nav-item:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

.nav-item.active {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.nav-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
}

/* --- Main Content --- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 40px 24px 0;
  overflow-y: auto;
}

/* --- Header --- */
.chat-header {
  text-align: center;
  margin-bottom: 32px;
}

.hero-logo {
  display: block;
  margin: 0 auto 16px;
  height: 300px;
  width: auto;
  border-radius: var(--radius-md);
}

.chat-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.ellipsis {
  color: var(--accent-purple);
}

.chat-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* --- Messages --- */
.messages {
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  display: flex;
  gap: 12px;
  animation: fadeIn 0.3s ease;
}

.message-user {
  justify-content: flex-end;
}

.message-bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 0.95rem;
  line-height: 1.5;
}

.message-user .message-bubble {
  background-color: var(--accent-purple);
  color: var(--bg-primary);
  border-bottom-right-radius: 4px;
}

/* --- Link Result --- */
.link-result {
  display: none;
  width: 100%;
  max-width: 680px;
  margin-top: 24px;
  padding: 20px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  animation: fadeIn 0.4s ease;
}

.link-result.visible {
  display: block;
  margin-bottom: 20px;
}

.link-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.link-row {
  display: flex;
  gap: 8px;
}

.link-input {
  flex: 1;
  padding: 10px 14px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--accent-blue);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}

.link-input:focus {
  border-color: var(--accent-purple);
}

.btn-copy {
  padding: 10px 20px;
  background-color: var(--accent-purple);
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.btn-copy:hover {
  opacity: 0.85;
}

.btn-copy:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

.link-copied {
  display: none;
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--accent-green);
}

.link-copied.visible {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* --- Sarcasm --- */
.sarcasm {
  display: none;
  margin-top: 32px;
  text-align: center;
  animation: fadeIn 0.5s ease;
}

.sarcasm.visible {
  display: block;
}

.sarcasm p {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent-peach);
}

/* --- AI Response --- */
.ai-response {
  display: none;
  width: 100%;
  max-width: 680px;
  margin-top: 20px;
  padding: 20px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  animation: fadeIn 0.4s ease;
}

.ai-response.visible {
  display: block;
}

.ai-response-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.ai-avatar {
  font-size: 1.1rem;
  color: var(--accent-purple);
}

.ai-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent-purple);
}

.ai-response-body {
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.7;
  white-space: pre-wrap;
}

.ai-loading {
  color: var(--text-muted);
  font-style: italic;
}

/* --- Input Area --- */
.input-area {
  padding: 16px 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.input-wrapper {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 680px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 6px 6px 6px 16px;
  transition: border-color 0.15s ease;
}

.input-wrapper:focus-within {
  border-color: var(--accent-purple);
}

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  outline: none;
  padding: 8px 0;
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.btn-send {
  width: 40px;
  height: 40px;
  background-color: var(--accent-purple);
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s ease;
  flex-shrink: 0;
}

.btn-send:hover {
  opacity: 0.85;
}

.btn-send:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

.btn-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.send-icon {
  font-size: 1rem;
}

.input-hint {
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* --- Fake Cursor --- */
.fake-cursor {
  display: none;
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  transition: top 0.8s ease-in-out, left 0.8s ease-in-out;
}

.fake-cursor.visible {
  display: block;
}

/* --- Footer --- */
.footer {
  position: fixed;
  bottom: 0;
  left: 220px;
  right: 0;
  text-align: center;
  padding: 8px 16px;
  font-size: 0.7rem;
  color: var(--text-muted);
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  z-index: 10;
}

.separator {
  margin: 0 8px;
  opacity: 0.4;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
}

.footer-link:hover {
  text-decoration: underline;
  color: var(--text-secondary);
}

.footer-link:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* --- About Modal --- */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.modal-overlay.visible {
  display: flex;
}

.modal-content {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 500px;
  width: 90%;
  color: var(--text-primary);
}

.modal-content h2 {
  font-size: 1.3rem;
  margin-bottom: 16px;
  color: var(--accent-purple);
}

.modal-content p {
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.btn-close-modal {
  margin-top: 12px;
  padding: 10px 24px;
  background-color: var(--accent-purple);
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-close-modal:hover {
  opacity: 0.85;
}

.btn-close-modal:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.typing-cursor::after {
  content: "|";
  animation: blink 0.7s infinite;
  color: var(--accent-purple);
  margin-left: 1px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .chat-area {
    padding: 24px 16px 0;
  }

  .chat-title {
    font-size: 1.5rem;
  }

  .hero-logo {
    height: 150px;
  }

  .footer {
    left: 0;
  }

  .input-area {
    padding: 12px 16px 16px;
  }
}

/* --- Accessibility: reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  .fake-cursor {
    transition: none;
  }
}
