/**
 * VoiceAgent - Global CSS
 * Description: Глобальные стили приложения. Тёмная тема с акцентами фиолетового/синего.
 *              Адаптивный дизайн (mobile-first), CSS переменные для темизации.
 * Version: 1.0.0
 */

:root {
  --primary: #7c3aed;
  --primary-light: #a855f7;
  --primary-dark: #5b21b6;
  --secondary: #06b6d4;
  --accent: #f59e0b;
  --bg-dark: #0f0f1a;
  --bg-card: #1a1a2e;
  --bg-card2: #16213e;
  --border: rgba(124, 58, 237, 0.25);
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-light: #ffffff;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --shadow: 0 4px 24px rgba(124, 58, 237, 0.15);
  --shadow-lg: 0 8px 48px rgba(124, 58, 237, 0.25);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --transition: 0.3s ease;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font);
  background: var(--bg-dark);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============ TYPOGRAPHY ============ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-light);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.75rem); }

a {
  color: var(--primary-light);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--secondary); }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.6);
  color: white;
}

.btn-secondary {
  background: transparent;
  color: var(--primary-light);
  border: 2px solid var(--primary);
}
.btn-secondary:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-2px);
}

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-2px);
}

.btn-sm { padding: 8px 16px; font-size: 0.875rem; }
.btn-lg { padding: 16px 32px; font-size: 1.125rem; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ============ FORMS ============ */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  font-family: var(--font);
  transition: all var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  background: rgba(124, 58, 237, 0.08);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control option {
  background: var(--bg-card);
  color: var(--text);
}

.form-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-success {
  color: var(--success);
  font-size: 0.85rem;
  margin-top: 6px;
}

/* ============ CARDS ============ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.card-glass {
  background: rgba(26, 26, 46, 0.7);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(124, 58, 237, 0.3);
}

/* ============ BADGES ============ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-primary { background: rgba(124, 58, 237, 0.2); color: var(--primary-light); }
.badge-success { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.badge-danger { background: rgba(239, 68, 68, 0.2); color: var(--danger); }
.badge-warning { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.badge-info { background: rgba(6, 182, 212, 0.2); color: var(--secondary); }

/* ============ ALERTS ============ */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  border: 1px solid transparent;
  font-size: 0.9rem;
}
.alert-success { background: rgba(16, 185, 129, 0.1); border-color: var(--success); color: var(--success); }
.alert-danger { background: rgba(239, 68, 68, 0.1); border-color: var(--danger); color: var(--danger); }
.alert-warning { background: rgba(245, 158, 11, 0.1); border-color: var(--warning); color: var(--warning); }
.alert-info { background: rgba(6, 182, 212, 0.1); border-color: var(--secondary); color: var(--secondary); }

/* ============ NAVIGATION ============ */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 16px 0;
  background: rgba(15, 15, 26, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: all var(--transition);
}

.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 800;
  color: white;
  text-decoration: none;
}

.navbar-brand .logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 32px;
  list-style: none;
}

.navbar-links a {
  color: var(--text-muted);
  font-weight: 500;
  transition: color var(--transition);
}
.navbar-links a:hover { color: var(--text-light); }

/* ============ VERSION BADGE ============ */
.version-badge {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;
  background: rgba(124, 58, 237, 0.2);
  border: 1px solid rgba(124, 58, 237, 0.4);
  color: var(--primary-light);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}
.version-badge:hover {
  background: rgba(124, 58, 237, 0.4);
  transform: translateY(-1px);
}

/* ============ CHANGELOG POPUP ============ */
.changelog-popup {
  position: fixed;
  top: 50px;
  right: 16px;
  z-index: 999;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  min-width: 300px;
  max-width: 380px;
  max-height: 400px;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: none;
}
.changelog-popup.open { display: block; }

.changelog-popup h4 {
  margin-bottom: 12px;
  font-size: 1rem;
  color: var(--primary-light);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.changelog-item {
  margin-bottom: 12px;
}

.changelog-item .version { 
  font-weight: 700; 
  color: var(--primary-light);
  font-size: 0.9rem;
}

.changelog-item .date { 
  color: var(--text-muted); 
  font-size: 0.8rem;
  margin-left: 8px;
}

.changelog-item ul {
  margin-top: 4px;
  padding-left: 16px;
}

.changelog-item li {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 3px;
}

/* ============ COOKIE BANNER ============ */
.cookie-banner {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 24px;
  max-width: 600px;
  width: calc(100% - 40px);
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from { transform: translateX(-50%) translateY(100px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

.cookie-banner.hidden { display: none; }

.cookie-banner p {
  flex: 1;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
}

.cookie-banner .btn { white-space: nowrap; }

/* ============ UTILITY ============ */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary-light); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; } .mt-5 { margin-top: 48px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 16px; } .gap-3 { gap: 24px; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ============ GRID ============ */
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); gap: 24px; }

/* ============ LOADING SPINNER ============ */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(124, 58, 237, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.3s ease;
}
@keyframes modalIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .navbar-links { display: none; }
  .cookie-banner { flex-direction: column; text-align: center; bottom: 0; border-radius: var(--radius) var(--radius) 0 0; width: 100%; }
  .changelog-popup { right: 8px; left: 8px; max-width: none; }
}

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-light); }
