/* ════════════════════════════════════════
   COMMON.CSS — общие стили
   ════════════════════════════════════════ */

/* Переменные */
:root {
  --bg-primary:    #0d0d1a;
  --bg-secondary:  #1a1a2e;
  --bg-card:       #1e1e35;
  --bg-panel:      #16162a;
  --border:        #2a2a4a;
  --border-light:  rgba(255,255,255,0.1);
  --accent:        #4a90d9;
  --accent-2:      #7b6cf6;
  --text:          #ffffff;
  --text-muted:    #888888;
  --text-dim:      #555555;
  --success:       #22c55e;
  --danger:        #ef4444;
  --warning:       #eab308;
}

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

[x-cloak] { display: none !important; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-secondary);
  color: var(--text);
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-active {
  background: rgba(34,197,94,0.12);
  color: var(--success);
}
.badge-hidden {
  background: rgba(255,255,255,0.06);
  color: #666;
}

/* ── Кнопки ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: #5a9de5;
}
.btn-secondary {
  background: rgba(255,255,255,0.08);
  color: #aaa;
}
.btn-secondary:hover:not(:disabled) {
  background: rgba(255,255,255,0.14);
  color: #fff;
}
.btn-danger {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.25);
  color: var(--danger);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(239,68,68,0.22);
}
.btn-cancel {
  padding: 9px 18px;
  background: rgba(255,255,255,0.08);
  border: none;
  border-radius: 8px;
  color: #aaa;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s;
}
.btn-cancel:hover { background: rgba(255,255,255,0.14); }
.btn-save {
  padding: 9px 18px;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.2s;
}
.btn-save:hover { background: #5a9de5; }

/* ── Модальные окна ── */
.modal-overlay {
  display: flex;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}
.modal {
  background: var(--bg-card);
  border-radius: 14px;
  padding: 24px;
  width: 100%;
  max-width: 440px;
  margin: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 20px;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ── Формы ── */
.form-group { margin-bottom: 16px; }
.form-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: block;
}
.form-input,
.form-select {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
}
.form-input:focus,
.form-select:focus {
  border-color: var(--accent);
}
.form-select option { background: var(--bg-card); }
.form-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 8px;
}

/* ── Search input ── */
.search-input {
  flex: 1;
  padding: 8px 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
}
.search-input::placeholder { color: var(--text-dim); }
.search-input:focus { border-color: var(--accent); }

/* ── Пагинация ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 4px;
  margin-top: 8px;
}
.pagination-info {
  font-size: 12px;
  color: var(--text-dim);
}
.pagination-btns {
  display: flex;
  gap: 4px;
}
.page-btn {
  width: 30px;
  height: 30px;
  background: rgba(255,255,255,0.06);
  border: none;
  border-radius: 6px;
  color: #888;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
}
.page-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.12);
  color: #fff;
}
.page-btn.active {
  background: var(--accent);
  color: #fff;
}
.page-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

/* ── Icon button ── */
.icon-btn {
  width: 28px;
  height: 28px;
  background: rgba(255,255,255,0.06);
  border: none;
  border-radius: 5px;
  color: #777;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.icon-btn:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}
.icon-btn.danger:hover {
  background: rgba(239,68,68,0.18);
  color: var(--danger);
}

/* ── Add button ── */
.add-btn {
  padding: 8px 14px;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s;
  white-space: nowrap;
}
.add-btn:hover { background: #5a9de5; }

/* ── Спиннер ── */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast уведомление ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 13px;
  z-index: 9999;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  white-space: nowrap;
}
.toast.success { border-color: rgba(34,197,94,0.4); color: var(--success); }
.toast.error   { border-color: rgba(239,68,68,0.4);  color: var(--danger); }
