
/* =======================
   Reset и базовая типографика
   ======================= */
html { box-sizing: border-box; }
*, *::before, *::after { box-sizing: inherit; }
* { margin: 0; }
body { font-family: 'Inter', Arial, sans-serif; margin:0; background:#f5f6fa; color:#111; line-height:1.5; -webkit-font-smoothing: antialiased; }
img, picture, video, canvas, svg { display:block; max-width:100%; }
input, button, textarea, select { font: inherit; }
:focus-visible { outline:3px solid #4c7cff; outline-offset:2px; }

/* =======================
   Шапка/геро/каталог
   ======================= */
.container {max-width:1140px; margin:0 auto; padding:0 15px;}
.header-flex {display:flex; align-items:center; justify-content:space-between; padding:24px 0;}
.logo {font-family: serif; font-size:2rem; letter-spacing:2px;}
.search input {padding:10px 16px; border-radius:8px; min-width:220px; border:1px solid #ddd;}
.sell-btn {background:#181c26; color:#fff; padding:10px 22px; border-radius:8px; margin-left:12px; text-decoration:none;}
.login-link {margin-right:8px; color:#181c26; text-decoration:none;}
.hero {margin:42px auto 32px; text-align:center;}
.hero h1 {font-size:2.6rem; font-weight:700; margin-bottom:14px;}
.hero-desc {color:#7a7a7a; font-size:1.1rem;}

/* =======================
   Фильтры (актуальные)
   ======================= */
.filters--pretty {
  display:grid;
  grid-template-columns: 1fr 1fr 1fr auto; /* город | дата | цена (от/до) | кнопки */
  gap:16px;
  align-items:end;
  padding:20px;
  margin:20px auto;
  max-width:1140px;
  background:#fff;
  border-radius:16px;
  border:1px solid #e8ecf4;
  box-shadow:0 6px 24px rgba(24,28,38,.06);
}
.f-item {display:flex; flex-direction:column; gap:6px;}
/* скрываем лейблы */
.f-item label { display:none; }

/* поля */
.f-item input,
.f-item select {
  padding:10px 12px; height:42px;
  border:1px solid #e1e6ef; border-radius:10px;
  font-size:14px; background:#fbfcfe;
  transition:border-color .2s, box-shadow .2s;
}
.f-item input:focus-visible,
.f-item select:focus-visible {
  border-color:#4c7cff;
  box-shadow:0 0 0 3px rgba(76,124,255,.2);
  outline:none;
}

/* пара цена от/до */
.f-item--minmax {
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
}
.f-item--minmax input::placeholder {
  color:#999;
}

/* кнопки */
.f-actions {display:flex; gap:10px; align-items:center; justify-content:flex-end; white-space:nowrap;}
.btn {
  display:inline-flex; align-items:center; justify-content:center;
  height:42px; padding:0 16px; border-radius:10px;
  font-weight:800; border:1px solid transparent;
  text-decoration:none; cursor:pointer; transition:background .2s, box-shadow .2s;
}
.btn--primary {background:#111827; color:#fff;}
.btn--primary:hover {background:#0d1320;}
.btn--ghost {background:#f5f7fb; color:#1f2430; border-color:#e6eaf0;}
.btn--ghost:hover {background:#eef2f8;}

/* адаптив */
@media(max-width:900px){
  .filters--pretty{grid-template-columns:1fr;}
  .f-actions{white-space:normal;}
  .f-actions .btn{flex:1;}
}

/* =======================
   Карточки каталога
   ======================= */
.cards {display:grid; grid-template-columns:repeat(3,1fr); gap:24px; margin:28px auto 48px; max-width:1140px;}
@media (max-width:1024px){ .cards{grid-template-columns:repeat(2,1fr);} }
@media (max-width:640px){ .cards{grid-template-columns:1fr; gap:18px;} }

.card {background:#fff; border-radius:16px; box-shadow:0 6px 24px rgba(24,28,38,.06); overflow:hidden; border:1px solid #edf0f5;}
.card-cover {width:100%; aspect-ratio: 3 / 2; object-fit:cover; background:#f1f3f7;}
.card-body {padding:16px 16px 18px;}
.event-title {font-weight:700; margin-bottom:6px; line-height:1.25;}
.event-date {color:#6b7280; font-size:.93rem; margin-bottom:12px;}
.price {font-size:1.15rem; font-weight:800;}
.oldprice {color:#a3aab6; text-decoration:line-through; margin-left:8px; font-weight:500;}
.buy-btn {display:block; width:100%; background:#111827; color:#fff; border-radius:10px; text-align:center; padding:12px 0; margin-top:14px; text-decoration:none; font-weight:700;}
.buy-btn:hover {background:#0d1320;}

/* Контейнер под ленту */
.catalog-wrap {max-width:1140px; margin:0 auto; padding:0 15px 40px;}

/* =======================
   Формы билета / Ticket page
   ======================= */
.ticket-form-wrap {max-width:560px; margin:38px auto 70px;}
.tf-title {text-align:center; font-weight:800; font-size:22px; margin:6px 0 18px;}
.form-card {margin-top:18px; background:#fff; border:1px solid #E6EAF0; border-radius:14px; box-shadow:0 2px 16px rgba(0,0,0,.05); padding:18px;}
.form-row {display:flex; flex-direction:column; gap:8px; margin-bottom:14px;}
.form-row label {font-weight:600; font-size:13px; color:#374151;}
.form-row input, .form-row select, .form-row textarea {width:100%; border:1px solid #E1E6EF; background:#FBFCFE; border-radius:10px; padding:12px 14px; font-size:14px; color:#111827; outline:none; margin:0; transition:border-color .15s, background .15s, box-shadow .15s;}
.form-row input:focus-visible, .form-row select:focus-visible, .form-row textarea:focus-visible {border-color:#4c7cff; box-shadow:0 0 0 3px rgba(76,124,255,.2); background:#fff;}
.tf-submit {width:100%; margin-top:16px; padding:14px 16px; border:0; border-radius:10px; background:#2A2F39; color:#fff; font-weight:800; font-size:14px; cursor:pointer; box-shadow:0 2px 8px rgba(0,0,0,.08); letter-spacing:.2px;}
.tf-submit:hover {background:#1f242d;}
.tf-submit:focus-visible {box-shadow:0 0 0 3px rgba(76,124,255,.35);}
.tf-error {color:#e25252; margin:12px 0 0; font-size:14px; text-align:center;}
.form-card, .ticket-form-wrap {overflow:hidden;}

/* Ticket page (детали) */
.ticket-page { max-width: 700px; margin: 20px auto; padding: 0 15px; }
.event-image { margin-bottom: 20px; border-radius: 12px; overflow: hidden; }
.event-photo { width: 100%; height: 400px; object-fit: cover; }
.placeholder-image { width: 100%; height: 400px; background: #f0f2f5; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #8a93a4; border-radius: 12px; }
.placeholder-icon { font-size: 3rem; margin-bottom: 8px; }
.event-details h1 { font-size: 1.8rem; font-weight: 700; margin-bottom: 16px; }
.event-meta { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.meta-item { display: flex; align-items: center; gap: 8px; color: #666; }
.meta-item .icon { font-size: 1.1rem; }
.seller-info { margin-bottom: 24px; }
.seller-info h3 { font-size: 1.1rem; margin-bottom: 12px; }
.seller-card { display: flex; align-items: center; gap: 12px; background: #f8fafc; padding: 12px; border-radius: 8px; }
.seller-avatar { width: 40px; height: 40px; background: #e2e8f0; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.seller-name { font-weight: 600; }
.seller-rating { color: #666; font-size: 0.9rem; }
.purchase-section { background: #fff; border: 1px solid #e6eaf0; border-radius: 12px; padding: 20px; margin-bottom: 24px; }
.current-price { font-size: 2rem; font-weight: 700; color: #2a2f39; }
.price-savings { margin-top: 4px; }
.original-price { color: #999; text-decoration: line-through; margin-right: 8px; }
.savings { color: #10b981; font-weight: 600; }
.buy-button { width: 100%; background: #2a2f39; color: #fff; border: 0; padding: 14px; border-radius: 8px; font-weight: 600; font-size: 1rem; margin: 16px 0; cursor: pointer; }
.buy-button:hover { background: #1f242d; }
.ticket-details { margin-top: 16px; }
.ticket-details p { margin-bottom: 8px; color: #555; }
.faq-section h3 { font-size: 1.1rem; margin-bottom: 16px; }
.faq-item { margin-bottom: 16px; }
.faq-question { font-weight: 600; cursor: pointer; padding: 12px 0; border-bottom: 1px solid #e6eaf0; }
.faq-answer { padding: 12px 0; color: #666; line-height: 1.5; border-bottom: 1px solid #f0f2f5; }

/* Адаптивность карточек/страницы */
@media (max-width:640px){
  .cards {grid-template-columns:1fr; gap:20px;}
  .filters--pretty{grid-template-columns:1fr;}
  .tf-title {font-size:20px;}
  .form-card {padding:16px;}
  .ticket-page { margin: 10px auto; }
  .event-photo, .placeholder-image { height: 250px; }
  .event-details h1 { font-size: 1.5rem; }
  .current-price { font-size: 1.6rem; }
}

/* =======================
   Footer
   ======================= */
footer{
  background:#111827;           /* тёмная подложка */
  color:#cfd6e4;                /* светлый текст */
  border-top:1px solid #2a3040; /* тонкая линия сверху */
  margin-top:40px;
}
.footer-flex{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:22px 0;
}
footer a{
  color:#cfd6e4;
  text-decoration:none;
  margin-right:18px;            /* интервалы между ссылками слева */
}
footer a:hover{ color:#ffffff; text-decoration:underline; }
footer .powered{ opacity:.75; }

/* Мобильная раскладка */
@media (max-width:720px){
  .footer-flex{
    flex-direction:column;
    align-items:flex-start;
    gap:12px;
  }
  footer a{
    margin-right:14px;
    margin-bottom:6px;
    display:inline-block;
  }
}

footer .powered a{
  background:rgba(255,255,255,.08);
  padding:4px 8px;
  border-radius:8px;
}
footer .powered a:hover{
  background:rgba(255,255,255,.14);
}


/* --- Header nav layout --- */
.main-header nav {
  display: flex;
  align-items: center;
  gap: 12px;           /* равный отступ между элементами */
}

.user-name { color:#1f2430; }

/* --- Logout as ghost button --- */
.logout-link{
  display:inline-flex;
  align-items:center;
  height:42px;
  padding:0 14px;
  border:1px solid #e6eaf0;
  border-radius:8px;
  background:#f5f7fb;
  color:#1f2430;
  text-decoration:none;
  margin-left:0;       /* отступы теперь задаёт gap */
  transition:background .2s, border-color .2s, color .2s;
}
.logout-link:hover{
  background:#eef2f8;
  border-color:#dfe6f2;
  color:#111827;
}
.logout-link:visited{ color:#1f2430; }  /* убираем фиолетовый visited */

/* чтобы кнопки выглядели ровно по высоте */
.sell-btn{ line-height:42px; display:inline-block; padding:0 22px; }
.login-link{ line-height:42px; }
/* nav-buttons */
.nav-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* --- Header: базовая правка --- */
.main-header nav{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;              /* можно переносить элементы */
}
.logo{
  white-space:nowrap;          /* не переносить F A N 2 F A N */
}

/* --- Адаптив шапки --- */
@media (max-width: 900px){
  .header-flex{
    flex-wrap:wrap;            /* позволяем второй ряд */
    gap:12px;
    align-items:flex-start;
  }
  .logo{
    font-size:1.6rem;          /* поменьше логотип */
    letter-spacing:1px;
  }
  .search{ order:3; width:100%; }       /* поиск вниз и на всю ширину */
  .search input{ width:100%; }

  .main-header nav{ order:2; margin-left:auto; gap:10px; }
  .user-name{ max-width:30vw; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .sell-btn{ height:38px; line-height:38px; padding:0 16px; border-radius:8px; }
  .login-link, .logout-link{ height:38px; line-height:38px; padding:0 12px; }
}

@media (max-width: 520px){
  .header-flex{
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }
  .logo{
    font-size:1.4rem;
    letter-spacing:.5px;
    margin-bottom: 8px;
    order: 1;
  }
  .main-header nav{
    order: 2;
    margin-left: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }
  .user-name{
    display: block;
    text-align: center;
    margin-bottom: 4px; /* вторая строка — имя */
  }
  .nav-buttons{
    display: flex;
    flex-direction: row; /* третья строка — кнопки в ряд */
    gap: 8px;
  }
  .search{
    order: 3;
    width: 100%;
  }
}

/* кликабельный логотип-ссылка */
.logo{
  font-family: serif;
  font-size: 2rem;
  letter-spacing: 2px;
  text-decoration: none;
  color: inherit;
  display: inline-block;
  line-height: 1;       /* чтобы клик-площадь была аккуратной */
  cursor: pointer;
}
.logo:hover{ opacity: .85; }
/* размеры логотипа-изображения */
.logo img{
  height: 36px;
  width: auto;
  display: block; /* убрать лишние отступы снизу */
}

/* адаптивные размеры логотипа */
@media (max-width: 900px){
  .logo img{ height: 32px; }
}
@media (max-width: 520px){
  .logo img{ height: 28px; }
}

/* --- Dropzone ------------------------------------------------------------ */
.ticket-form-wrap .tf-dropzone{
  display:block;
  border:2px dashed #D9DEE7;         /* пунктир */
  border-radius:16px;
  background:#fff;
  padding:28px;
  cursor:pointer;
  transition:border-color .2s, box-shadow .2s, background .2s;
}
.ticket-form-wrap .tf-dropzone.is-drag,
.ticket-form-wrap .tf-dropzone:hover,
.ticket-form-wrap .tf-dropzone:focus-within{
  border-color:#4C7CFF;
  background:#F8FBFF;
  box-shadow:0 0 0 4px rgba(76,124,255,.10);
}

.ticket-form-wrap .tf-dropzone .tf-dropzone-inner{
  min-height:160px;
  display:flex; align-items:center; justify-content:center;
  flex-direction:column; gap:12px;
  pointer-events:none; /* клики уходят на label */
  text-align:center;
}

.ticket-form-wrap .tf-dropzone .tf-upload-icon{ width:56px; height:56px; line-height:0; }
.ticket-form-wrap .tf-dropzone .tf-upload-icon svg{ width:56px; height:56px; display:block; }

/* Жёстко фиксируем стили линий, чтобы глобальные правила не ломали иконку */
.ticket-form-wrap .tf-dropzone .tf-upload-icon svg *,
.ticket-form-wrap .tf-dropzone .tf-upload-icon svg path,
.ticket-form-wrap .tf-dropzone .tf-upload-icon svg circle,
.ticket-form-wrap .tf-dropzone .tf-upload-icon svg ellipse,
.ticket-form-wrap .tf-dropzone .tf-upload-icon svg line,
.ticket-form-wrap .tf-dropzone .tf-upload-icon svg polyline{
  stroke:#8A93A4 !important;
  fill:none !important;
  stroke-width:2 !important;
  stroke-linecap:round; stroke-linejoin:round;
}

.ticket-form-wrap .tf-dropzone .tf-dropzone-text{ color:#475569; font-size:16px; }
.ticket-form-wrap .tf-dropzone .tf-dropzone-text span{
  display:block; margin-top:6px; color:#94A3B8; font-size:14px;
}

/* Тонкая доводка дропзоны */
.ticket-form-wrap .tf-dropzone{
  border-radius:20px;
  border:2px dashed #cbd5e1;       /* светлее пунктир */
  background:#fff;
  padding:36px 28px;                /* больше воздуха */
}

.ticket-form-wrap .tf-dropzone .tf-dropzone-inner{
  min-height:180px;
  gap:14px;
}

.ticket-form-wrap .tf-dropzone .tf-upload-icon svg{
  width:64px; height:64px;
}

/* Иконка: чуть толще линии и свой цвет */
.ticket-form-wrap .tf-dropzone .tf-upload-icon svg *,
.ticket-form-wrap .tf-dropzone .tf-upload-icon svg path,
.ticket-form-wrap .tf-dropzone .tf-upload-icon svg polyline{
  stroke:#6b7280 !important;        /* серый 500 */
  stroke-width:1.8 !important;
  fill:none !important;
}

/* Текст */
.ticket-form-wrap .tf-dropzone .tf-dropzone-text{
  color:#334155;                     /* slate-700 */
  font-size:16px;
}
.ticket-form-wrap .tf-dropzone .tf-dropzone-text span{
  color:#94a3b8;                     /* slate-400 */
  font-size:14px;
}

/* Ховер/drag focus */
.ticket-form-wrap .tf-dropzone.is-drag,
.ticket-form-wrap .tf-dropzone:hover,
.ticket-form-wrap .tf-dropzone:focus-within{
  border-color:#4c7cff;
  background:#f8fbff;
  box-shadow:0 0 0 4px rgba(76,124,255,.10);
}

/* Тёмная тема (если есть .dark на body) */
.dark .ticket-form-wrap .tf-dropzone{
  background:#0b1220;
  border-color:#28334a;
}
.dark .ticket-form-wrap .tf-dropzone .tf-dropzone-text{ color:#cbd5e1; }
.dark .ticket-form-wrap .tf-dropzone .tf-dropzone-text span{ color:#7a8aac; }
.dark .ticket-form-wrap .tf-dropzone .tf-upload-icon svg *{ stroke:#a3aed0 !important; }
.dark .ticket-form-wrap .tf-dropzone.is-drag,
.dark .ticket-form-wrap .tf-dropzone:hover{ background:#0f172a; border-color:#7aa2ff; }

/* =======================
   Modal (Diagram)
   ======================= */
.modal{
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
}
.modal.is-open{
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal__backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.5);
}
.modal__dialog{
  position: relative;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  max-width: 90vw;
  max-height: 90vh;
  width: min(900px, 90vw);
  overflow: hidden;
  z-index: 1001;
}
.modal__close{
  position: absolute;
  top: 8px;
  right: 10px;
  border: 0;
  background: rgba(255,255,255,.9);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: #111827;
  padding: 4px 8px;
  border-radius: 8px;
}
.modal__close:hover{
  background: #fff;
}
.modal__body{
  padding: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
#diagramImage{
  max-width: 90vw;
  max-height: 85vh;
  width: auto;
  height: auto;
  display: block;
}
#diagramIframe{
  width: min(900px, 90vw);
  height: min(80vh, 720px);
  border: 0;
  background: #fff;
  display: block;
}

/* link hint */
a.open-diagram{
  text-decoration: underline;
  cursor: pointer;
}

/* =======================
   Ticket form: success toast, progress bar, button loading
   ======================= */
.tf-success{
  background:#ecfdf5;               /* green-50 */
  color:#065f46;                     /* green-900 */
  border:1px solid #a7f3d0;          /* green-200 */
  border-radius:10px;
  padding:12px 14px;
  margin-top:12px;
  font-weight:600;
}
.tf-success.is-visible{
  position:fixed;
  top:16px;
  right:16px;
  max-width:420px;
  z-index:2000;
  box-shadow:0 8px 24px rgba(0,0,0,.15);
  animation:toast-in .25s ease-out;
}
@keyframes toast-in{
  from{ opacity:0; transform:translateY(-6px); }
  to  { opacity:1; transform:translateY(0); }
}

/* Progress (indeterminate) */
.tf-progress{
  display:flex;
  align-items:center;
  gap:10px;
  background:#fff;
  border:1px solid #e6eaf0;
  border-radius:10px;
  padding:10px 12px;
  margin-top:12px;
}
.tf-progress .bar{
  position:relative;
  width:100%;
  height:6px;
  border-radius:999px;
  overflow:hidden;
  background:#e5e7eb; /* gray-200 */
}
.tf-progress .bar::after{
  content:"";
  position:absolute;
  top:0;
  left:-50%;
  height:100%;
  width:50%;
  background:linear-gradient(90deg, rgba(76,124,255,0) 0%, rgba(76,124,255,.85) 50%, rgba(76,124,255,0) 100%);
  animation:indeterminate 1.2s infinite;
}
@keyframes indeterminate{
  0%   { left:-50%; }
  100% { left:100%; }
}
.tf-progress .tf-progress-text{
  color:#374151;
  font-size:14px;
  white-space:nowrap;
}

/* Submit button loading state */
.tf-submit.is-loading{
  position:relative;
}
.tf-submit.is-loading::after{
  content:"";
  width:16px; height:16px;
  border:2px solid rgba(255,255,255,.6);
  border-top-color:#fff;
  border-radius:50%;
  position:absolute;
  right:14px;
  top:50%;
  transform:translateY(-50%);
  animation:spin .9s linear infinite;
}
@keyframes spin{
  to{ transform:translateY(-50%) rotate(360deg); }
}
.tf-submit[disabled]{
  opacity:.7;
  cursor:not-allowed;
}

/* =======================
   LK (Личный кабинет)
   ======================= */
.lk-wrap{max-width:1140px;margin:20px auto;padding:0 15px 40px;}
.lk-title{font-size:1.8rem;font-weight:800;margin:8px 0 16px;}
.lk-block{background:#fff;border:1px solid #e6eaf0;border-radius:12px;padding:16px;margin-bottom:20px;}
.lk-block h2{font-size:1.2rem;margin-bottom:12px;}
.table-wrap{overflow:auto;}
.lk-table{width:100%;border-collapse:collapse;font-size:14px;}
.lk-table th,.lk-table td{border:1px solid #e5e7eb;padding:8px;vertical-align:top;}
.lk-table th{background:#f8fafc;text-align:left;}
.lk-empty{color:#6b7280;padding:8px 0;}
.mono{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;}
