/* Premium Glassmorphic Design System - WIKI_CONNECTOR Assistant Dashboard */

:root {
  --bg-primary: #0a0e17;
  --bg-secondary: rgba(18, 25, 41, 0.75);
  --bg-card: rgba(26, 36, 59, 0.45);
  --bg-input: rgba(10, 15, 28, 0.6);
  
  --border-glass: rgba(255, 255, 255, 0.07);
  --border-glass-focus: rgba(0, 242, 254, 0.3);
  
  --color-accent-start: #00f2fe;
  --color-accent-end: #4facfe;
  --color-accent-gradient: linear-gradient(135deg, var(--color-accent-start), var(--color-accent-end));
  
  --color-glow-green: rgba(0, 255, 136, 0.15);
  --color-glow-yellow: rgba(255, 179, 0, 0.15);
  --color-glow-red: rgba(255, 60, 60, 0.15);
  
  --status-green: #00ff88;
  --status-yellow: #ffb300;
  --status-red: #ff3c3c;
  
  --text-main: #e2e8f0;
  --text-muted: #94a3b8;
  --text-bright: #ffffff;
  
  --font-display: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Reset and Core Layout */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-body);
  height: 100vh;
  overflow: hidden;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(0, 242, 254, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(79, 172, 254, 0.04) 0%, transparent 40%);
}

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

/* Top Header styles */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2rem;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-pulse {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-accent-gradient);
  box-shadow: 0 0 12px var(--color-accent-start);
  animation: pulseLogo 3s infinite;
}

.brand h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-bright);
}

.brand h1 span {
  font-weight: 300;
  background: var(--color-accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Status HUD */
.status-hud {
  display: flex;
  gap: 1.5rem;
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-family: var(--font-display);
  background: rgba(255, 255, 255, 0.03);
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  border: 1px solid var(--border-glass);
}

.hud-item .label {
  color: var(--text-muted);
}

.hud-item .value {
  color: var(--text-bright);
  font-weight: 500;
}

.indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  position: relative;
}

.indicator.green {
  background-color: var(--status-green);
  box-shadow: 0 0 8px var(--status-green);
}
.indicator.yellow {
  background-color: var(--status-yellow);
  box-shadow: 0 0 8px var(--status-yellow);
}
.indicator.red {
  background-color: var(--status-red);
  box-shadow: 0 0 8px var(--status-red);
}

.indicator::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 50%;
  animation: pulseIndicator 2s infinite;
}

.indicator.green::after { border: 1px solid var(--status-green); }
.indicator.yellow::after { border: 1px solid var(--status-yellow); }
.indicator.red::after { border: 1px solid var(--status-red); }

/* Workspace Layout */
.workspace {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 320px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  overflow-y: auto;
}

.sidebar-section h2 {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.search-box {
  display: flex;
  position: relative;
}

.search-box input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  color: var(--text-bright);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition-smooth);
}

.search-box input:focus {
  border-color: var(--border-glass-focus);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.15);
}

.search-box button {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  transition: var(--transition-smooth);
}

.search-box button:hover {
  color: var(--color-accent-start);
}

/* Search results list */
.search-results-container {
  flex: 1;
  margin-top: 0.75rem;
  max-height: 250px;
  overflow-y: auto;
}

.search-results {
  list-style: none;
}

.search-results li {
  padding: 0.75rem;
  border-radius: 8px;
  background: var(--bg-card);
  margin-bottom: 0.5rem;
  border: 1px solid var(--border-glass);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.search-results li:hover {
  border-color: var(--color-accent-start);
  background: rgba(255, 255, 255, 0.04);
  transform: translateY(-1px);
}

.search-results li .title {
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 0.25rem;
  display: block;
}

.search-results li .snippet {
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.search-results li .snippet em {
  font-weight: bold;
  font-style: normal;
  color: var(--color-accent-start);
}

.placeholder-text {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  padding: 1.5rem !important;
  background: none !important;
  border: none !important;
  cursor: default !important;
}

/* Sidebar Instructions */
.info-section {
  margin-top: auto;
}

.quick-tips {
  list-style: none;
}

.quick-tips li {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0.75rem;
  position: relative;
  padding-left: 1rem;
}

.quick-tips li::before {
  content: '✦';
  position: absolute;
  left: 0;
  color: var(--color-accent-start);
  font-size: 0.8rem;
}

.quick-tips code {
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 4px;
  border-radius: 4px;
  font-family: monospace;
  color: var(--text-bright);
}

/* Chat Main Area */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: rgba(10, 14, 23, 0.5);
  position: relative;
}

.messages-container {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Scrollbar customization */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.01);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Message styling */
.message {
  display: flex;
  gap: 1rem;
  max-width: 80%;
  animation: messageSlideIn 0.3s ease-out;
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message.assistant {
  align-self: flex-start;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.message.assistant .avatar {
  background: var(--color-accent-gradient);
  color: var(--bg-primary);
  box-shadow: 0 4px 12px rgba(0, 242, 254, 0.3);
}

.message.user .avatar {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-bright);
  border: 1px solid var(--border-glass);
}

.message-content {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 0.9rem 1.25rem;
  line-height: 1.6;
  font-size: 0.92rem;
  color: var(--text-main);
  box-shadow: var(--shadow-premium);
}

.message.user .message-content {
  background: rgba(79, 172, 254, 0.15);
  border-color: rgba(79, 172, 254, 0.25);
  border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
  border-bottom-left-radius: 4px;
}

/* Chat text formatting */
.message-content p {
  margin-bottom: 0.75rem;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content strong {
  color: var(--text-bright);
}

.message-content code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 5px;
  border-radius: 4px;
  font-family: Courier, monospace;
  font-size: 0.85rem;
}

.message-content pre {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 0.8rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 0.75rem 0;
}

.message-content pre code {
  background: none;
  padding: 0;
  font-size: 0.8rem;
  color: #a7f3d0;
}

.message-content a {
  color: var(--color-accent-start);
  text-decoration: underline;
  cursor: pointer;
  font-weight: 500;
}

.message-content ul, .message-content ol {
  margin-left: 1.5rem;
  margin-bottom: 0.75rem;
}

/* Spinner mini & activity bar */
.activity-log-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 2rem;
  background: rgba(0, 242, 254, 0.05);
  border-top: 1px solid rgba(0, 242, 254, 0.1);
  border-bottom: 1px solid rgba(0, 242, 254, 0.1);
  font-size: 0.75rem;
  color: var(--color-accent-start);
  font-family: var(--font-display);
}

.spinner-mini {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0, 242, 254, 0.2);
  border-top-color: var(--color-accent-start);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Input Container styling */
.input-container {
  display: flex;
  gap: 0.75rem;
  padding: 1.5rem 2rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-glass);
  align-items: flex-end;
}

.input-container textarea {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  color: var(--text-bright);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  resize: none;
  max-height: 150px;
  transition: var(--transition-smooth);
  line-height: 1.4;
}

.input-container textarea:focus {
  border-color: var(--border-glass-focus);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.1);
}

.input-container button {
  background: var(--color-accent-gradient);
  border: none;
  color: var(--bg-primary);
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 14px rgba(0, 242, 254, 0.25);
  flex-shrink: 0;
}

.input-container button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 242, 254, 0.4);
}

.input-container button:disabled {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  box-shadow: none;
  cursor: not-allowed;
}

/* Slide-over Drawer */
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 100;
  visibility: hidden;
  transition: visibility 0.3s;
}

.drawer.active {
  visibility: visible;
}

.drawer-overlay {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease-out;
}

.drawer.active .drawer-overlay {
  opacity: 1;
}

.drawer-content {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 550px;
  max-width: 100%;
  background: #0e1524;
  border-left: 1px solid var(--border-glass);
  box-shadow: -10px 0 30px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.drawer.active .drawer-content {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-glass);
}

.drawer-header h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-bright);
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: var(--transition-smooth);
}

.close-btn:hover {
  color: var(--text-bright);
  background: rgba(255, 255, 255, 0.05);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.revision-badge-bar {
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin-bottom: 1.25rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.revision-badge-bar strong {
  color: var(--text-bright);
}

.wikitext-viewer {
  font-size: 0.9rem;
  line-height: 1.6;
}

.wikitext-viewer pre {
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border-glass);
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  font-family: monospace;
  font-size: 0.82rem;
  color: #9cdcfe;
  white-space: pre-wrap;
}

/* Animations */
@keyframes pulseLogo {
  0% { transform: scale(1); box-shadow: 0 0 12px var(--color-accent-start); }
  50% { transform: scale(1.15); box-shadow: 0 0 20px rgba(0, 242, 254, 0.6); }
  100% { transform: scale(1); box-shadow: 0 0 12px var(--color-accent-start); }
}

@keyframes pulseIndicator {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}

@keyframes messageSlideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

/* External Link Button in Drawer Header */
.external-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 4px;
}

.external-link-btn:hover {
  color: var(--color-accent-start) !important;
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-1px);
}
