/* ============================================
   LETIM — Главные стили
   ============================================ */

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --c-bg:        #F8F9FB;
  --c-white:     #FFFFFF;
  --c-text:      #1A1A2E;
  --c-text-muted:#6B7280;
  --c-border:    #E5E7EB;
  --c-primary:   #2563EB;
  --c-primary-h: #1D4ED8;
  --c-accent:    #10B981;
  --c-orange:    #F59E0B;
  --c-red:       #EF4444;
  --c-yellow:    #F59E0B;
  --c-green:     #10B981;
  --c-gray:      #6B7280;

  --radius:      12px;
  --radius-sm:   8px;
  --radius-lg:   20px;
  --shadow:      0 1px 4px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg:   0 8px 40px rgba(0,0,0,.10);
  --transition:  .18s ease;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--c-primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--c-primary-h); }
img { max-width: 100%; display: block; }
ul { list-style: none; }
button { cursor: pointer; font-family: inherit; }

/* ── Typography ── */
h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800; line-height: 1.15; letter-spacing: -.02em; }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); font-weight: 700; line-height: 1.25; letter-spacing: -.01em; }
h3 { font-size: 1.25rem; font-weight: 600; line-height: 1.35; }
h4 { font-size: 1rem;    font-weight: 600; }
p  { color: var(--c-text-muted); line-height: 1.75; }

/* ── Layout ── */
.container { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.section    { padding: 80px 0; }
.section--lg { padding: 120px 0; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .9rem; font-weight: 600; line-height: 1;
  padding: 14px 28px; border-radius: var(--radius-sm);
  border: 2px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn--primary {
  background: var(--c-primary); color: #fff;
}
.btn--primary:hover {
  background: var(--c-primary-h); color: #fff; transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(37,99,235,.35);
}
.btn--outline {
  background: transparent; color: var(--c-primary);
  border-color: var(--c-primary);
}
.btn--outline:hover {
  background: var(--c-primary); color: #fff;
}
.btn--ghost {
  background: transparent; color: var(--c-text);
  border-color: var(--c-border);
}
.btn--ghost:hover { background: var(--c-white); }
.btn--lg  { padding: 18px 36px; font-size: 1rem; border-radius: var(--radius-sm); }
.btn--sm  { padding: 8px 16px;  font-size: .8rem; }
.btn--full { width: 100%; justify-content: center; }
.btn--tg { background: #2CA5E0; color: #fff; }
.btn--tg:hover { background: #1a8fc7; color: #fff; }
.btn--danger { background: var(--c-red); color: #fff; }
.btn--danger:hover { background: #DC2626; color: #fff; }
.btn--success { background: var(--c-green); color: #fff; }
.btn--success:hover { background: #059669; color: #fff; }

/* ── Card ── */
.card {
  background: var(--c-white);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 32px;
}
.card--hover { transition: box-shadow var(--transition), transform var(--transition); }
.card--hover:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }

/* ── Badge / Status ── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .75rem; font-weight: 600; padding: 4px 10px;
  border-radius: 100px; white-space: nowrap;
}
.badge--blue   { background: #EFF6FF; color: #2563EB; }
.badge--green  { background: #ECFDF5; color: #059669; }
.badge--orange { background: #FFFBEB; color: #D97706; }
.badge--red    { background: #FEF2F2; color: #DC2626; }
.badge--gray   { background: #F3F4F6; color: #6B7280; }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600; padding: 4px 12px; border-radius: 100px; }
.status--orange { background: #FFFBEB; color: #D97706; }
.status--red    { background: #FEF2F2; color: #DC2626; }
.status--yellow { background: #FFFBEB; color: #D97706; }
.status--green  { background: #ECFDF5; color: #059669; }
.status--gray   { background: #F3F4F6; color: #6B7280; }

/* ── Form elements ── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: .85rem; font-weight: 600; color: var(--c-text); }
.form-input, .form-select, .form-textarea {
  font-family: inherit; font-size: .95rem;
  padding: 12px 16px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--c-border);
  background: var(--c-white); color: var(--c-text);
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-textarea { resize: vertical; min-height: 120px; }
.form-hint { font-size: .8rem; color: var(--c-text-muted); }
.form-error { font-size: .8rem; color: var(--c-red); }

/* ── Alert ── */
.alert { padding: 14px 18px; border-radius: var(--radius-sm); font-size: .9rem; margin-bottom: 20px; }
.alert--info    { background: #EFF6FF; color: #1D4ED8; border-left: 3px solid #2563EB; }
.alert--success { background: #ECFDF5; color: #065F46; border-left: 3px solid #10B981; }
.alert--warning { background: #FFFBEB; color: #92400E; border-left: 3px solid #F59E0B; }
.alert--danger  { background: #FEF2F2; color: #991B1B; border-left: 3px solid #EF4444; }

/* ── Grid ── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }

/* ── Divider ── */
.divider { height: 1px; background: var(--c-border); margin: 32px 0; }

/* ── Tag ── */
.tag {
  font-size: .75rem; font-weight: 600; padding: 4px 10px;
  background: var(--c-bg); color: var(--c-text-muted);
  border-radius: 100px; display: inline-block;
}

/* ── Pagination ── */
.pagination { display: flex; align-items: center; gap: 8px; margin-top: 40px; flex-wrap: wrap; }
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 500;
  border: 1.5px solid var(--c-border);
  transition: all var(--transition);
}
.pagination a { background: var(--c-white); color: var(--c-text); }
.pagination a:hover { border-color: var(--c-primary); color: var(--c-primary); }
.pagination .active { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }

/* ── Tabs ── */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--c-border); margin-bottom: 32px; }
.tab-link {
  font-size: .9rem; font-weight: 600; color: var(--c-text-muted);
  padding: 12px 20px; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all var(--transition);
  background: none; border-top: none; border-left: none; border-right: none;
  cursor: pointer;
}
.tab-link:hover { color: var(--c-text); }
.tab-link.active { color: var(--c-primary); border-bottom-color: var(--c-primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { font-size: .8rem; font-weight: 700; color: var(--c-text-muted); text-transform: uppercase; letter-spacing: .04em; padding: 12px 16px; text-align: left; border-bottom: 2px solid var(--c-border); }
td { font-size: .9rem; padding: 14px 16px; border-bottom: 1px solid var(--c-border); color: var(--c-text); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--c-bg); }

/* ── Empty state ── */
.empty { text-align: center; padding: 60px 20px; }
.empty__icon { font-size: 3rem; margin-bottom: 16px; opacity: .4; }
.empty__title { font-size: 1.1rem; font-weight: 600; margin-bottom: 8px; }
.empty__text { color: var(--c-text-muted); font-size: .9rem; margin-bottom: 24px; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 24px;
  opacity: 0; pointer-events: none; transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--c-white); border-radius: var(--radius-lg);
  width: 100%; max-width: 540px; padding: 40px;
  transform: translateY(20px); transition: transform var(--transition);
  max-height: 90vh; overflow-y: auto;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.modal__title { font-size: 1.25rem; font-weight: 700; }
.modal__close { background: none; border: none; font-size: 1.5rem; color: var(--c-text-muted); cursor: pointer; line-height: 1; }
.modal__close:hover { color: var(--c-text); }

/* ── Loader ── */
.loader {
  width: 20px; height: 20px;
  border: 2.5px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ── */
#toast-container { position: fixed; top: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--c-white); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: 14px 20px;
  font-size: .9rem; font-weight: 500; color: var(--c-text);
  border-left: 4px solid var(--c-primary);
  animation: slideIn .3s ease;
  max-width: 320px;
}
.toast--success { border-color: var(--c-green); }
.toast--error   { border-color: var(--c-red); }
.toast--warning { border-color: var(--c-orange); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .container { padding: 0 16px; }
  .section { padding: 56px 0; }
  .section--lg { padding: 72px 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .card { padding: 24px; }
}
@media (max-width: 480px) {
  .btn--lg { padding: 14px 24px; font-size: .95rem; }
  .tabs { overflow-x: auto; }
}
