/* ============================================
   Админ-панель — стили
   ============================================ */

:root {
  --accent: #e85d2f;
  --accent-dark: #c94a20;
  --accent-glow: rgba(232, 93, 47, .55);
  --dark: #22242a;
  --gray: #6b6f78;
  --bg: #f6f4f1;
  --white: #fff;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0, 0, 0, .08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Segoe UI', system-ui, Arial, sans-serif;
  background: var(--bg);
  color: var(--dark);
  line-height: 1.5;
  min-height: 100vh;
}

/* ---------- Header ---------- */

.admin-header {
  background: var(--white);
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow);
}
.header-inner {
  max-width: 1100px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.logo {
  font-size: 1.25rem; font-weight: 800; text-decoration: none; color: var(--dark);
}
.logo span { color: var(--accent); }
.admin-header h1 {
  font-size: 1.1rem; font-weight: 600; color: var(--gray);
  flex: 1;
}
.back-link {
  font-size: .9rem; color: var(--accent); text-decoration: none; font-weight: 600;
}
.back-link:hover { text-decoration: underline; }

/* ---------- Main ---------- */

.admin-main {
  max-width: 1100px; margin: 24px auto; padding: 0 20px 60px;
  display: flex; flex-direction: column; gap: 24px;
}

/* ---------- Panel ---------- */

.panel {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.panel-title {
  font-size: 1.2rem; font-weight: 700;
}
.panel-header .panel-title { margin-bottom: 0; }

/* ---------- Forms ---------- */

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.field {
  display: flex; flex-direction: column; gap: 4px;
}
.field label {
  font-size: .85rem; font-weight: 600; color: var(--gray);
}
.field input, .field textarea, .field select {
  padding: 10px 14px;
  border: 2px solid #e2e0dd;
  border-radius: 8px;
  font-size: .95rem;
  font-family: inherit;
  transition: border-color .2s;
  background: var(--white);
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.field.full-width {
  grid-column: 1 / -1;
}
.field-actions {
  grid-column: 1 / -1;
  display: flex; gap: 12px; justify-content: flex-end;
  padding-top: 8px;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 24px;
  border: 2px solid transparent;
  border-radius: 8px;
  font-size: .9rem; font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
}
.btn-primary {
  background: var(--accent); color: var(--white);
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-accent {
  background: var(--accent); color: var(--white);
}
.btn-accent:hover { background: var(--accent-dark); }
.btn-outline {
  background: transparent; border-color: #d8d4cf; color: var(--dark);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger {
  background: #fee; border-color: #e55; color: #c33;
}
.btn-danger:hover { background: #e55; color: var(--white); }
.btn-small { padding: 6px 14px; font-size: .8rem; }

/* ---------- Hostel cards ---------- */

.hostel-cards {
  display: flex; flex-direction: column; gap: 14px;
}
.hostel-card {
  display: flex; align-items: center; gap: 16px;
  padding: 14px;
  border: 2px solid #f0eeeb;
  border-radius: var(--radius);
  transition: border-color .2s;
}
.hostel-card:hover { border-color: #d8d4cf; }
.hostel-card-img {
  width: 80px; height: 80px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.hostel-card-info {
  flex: 1; min-width: 0;
}
.hostel-card-info h3 {
  font-size: 1rem; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hostel-card-info .addr {
  font-size: .85rem; color: var(--gray);
}
.hostel-card-info .price {
  font-size: .9rem; color: var(--accent); font-weight: 700;
}
.hostel-card-actions {
  display: flex; gap: 8px; flex-shrink: 0;
}

/* ---------- Modal ---------- */

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .5);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
  padding: 20px;
}
.modal-overlay.active {
  opacity: 1; pointer-events: auto;
}
.modal {
  background: var(--white);
  border-radius: var(--radius);
  width: 100%; max-width: 700px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  transform: translateY(20px);
  transition: transform .25s;
}
.modal-overlay.active .modal {
  transform: translateY(0);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 0;
}
.modal-header h3 { font-size: 1.2rem; }
.modal-close {
  width: 36px; height: 36px;
  border: none; background: none;
  font-size: 1.5rem; cursor: pointer;
  color: var(--gray); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: #f0eeeb; color: var(--dark); }
.modal .form-grid {
  padding: 20px 24px 24px;
}
.modal-actions {
  justify-content: flex-end;
}

/* ---------- Photo inputs ---------- */

.photo-inputs {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  margin-bottom: 12px;
}
.photo-field {
  display: flex; flex-direction: column; gap: 4px;
}
.photo-label {
  font-size: .8rem; font-weight: 600; color: var(--gray);
}
.photo-input {
  padding: 8px 10px !important;
  font-size: .85rem !important;
}
.photo-preview {
  width: 100%; height: 100px;
  object-fit: cover; border-radius: 8px;
  background: #f0eeeb;
  display: none;
}
.photo-preview.visible { display: block; }
.photo-upload-row {
  display: flex; align-items: center; gap: 12px;
}
.upload-btn { cursor: pointer; }
.upload-btn input { display: none; }

/* ---------- Price grid ---------- */

.price-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  align-items: start;
}
.price-grid .checkbox-label {
  display: flex; align-items: center; gap: 6px;
  font-size: .85rem; font-weight: 600; color: var(--gray);
  padding-top: 8px;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: var(--dark); color: var(--white);
  padding: 12px 28px;
  border-radius: 999px;
  font-weight: 600; font-size: .9rem;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
  opacity: 0; pointer-events: none;
  transition: opacity .3s, transform .3s;
  z-index: 200;
}
.toast.visible {
  opacity: 1; transform: translateX(-50%) translateY(0);
}

/* ---------- Empty state ---------- */

.empty-state {
  text-align: center; padding: 40px 20px;
  color: var(--gray);
}
.empty-state p { margin-bottom: 16px; }

/* ---------- Login ---------- */

.login-screen {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 20px;
}
.login-box {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(0,0,0,.12);
  padding: 40px 36px;
  width: 100%; max-width: 380px;
  display: flex; flex-direction: column; gap: 16px;
}
.login-box h2 {
  font-size: 1.3rem; font-weight: 800; text-align: center; margin-bottom: 4px;
}
.login-error {
  display: none;
  background: #fee; color: #c33; border-radius: 8px;
  padding: 8px 14px; font-size: .85rem; font-weight: 600;
  text-align: center;
}
.login-error.visible { display: block; }
.btn-full { width: 100%; }
.login-back {
  text-align: center; font-size: .85rem; color: var(--gray);
  text-decoration: none; margin-top: 4px;
}
.login-back:hover { color: var(--accent); }

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .photo-inputs { grid-template-columns: 1fr; }
  .price-grid { grid-template-columns: 1fr; }
  .hostel-card { flex-direction: column; align-items: stretch; }
  .hostel-card-img { width: 100%; height: 160px; }
  .hostel-card-actions { justify-content: stretch; }
  .hostel-card-actions .btn { flex: 1; }
  .modal { max-width: 100%; margin: 10px; }
}

@media (max-width: 1024px) {
  .price-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Tabs ---------- */

.panel-tabs {
  display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap;
}
.tab-btn {
  padding: 8px 16px;
  border: 2px solid #e2e0dd;
  border-radius: 8px;
  background: var(--white);
  color: var(--gray);
  font-size: .85rem; font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
}
.tab-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.tab-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--white);
}
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

/* ---------- Content forms ---------- */

.content-form {
  display: flex; flex-direction: column; gap: 16px;
}
.content-form h3 {
  font-size: 1rem; font-weight: 700; margin-bottom: 8px;
}
.content-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  padding: 16px;
  border: 2px solid #f0eeeb;
  border-radius: 8px;
  align-items: start;
}
.content-row .field {
  margin: 0;
}
.content-row .field.full-width {
  grid-column: 1 / -2;
}
.content-row button {
  align-self: center;
}

@media (max-width: 640px) {
  .content-row {
    grid-template-columns: 1fr;
  }
  .content-row .field.full-width {
    grid-column: 1;
  }
}
