/* Global styles for PUHKA - Design Refresh */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #0e1116;
  --panel: #141824;
  --panel-2: #10131c;
  --text: #e7ebf3;
  --muted: #9aa4b2;
  --primary: #6ea8fe;
  --primary-600: #5c92e3;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --ring: 0 0 0 3px rgba(110,168,254,.35);
  --radius: 16px;
  --card-pad: 20px;
  --gap: 16px;
  
  /* Legacy vars for backward compatibility */
  --bg-main: #0e1116;
  --bg-card: #141824;
  --accent-teal: #6ea8fe;
  --accent-violet: #8b5cf6;
  --text-primary: #e7ebf3;
  --text-secondary: #9aa4b2;
  --border-color: rgba(255,255,255,.08);
  --error-color: #ef4444;
  --success-color: #22c55e;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --shadow-hover: 0 10px 30px rgba(0,0,0,.35);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Layout */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.grid {
  display: grid;
  gap: var(--gap);
}

.grid-2 {
  grid-template-columns: 1.2fr 0.8fr;
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 992px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .page {
    padding: 16px;
  }
}

/* Header & Navigation */
header {
  height: 64px;
  background: rgba(10,12,18,.6);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,.06);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
}

header nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
}

.logo, .brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

@media (max-width: 768px) {
  header .brand {
    font-size: 18px;
  }
  header {
    padding: 0 16px;
  }
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: all 0.2s;
  font-size: 14px;
  font-weight: 500;
}

.nav-links a:hover {
  color: var(--text);
  background: rgba(110,168,254,.1);
}

.nav-links a.active,
.nav-active {
  color: var(--primary);
  background: rgba(110,168,254,.15);
}

.user-menu {
  position: relative;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-violet);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}

.dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  background: var(--panel);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  min-width: 180px;
  display: none;
  box-shadow: var(--shadow);
}

.dropdown.active {
  display: block;
}

.dropdown a {
  display: block;
  padding: 0.75rem 1.5rem;
  color: var(--text);
  text-decoration: none;
  transition: background 0.2s;
}

.dropdown a:hover {
  background: rgba(110,168,254,.1);
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
}

.hamburger span {
  width: 25px;
  height: 3px;
  background: var(--text);
  border-radius: 3px;
}

/* Typography */
h1 {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 1rem;
}

h2 {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.2px;
}

.muted {
  color: var(--muted);
}

/* Cards */
.card {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border-radius: var(--radius);
  padding: var(--card-pad);
  box-shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 10px 30px rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.06);
}

.card h2 {
  font-size: 18px;
  margin-bottom: 12px;
  letter-spacing: 0.2px;
  color: var(--text);
}

@media (max-width: 768px) {
  .card {
    padding: 16px;
  }
}

/* Badges */
.badge-live {
  background: rgba(34,197,94,.15);
  color: #34d399;
  border: 1px solid rgba(34,197,94,.35);
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  display: inline-block;
}

.badge-wait {
  background: rgba(245,158,11,.12);
  color: #fbbf24;
  border: 1px solid rgba(245,158,11,.35);
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  display: inline-block;
}

.status-live {
  background: rgba(34,197,94,.15);
  color: #34d399;
  border: 1px solid rgba(34,197,94,.35);
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  display: inline-block;
}

.status-awaiting {
  background: rgba(245,158,11,.12);
  color: #fbbf24;
  border: 1px solid rgba(245,158,11,.35);
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  display: inline-block;
}

.status-badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
}

/* Buttons */
.btn {
  height: 42px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: transform .05s ease, box-shadow .2s ease, background .2s;
  text-decoration: none;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary);
  color: #07101a;
}

.btn-primary:hover {
  background: var(--primary-600);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: rgba(255,255,255,.08);
}

.btn-secondary:hover {
  background: rgba(110,168,254,.1);
  border-color: var(--primary);
}

.btn-ghost {
  background: transparent;
  border-color: rgba(255,255,255,.08);
  color: var(--text);
}

.btn-ghost:hover {
  background: rgba(255,255,255,.05);
}

.btn-danger {
  background: var(--danger);
  color: #0b0f15;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-loading::after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 8px;
}

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

/* Inputs */
.input,
.select,
.textarea {
  width: 100%;
  background: #0c0f16;
  color: var(--text);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  transition: border .2s, box-shadow .2s, background .2s;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  box-shadow: var(--ring);
  border-color: var(--primary);
}

.label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 6px;
  display: block;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  height: 42px;
  padding: 0 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-teal);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.2);
}

.form-group textarea {
  height: auto;
  min-height: 100px;
  padding: 0.75rem 1rem;
  resize: vertical;
}

/* Segmented Controls */
.segmented {
  display: flex;
  gap: 8px;
  background: rgba(255,255,255,.04);
  padding: 4px;
  border-radius: 999px;
}

.segmented label {
  flex: 1;
  padding: 8px 16px;
  border-radius: 999px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  font-size: 14px;
  font-weight: 500;
  position: relative;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.segmented input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.segmented input[type="radio"]:checked + span,
.segmented label:has(input[type="radio"]:checked) {
  background: var(--primary);
  color: #07101a;
  font-weight: 600;
}

/* Chat Bubbles */
.bubble,
.message {
  border-radius: 14px;
  padding: 12px 14px;
  max-width: 720px;
  word-wrap: break-word;
  line-height: 1.5;
  animation: slideIn 0.3s ease-out;
}

.bubble-user,
.message-user {
  background: #0b2a4a;
  border: 1px solid rgba(110,168,254,.35);
  align-self: flex-end;
}

.bubble-ai,
.message-ai {
  background: #1a1f2d;
  border: 1px solid rgba(255,255,255,.06);
  align-self: flex-start;
}

.message-user {
  text-align: right;
}

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

@keyframes shimmer {
  0%, 100% {
    opacity: 0.5;
  }
  50% {
    opacity: 0.7;
  }
}

.message[data-pending="true"],
.bubble[data-pending="true"] {
  animation: shimmer 1.5s ease-in-out infinite;
}

/* Stats */
.stat {
  background: #101522;
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 12px;
  padding: 14px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 13px;
  color: var(--muted);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 1000;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s;
  font-size: 14px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.toast-error {
  border-color: rgba(239,68,68,.3);
  background: rgba(239,68,68,.1);
  color: #fca5a5;
}

.toast.toast-success {
  border-color: rgba(34,197,94,.3);
  background: rgba(34,197,94,.1);
  color: #86efac;
}

/* Container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .chat-input-row {
    flex-direction: column;
    align-items: stretch;
  }
  
  .bubble,
  .message {
    max-width: 100%;
  }
  
  .hamburger {
    display: flex;
  }
}

/* Legacy compatibility */
.error-message {
  color: var(--error-color);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.typing-indicator {
  align-self: flex-start;
  padding: 12px 14px;
  background: #1a1f2d;
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  max-width: 70px;
}

.typing-dots {
  display: flex;
  gap: 4px;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  animation: typing 1.4s infinite;
  opacity: 0.6;
}

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

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

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

.loader {
  border: 3px solid var(--border-color);
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 0.8s linear infinite;
  margin: 2rem auto;
}

/* Top bar styles */
.topbar {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 16px;
  align-items: end;
  margin-bottom: var(--gap);
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .topbar > div {
    margin-bottom: 0;
  }
}

/* Segmented control */
.segment {
  background: #0c0f16;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 999px;
  padding: 4px;
  display: flex;
  gap: 4px;
}

.segment button {
  flex: 1;
  height: 40px;
  border-radius: 999px;
  border: 0;
  color: #e7ebf3;
  background: transparent;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
}

.segment button:hover {
  background: rgba(255,255,255,.05);
}

.segment button.active {
  background: var(--primary);
  color: #07101a;
}

.voice-wrap input {
  height: 42px;
}

.langs {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
