/* MatchDay Copilot — Styles */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --navy: #0a1628;
  --navy-light: #132040;
  --navy-mid: #1a2d52;
  --white: #ffffff;
  --white-soft: #e8eaf0;
  --accent: #00c853;
  --accent-dark: #00a344;
  --accent-glow: rgba(0, 200, 83, 0.15);
  --user-bubble: #1565c0;
  --assistant-bubble: #1a2d52;
  --error-color: #ff5252;
  --border-radius: 16px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  --font-stack: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font-stack);
  background: var(--navy);
  color: var(--white);
  font-size: 16px;
  line-height: 1.5;
}

/* Screen reader only */
.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;
}

/* App Container */
.app-container {
  max-width: 480px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--navy-light);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
}

/* Main content wrapper */
main {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

/* Header */
header {
  padding: 16px 20px 12px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

header h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--white) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  font-size: 0.75rem;
  color: var(--white-soft);
  margin-top: 4px;
  opacity: 0.7;
}

/* Language Selector */
.lang-selector select {
  background: var(--navy-mid);
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.85rem;
  font-family: var(--font-stack);
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}

.lang-selector select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* Chat Log */
.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

/* Chat Messages */
.message {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--border-radius);
  font-size: 0.9rem;
  line-height: 1.5;
  word-wrap: break-word;
  box-shadow: var(--shadow);
  animation: fadeIn 0.25s ease;
}

.message-user {
  align-self: flex-end;
  background: var(--user-bubble);
  color: var(--white);
  border-bottom-right-radius: 4px;
}

.message-assistant {
  align-self: flex-start;
  background: var(--assistant-bubble);
  color: var(--white-soft);
  border-bottom-left-radius: 4px;
}

.message-error {
  align-self: flex-start;
  background: rgba(255, 82, 82, 0.15);
  color: var(--error-color);
  border: 1px solid rgba(255, 82, 82, 0.3);
  border-bottom-left-radius: 4px;
}

/* Typing Indicator */
.typing-indicator {
  align-self: flex-start;
  padding: 12px 18px;
  background: var(--assistant-bubble);
  border-radius: var(--border-radius);
  border-bottom-left-radius: 4px;
  display: flex;
  gap: 5px;
  box-shadow: var(--shadow);
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--white-soft);
  border-radius: 50%;
  opacity: 0.4;
  animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% { opacity: 0.4; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

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

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .typing-indicator span {
    animation: none;
    opacity: 0.7;
  }
  .message {
    animation: none;
  }
  .chat-log {
    scroll-behavior: auto;
  }
}

/* Quick Action Chips */
.quick-actions {
  padding: 8px 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.chip {
  background: var(--navy-mid);
  color: var(--white-soft);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-family: var(--font-stack);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.chip:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--white);
}

.chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chip:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Chat Form */
.chat-form {
  display: flex;
  gap: 8px;
  padding: 12px 16px 16px;
  background: var(--navy);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-form input {
  flex: 1;
  background: var(--navy-mid);
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-family: var(--font-stack);
  outline: none;
  transition: border-color 0.2s;
}

.chat-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.chat-form input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.chat-form input:disabled {
  opacity: 0.5;
}

.chat-form button {
  background: var(--accent);
  color: var(--navy);
  border: none;
  border-radius: 12px;
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-stack);
  cursor: pointer;
  transition: all 0.2s;
}

.chat-form button:hover {
  background: var(--accent-dark);
}

.chat-form button:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 2px;
}

.chat-form button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Scrollbar styling */
.chat-log::-webkit-scrollbar {
  width: 6px;
}

.chat-log::-webkit-scrollbar-track {
  background: transparent;
}

.chat-log::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.chat-log::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}
