/* -------------------- styles.css -------------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&display=swap');

/* -------------------- ПЕРЕМЕННЫЕ И БАЗА -------------------- */
:root{
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #ef4444;
  --danger-dark: #dc2626;
  --success: #22c55e;
  --success-dark: #16a34a;
  
  --text-light: #f8fafc;
  --text-light-muted: #cbd5e1;
  --text-dark: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  
  --radius: 12px;
  --radius-sm: 8px;
  --app-bg: #f1f5f9;
}

*{ box-sizing: border-box; }
html { scroll-behavior: smooth; }
body{
  margin: 0;
  font-family: "Inter", system-ui, sans-serif;
  color: var(--text-dark);
  background-color: var(--text-dark);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3 { margin: 0; padding: 0; font-weight: 700; }

/* -------------------- ФОН С ВИДЕО -------------------- */
.background-container {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: -1; overflow: hidden;
}
.background-video { width: 100%; height: 100%; object-fit: cover; }
.background-container::after {
  content: ''; position: absolute; inset: 0;
  background: rgba(15, 23, 42, 0.6);
}

/* -------------------- СЕКЦИЯ 1: ГЛАВНЫЙ ЭКРАН (HERO) -------------------- */
.hero-section {
  position: relative; height: 100vh; min-height: 600px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 16px; color: var(--text-light);
}

.topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 1000;
  background: transparent; border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto; padding: 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.top-brand-logo {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  color: var(--text-light);
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-pill {
  height: 36px; padding: 0 12px;
  background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 9999px; display: flex; align-items: center; gap: 8px;
}
.user-pill #top-username {
  color: var(--text-light); background: transparent !important; border: none !important;
  outline: none !important; box-shadow: none !important;
  width: 140px; font-weight: 600;
}
.user-pill #top-username::placeholder { color: rgba(255, 255, 255, 0.6); }
.user-pill svg { width: 18px; height: 18px; color: var(--text-light); }

.hero-content { text-align: center; max-width: 800px; }
.hero-title {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.2;
  margin: 0 0 16px;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.25rem);
  line-height: 1.6;
  max-width: 600px;
  margin: 0 auto 32px;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.hero-actions { display: flex; justify-content: center; gap: 16px; margin-top: 32px; }

/* -------------------- КНОПКИ НА ГЛАВНОМ ЭКРАНЕ -------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 48px; padding: 0 28px;
  border-radius: var(--radius); border: 2px solid transparent;
  font-weight: 600; font-size: 16px; text-decoration: none;
  transition: all 0.2s; cursor: pointer;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn.btn-primary {
  background: var(--primary); color: var(--text-light); border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
}
.btn.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn.btn-outline {
  background: transparent; border-color: rgba(255, 255, 255, 0.8); color: var(--text-light);
}
.btn.btn-outline:hover { background: rgba(255, 255, 255, 0.1); border-color: #fff; }

/* -------------------- СЕКЦИЯ 2: ПРИЛОЖЕНИЕ -------------------- */
.app-section {
  padding: 80px 0;
  position: relative;
  background-image: url('/static/workspace-bg.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}
.app-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background-color: transparent;
}
.container { position: relative; z-index: 1; }

.panel {
  background: rgba(248, 250, 252, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid var(--text-dark);
  border-radius: var(--radius); padding: 24px;
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.1);
  margin-bottom: 24px;
}

.grid-2cols-top, .grid-2cols-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  max-width: 1280px;
  margin: 0 auto 24px auto;
}
.grid-2cols-bottom { margin-bottom: 0; }

@media (max-width: 900px){
  .grid-2cols-top, .grid-2cols-bottom { grid-template-columns: 1fr; }
}

.panel-title {
  display: flex; align-items: center; gap: 12px;
  font-size: 20px; color: var(--text-dark);
  margin-bottom: 24px;
}
.panel-title svg { color: var(--primary); }

.btn-app {
  height: 40px; padding: 0 20px; font-size: 14px;
  border-radius: var(--radius-sm); font-weight: 600;
  border: 1px solid;
  cursor: pointer; transition: all 0.2s;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
}
.btn-app:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.btn-app:active { transform: translateY(0); box-shadow: none; }

.btn-app-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-app-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-app-outline {
  background: #fff;
  color: var(--text-dark);
  border-color: var(--border-color);
}
.btn-app-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-app-danger {
  background: #fff;
  color: var(--danger);
  border-color: var(--danger);
}
.btn-app-danger:hover { background: var(--danger); color: #fff; }
.btn-app-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-app.sent { background: var(--success-dark); border-color: var(--success-dark); cursor: default; }
.btn-app svg { width: 16px; height: 16px; }

.file-choose { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
#file-input { display: none; }
#file-chosen { color: var(--text-muted); font-size: 14px; }
.status-line { display: flex; gap: 24px; margin-top: 24px; font-size: 14px; color: var(--text-muted); }
.status-line strong { color: var(--text-dark); font-weight: 700; }
.status-message { padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 8px; }
.status-message.error { background:#fef3f2; color:#b42318; border:1px solid #fecdca; }
.status-message.success { background:#ecfdf3; color:#027a48; border:1px solid #a6f4c5; }

.list { list-style: none; padding: 0; margin: 0; }
.list-placeholder { font-size: 14px; color: var(--text-muted); padding: 16px 0; }
.json-item {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); padding: 12px; margin-bottom: 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  transition: all 0.2s; cursor: pointer;
}
.json-item:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
  transform: translateY(-2px);
}
.json-item-content { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.file-name { font-weight: 600; color: var(--text-dark); }
.upload-date { font-size: 13px; color: var(--text-muted); }
.note-text { color: var(--text-muted); margin-bottom: 16px; font-size: 14px; }


/* -------------------- FOOTER -------------------- */
/* --- ИЗМЕНЕНИЕ: Новый стиль для футера --- */
.site-footer {
  position: relative; /* Для псевдо-элемента */
  color: var(--text-light);
  padding: 0 16px;
}
.site-footer::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background-color: rgba(30, 41, 59, 0.9); /* Темно-синий полупрозрачный фон */
  backdrop-filter: blur(10px);
}
.footer-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 24px;
  padding: 24px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.footer-left {
  display: flex;
  flex-direction: column; /* Элементы друг под другом */
  align-items: flex-start; /* Выравнивание по левому краю */
  gap: 4px; /* Небольшой отступ между брендом и копирайтом */
}
.footer-brand { font-weight: 800; color: #fff; }
.footer-copy { color: rgba(255, 255, 255, 0.6); font-size: 14px; }
.contact-cards { display: flex; flex-wrap: wrap; gap: 8px; }
.contact-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 99px; text-decoration: none;
  color: #fff; background: rgba(255, 255, 255, 0.1); border: 1px solid transparent;
  font-size: 14px; font-weight: 500; transition: all 0.2s;
}
.contact-chip:hover { background: rgba(255, 255, 255, 0.2); }
.contact-chip svg { color: #fff; width: 16px; height: 16px; }
.contact-chip span { line-height: 1; }

/* -------------------- API PILL + MODAL -------------------- */
.api-pill{
  display:inline-flex; align-items:center; height:36px; padding:0 16px; border-radius:9999px;
  font-weight:600; font-size: 14px;
  cursor:pointer; user-select:none;
  border: 1px solid;
  transition: all 0.2s;
}
.api-pill:hover { opacity: 0.8; }
#api-btn{
  color: #a7ffb4; background: rgba(34, 197, 94, 0.1); border-color: rgba(34, 197, 94, 0.4);
}
#api-btn.api-missing{
  color: #ffc7a7; background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.4);
}

.overlay{ position: fixed; inset: 0; display: none; align-items: center; justify-content: center; z-index: 10000; background: rgba(15,23,42,0.55); backdrop-filter: blur(4px); }
.progress-box{ width:min(560px, 92vw); padding:24px; }
.modal-box { background: #fff; border-radius: var(--radius); box-shadow:0 12px 30px rgba(2,6,23,0.20); }

#api-modal .modal-header, .json-preview-box .modal-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:24px; }
#api-modal .modal-title, .json-preview-box .modal-title { font-size:18px; color: var(--text-dark); }
#api-modal .modal-close, .json-preview-box .modal-close {
  background:transparent; border:none; font-size:24px; line-height: 1;
  color: var(--text-muted); cursor:pointer; transition: color .2s;
}
#api-modal .modal-close:hover, .json-preview-box .modal-close:hover { color: var(--text-dark); }
#api-modal label{ display:block; margin-bottom: 6px; font-size:14px; font-weight: 500; }
#api-modal #api-current { margin-bottom: 16px; font-size: 14px; color: var(--text-muted); }
#api-modal #api-current span { color: var(--text-dark); font-weight: 600; }
#api-modal .row{ display:flex; align-items:center; gap:10px; }
#api-modal input[type="password"]{
  flex:1; height: 40px; padding: 0 12px;
  border:1px solid var(--border-color); border-radius:var(--radius-sm); outline:none; transition: all .2s;
  font-size: 14px;
}
#api-modal input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }
#api-modal .help{ font-size:12px; color:var(--text-muted); flex: 1; line-height: 1.4; }
#api-modal .error{ margin-top:12px; color:var(--danger); font-size:13px; display:none; }

/* Модалка предпросмотра JSON */
.json-preview-box { width: min(90vw, 900px); max-height: 85vh; display: flex; flex-direction: column; }
.json-preview-box textarea { flex-grow: 1; border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 12px; font-family: monospace; font-size: 13px; resize: none; }

/* -------------------- АДАПТИВНОСТЬ -------------------- */
@media (max-width: 600px) {
  .hero-actions { flex-direction: column; }
  .btn { width: 100%; }
  .file-choose { flex-direction: column; align-items: stretch; }
  .btn-app { width: 100%; }
  #file-chosen { text-align: center; margin-top: 8px; margin-bottom: 8px; }
  .status-line { flex-direction: column; gap: 8px; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  #api-modal .row { flex-direction: column; align-items: stretch; gap: 8px; }
  #api-modal .help { text-align: center; margin: 0; }
}