/* ============================================================
   VELA ESTATES — Admin Panel Styles
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Jost:wght@300;400;500;600;700&display=swap');

:root {
  --navy:     #0D1B2A;
  --navy-mid: #162538;
  --navy-lt:  #1e3248;
  --gold:     #b8966a;
  --gold-lt:  #d4b896;
  --cream:    #F5F0E8;
  --white:    #ffffff;
  --g50:      #f9fafb;
  --g100:     #f3f4f6;
  --g200:     #e5e7eb;
  --g300:     #d1d5db;
  --g400:     #9ca3af;
  --g500:     #6b7280;
  --g700:     #374151;
  --g900:     #111827;
  --red:      #dc2626;
  --red-lt:   #fee2e2;
  --green:    #16a34a;
  --green-lt: #dcfce7;
  --amber-lt: #fef3c7;
  --amber:    #d97706;

  --radius:   6px;
  --radius-lg:12px;
  --shadow:   0 1px 8px rgba(0,0,0,.08);
  --shadow-lg:0 4px 24px rgba(0,0,0,.14);
  --transition:.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: 'Jost', system-ui, sans-serif;
  background: var(--g50);
  color: var(--g900);
  line-height: 1.55;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; display: block; }

/* ── HEADER ──────────────────────────────────────────────── */
.admin-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--navy);
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 2rem;
  box-shadow: 0 1px 0 rgba(255,255,255,.06);
}
.admin-logo {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--white);
  letter-spacing: .08em;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.admin-logo img { height: 22px; width: auto; }
.admin-logo span { color: var(--gold); }

.admin-nav {
  display: flex;
  gap: .25rem;
  flex: 1;
}
.admin-nav-btn {
  background: none;
  border: none;
  color: var(--g400);
  font-size: .82rem;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .45rem 1rem;
  border-radius: var(--radius);
  transition: var(--transition);
}
.admin-nav-btn:hover { color: var(--white); background: rgba(255,255,255,.07); }
.admin-nav-btn.active { color: var(--gold); background: rgba(184,150,106,.12); }

.admin-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .75rem;
  color: var(--g400);
  font-size: .82rem;
}
.admin-logout {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  color: var(--g400);
  font-size: .78rem;
  padding: .35rem .85rem;
  border-radius: var(--radius);
  transition: var(--transition);
}
.admin-logout:hover { color: var(--white); background: rgba(255,255,255,.12); }

/* ── LOGIN PAGE ──────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
}
.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
}
.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1.75rem;
}
.login-logo img { height: 28px; }
.login-card h1 {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--g900);
  text-align: center;
  margin-bottom: .4rem;
}
.login-card p {
  font-size: .85rem;
  color: var(--g500);
  text-align: center;
  margin-bottom: 2rem;
}

/* ── MAIN LAYOUT ─────────────────────────────────────────── */
.admin-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── TOOLBAR ─────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.toolbar h2 {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--g900);
}
.toolbar-right {
  display: flex;
  gap: .75rem;
  align-items: center;
}

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.2rem;
  font-size: .82rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: var(--transition);
  cursor: pointer;
  white-space: nowrap;
}
.btn-primary {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}
.btn-primary:hover { background: var(--navy-mid); }
.btn-gold {
  background: var(--gold);
  color: var(--white);
  border-color: var(--gold);
}
.btn-gold:hover { opacity: .88; }
.btn-outline {
  background: transparent;
  color: var(--g700);
  border-color: var(--g300);
}
.btn-outline:hover { background: var(--g100); }
.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: var(--red);
}
.btn-danger:hover { background: var(--red-lt); }
.btn-sm { padding: .35rem .8rem; font-size: .76rem; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ── FORM ELEMENTS ───────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin-bottom: 1rem;
}
.form-group label {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--g500);
}
.form-group input,
.form-group select,
.form-group textarea {
  padding: .6rem .85rem;
  border: 1px solid var(--g300);
  border-radius: var(--radius);
  font-size: .9rem;
  color: var(--g900);
  background: var(--white);
  transition: border-color var(--transition);
  resize: vertical;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--navy);
}
.form-group textarea { min-height: 100px; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.form-row.thirds {
  grid-template-columns: 1fr 1fr 1fr;
}
.span-2 { grid-column: 1 / -1; }

.checkbox-group {
  display: flex;
  align-items: center;
  gap: .6rem;
  cursor: pointer;
}
.checkbox-group input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--navy);
  cursor: pointer;
  padding: 0;
  border: none;
}
.checkbox-group span {
  font-size: .88rem;
  color: var(--g700);
  font-weight: 500;
}

.form-error {
  font-size: .8rem;
  color: var(--red);
  margin-top: .25rem;
}

/* ── TABLE ───────────────────────────────────────────────── */
.table-wrap {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
.data-table thead th {
  padding: .85rem 1rem;
  text-align: left;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--g400);
  background: var(--g50);
  border-bottom: 1px solid var(--g200);
  white-space: nowrap;
}
.data-table tbody td {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--g100);
  vertical-align: middle;
  color: var(--g700);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--g50); }
.data-table .cell-img {
  width: 58px;
  height: 44px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--g200);
  display: block;
}
.data-table .cell-title { font-weight: 600; color: var(--g900); }
.data-table .cell-actions {
  display: flex;
  gap: .4rem;
  flex-wrap: nowrap;
}

/* ── STATUS BADGES ───────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .2rem .65rem;
  border-radius: 50px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-for-sale  { background: #e0f2fe; color: #0369a1; }
.badge-for-rent  { background: var(--amber-lt); color: var(--amber); }
.badge-sold      { background: var(--green-lt); color: var(--green); }
.badge-hidden    { background: var(--g100); color: var(--g400); }
.badge-exclusive { background: #fdf4e7; color: var(--gold); }
.badge-new       { background: #eff6ff; color: #2563eb; }
.badge-visible   { background: var(--green-lt); color: var(--green); }
.badge-hidden-svc { background: var(--g100); color: var(--g400); }

/* ── MODAL ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 680px;
  animation: modal-in .2s ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--g200);
  position: sticky;
  top: 0;
  background: var(--white);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  z-index: 1;
}
.modal-header h3 { font-size: 1.05rem; font-weight: 600; }
.modal-close {
  background: var(--g100);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.1rem;
  color: var(--g500);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.modal-close:hover { background: var(--g200); color: var(--g900); }
.modal-body { padding: 1.5rem; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--g200);
}

/* ── SETTINGS SECTION ────────────────────────────────────── */
.settings-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 2rem;
  max-width: 640px;
}
.settings-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--g900);
  margin-bottom: 1.5rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--g200);
}

/* ── TOAST ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  background: var(--g900);
  color: var(--white);
  padding: .75rem 1.25rem;
  border-radius: var(--radius);
  font-size: .84rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  transform: translateY(80px);
  opacity: 0;
  transition: transform .3s ease, opacity .3s ease;
  max-width: 360px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.toast-error { background: var(--red); }
.toast.toast-success { background: var(--green); }

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty-row td {
  text-align: center;
  padding: 3rem !important;
  color: var(--g400);
  font-size: .9rem;
}

/* ── STAT CARDS (dashboard summary) ──────────────────────── */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
}
.stat-card .stat-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--g400);
  margin-bottom: .4rem;
}
.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--g900);
  line-height: 1;
}
.stat-card .stat-sub {
  font-size: .78rem;
  color: var(--g400);
  margin-top: .25rem;
}

/* ── GALLERY PREVIEW ─────────────────────────────────────── */
.gallery-preview {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .5rem;
}
.gallery-preview img {
  width: 70px;
  height: 52px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--g200);
}
.gallery-preview .remove-img {
  position: relative;
}
.gallery-preview .remove-img::after {
  content: '×';
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--red);
  color: white;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-size: .7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ── SEARCH ──────────────────────────────────────────────── */
.search-input {
  padding: .5rem .85rem;
  border: 1px solid var(--g300);
  border-radius: var(--radius);
  font-size: .85rem;
  background: var(--white);
  color: var(--g900);
  min-width: 220px;
}
.search-input:focus { outline: none; border-color: var(--navy); }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .form-row.thirds { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .admin-header { padding: 0 1rem; gap: 1rem; }
  .admin-main { padding: 1rem; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .modal-overlay { padding: 1rem .5rem; }
}
