/* ============================================================
   StayBook - Management Panel Styles
   Admin / Partner / Manager Dashboard
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #006a6a;
  --on-primary: #ffffff;
  --primary-light: #6ff7f6;
  --primary-dark: #004d4d;
  --secondary: #4a6363;
  --surface: #f4f7f6;
  --surface-cont: #ffffff;
  --surface-variant: #dbe4e3;
  --on-surface: #161d1d;
  --on-surface-var: #3f4948;
  --outline: #6f7979;
  --outline-var: #bec8c7;
  --error: #ba1a1a;
  --error-light: #ffdad6;
  --success: #2e7d32;
  --success-light: #e8f5e9;
  --warning: #e65100;
  --warning-light: #fff3e0;
  --r-s: 8px;
  --r-m: 12px;
  --r-l: 16px;
  --r-xl: 24px;
  --r-f: 999px;
  --sidebar-w: 260px;
  --header-h: 64px;
  --elev-1: 0 1px 3px rgba(0, 0, 0, .1), 0 1px 2px rgba(0, 0, 0, .15);
  --elev-2: 0 2px 8px rgba(0, 0, 0, .1), 0 1px 2px rgba(0, 0, 0, .12);
  --elev-3: 0 4px 16px rgba(0, 0, 0, .12);
  --ease: cubic-bezier(.2, 0, 0, 1);
}

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

html {
  font-size: 16px;
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--surface);
  color: var(--on-surface);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
}

img {
  max-width: 100%;
  display: block;
}

/* ── Layout ─── */
.mgmt-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface-cont);
  border-right: 1px solid var(--outline-var);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 300;
  transition: transform .3s var(--ease), width .3s var(--ease);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar.collapsed {
  width: 72px;
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.mobile-open {
    transform: none;
  }
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .4);
  z-index: 299;
}

@media (max-width: 900px) {
  .sidebar.mobile-open~.sidebar-overlay {
    display: block;
  }
}

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--outline-var);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--r-m);
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
}

.sidebar-brand {
  overflow: hidden;
  transition: opacity .2s, width .2s;
}

.sidebar-brand .brand-name {
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
}

.sidebar-brand .brand-sub {
  font-size: 11px;
  color: var(--on-surface-var);
  white-space: nowrap;
}

.sidebar.collapsed .sidebar-brand {
  opacity: 0;
  width: 0;
}

.sidebar-nav {
  padding: 12px 0;
  flex: 1;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--on-surface-var);
  padding: 12px 20px 6px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity .2s;
}

.sidebar.collapsed .nav-section-label {
  opacity: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  margin: 2px 8px;
  border-radius: var(--r-m);
  font-size: 14px;
  font-weight: 600;
  color: var(--on-surface-var);
  white-space: nowrap;
  transition: all .2s var(--ease);
  position: relative;
  overflow: hidden;
}

.nav-item:hover {
  background: var(--surface-variant);
  color: var(--on-surface);
}

.nav-item.active {
  background: rgba(0, 106, 106, .1);
  color: var(--primary);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 25%;
  bottom: 25%;
  width: 3px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}

.nav-item i {
  font-size: 20px;
  flex-shrink: 0;
}

.nav-item-label {
  overflow: hidden;
  transition: opacity .2s, width .2s;
}

.sidebar.collapsed .nav-item-label {
  opacity: 0;
  width: 0;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--outline-var);
  flex-shrink: 0;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--r-m);
  background: var(--surface);
  cursor: pointer;
  transition: background .2s;
}

.user-card:hover {
  background: var(--surface-variant);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
}

.user-info {
  overflow: hidden;
}

.user-name {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: var(--on-surface-var);
  text-transform: capitalize;
}

/* ── Main Content ── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left .3s var(--ease);
}

.main-content.sidebar-collapsed {
  margin-left: 72px;
}

@media (max-width: 900px) {
  .main-content {
    margin-left: 0;
  }
}

/* Top Bar */
.top-bar {
  height: var(--header-h);
  background: var(--surface-cont);
  border-bottom: 1px solid var(--outline-var);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hamburger {
  width: 40px;
  height: 40px;
  border-radius: var(--r-m);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  transition: background .2s;
  font-size: 22px;
  color: var(--on-surface-var);
}

.hamburger:hover {
  background: var(--surface-variant);
}

.page-heading {
  font-size: 18px;
  font-weight: 700;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── Page Content ── */
.page-content {
  padding: 24px;
  flex: 1;
}

/* ── Stat Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface-cont);
  border-radius: var(--r-l);
  padding: 20px;
  box-shadow: var(--elev-1);
  position: relative;
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--elev-2);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  border-radius: 0 0 0 80px;
  opacity: .08;
}

.stat-card.teal::before {
  background: var(--primary);
}

.stat-card.orange::before {
  background: var(--warning);
}

.stat-card.green::before {
  background: var(--success);
}

.stat-card.blue::before {
  background: #1565c0;
}

.stat-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.stat-card.teal .stat-icon {
  color: var(--primary);
}

.stat-card.orange .stat-icon {
  color: var(--warning);
}

.stat-card.green .stat-icon {
  color: var(--success);
}

.stat-card.blue .stat-icon {
  color: #1565c0;
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 13px;
  color: var(--on-surface-var);
  font-weight: 500;
}

/* ── Data Table ── */
.table-card {
  background: var(--surface-cont);
  border-radius: var(--r-l);
  box-shadow: var(--elev-1);
  overflow: hidden;
}

.table-toolbar {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--outline-var);
}

.table-title {
  font-size: 16px;
  font-weight: 700;
}

.table-toolbar-right {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.mgmt-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1.5px solid var(--outline-var);
  border-radius: var(--r-f);
  padding: 0 12px;
  height: 38px;
}

.mgmt-search input {
  border: none;
  background: none;
  outline: none;
  font-family: inherit;
  font-size: 14px;
  width: 180px;
}

.mgmt-search i {
  color: var(--on-surface-var);
}

table.mgmt-table {
  width: 100%;
  border-collapse: collapse;
}

table.mgmt-table th {
  background: var(--surface);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--on-surface-var);
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--outline-var);
  white-space: nowrap;
}

table.mgmt-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--outline-var);
  font-size: 14px;
  vertical-align: middle;
}

table.mgmt-table tr:last-child td {
  border-bottom: none;
}

table.mgmt-table tbody tr:hover {
  background: var(--surface);
}

.table-scroll {
  overflow-x: auto;
}

/* ── Badges ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--r-f);
  font-size: 12px;
  font-weight: 700;
}

.badge-green {
  background: var(--success-light);
  color: var(--success);
}

.badge-orange {
  background: var(--warning-light);
  color: var(--warning);
}

.badge-red {
  background: var(--error-light);
  color: var(--error);
}

.badge-teal {
  background: rgba(0, 106, 106, .1);
  color: var(--primary);
}

.badge-grey {
  background: var(--surface-variant);
  color: var(--on-surface-var);
}

.badge-blue {
  background: #e3f2fd;
  color: #1565c0;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  height: 38px;
  border-radius: var(--r-m);
  font-size: 14px;
  font-weight: 600;
  transition: all .2s;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--surface-variant);
  color: var(--on-surface);
}

.btn-secondary:hover {
  background: var(--outline-var);
}

.btn-danger {
  background: var(--error-light);
  color: var(--error);
}

.btn-danger:hover {
  background: var(--error);
  color: white;
}

.btn-success {
  background: var(--success-light);
  color: var(--success);
}

.btn-success:hover {
  background: var(--success);
  color: white;
}

.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--outline-var);
  color: var(--on-surface-var);
}

.btn-ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--r-m);
  justify-content: center;
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

/* ── Form Elements ── */
.form-card {
  background: var(--surface-cont);
  border-radius: var(--r-l);
  box-shadow: var(--elev-1);
  padding: 24px;
  margin-bottom: 20px;
}

.form-card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--outline-var);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 700px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full {
  grid-column: 1/-1;
}

.form-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
}

.form-control {
  padding: 10px 14px;
  border: 1.5px solid var(--outline-var);
  border-radius: var(--r-s);
  font-family: inherit;
  font-size: 14px;
  background: var(--surface);
  transition: border-color .2s;
  width: 100%;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 106, 106, .12);
}

.form-control.error {
  border-color: var(--error);
}

.form-hint {
  font-size: 11px;
  color: var(--on-surface-var);
}

/* ── Image Upload Area ─── */
.upload-area {
  border: 2px dashed var(--outline-var);
  border-radius: var(--r-l);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--surface);
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: var(--primary);
  background: rgba(0, 106, 106, .04);
}

.upload-area i {
  font-size: 40px;
  color: var(--outline);
  margin-bottom: 8px;
}

.upload-previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.upload-preview-item {
  position: relative;
  border-radius: var(--r-m);
  overflow: hidden;
  aspect-ratio: 4/3;
  background: var(--surface-variant);
}

.upload-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-actions {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 4px;
}

.preview-action-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .6);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  border: none;
}

.preview-main-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--r-f);
}

/* ── OTP Confirm Panel ─── */
.otp-confirm-box {
  background: var(--surface-cont);
  border: 2px solid var(--primary);
  border-radius: var(--r-l);
  padding: 24px;
  text-align: center;
  margin-bottom: 20px;
}

.otp-input-group {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 16px 0;
}

.otp-single {
  width: 52px;
  height: 60px;
  text-align: center;
  font-size: 28px;
  font-weight: 800;
  border: 2px solid var(--outline-var);
  border-radius: var(--r-m);
  font-family: inherit;
  transition: border-color .2s;
}

.otp-single:focus {
  outline: none;
  border-color: var(--primary);
}

/* ── Map Picker ── */
.map-container {
  width: 100%;
  height: 300px;
  border-radius: var(--r-l);
  overflow: hidden;
  border: 1.5px solid var(--outline-var);
}

.map-coords {
  font-size: 12px;
  color: var(--on-surface-var);
  margin-top: 6px;
  font-family: monospace;
}

/* ── Pagination ── */
.pagination {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 20px 0;
}

.page-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--r-m);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--outline-var);
  background: var(--surface-cont);
  color: var(--on-surface-var);
  transition: all .2s;
}

.page-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* ── Modal ── */
.mgmt-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  padding: 16px;
}

.mgmt-modal-overlay.open {
  display: flex;
}

.mgmt-modal {
  background: white;
  width: 100%;
  max-width: 560px;
  border-radius: var(--r-xl);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  overflow: hidden;
  animation: slideUp .3s var(--ease);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

@keyframes slideUp {
  from {
    transform: translateY(24px);
    opacity: 0;
  }

  to {
    transform: none;
    opacity: 1;
  }
}

.mgmt-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--outline-var);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.mgmt-modal-title {
  font-size: 17px;
  font-weight: 700;
}

.mgmt-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.mgmt-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--outline-var);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* ── Empty Table ── */
.table-empty {
  text-align: center;
  padding: 48px;
  color: var(--on-surface-var);
}

.table-empty i {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
}

/* ── Util ─── */
.spin {
  animation: spin 1s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.text-muted {
  color: var(--on-surface-var);
}

.text-primary {
  color: var(--primary);
}

.text-error {
  color: var(--error);
}

.text-success {
  color: var(--success);
}

.mt-4 {
  margin-top: 4px;
}

.mt-12 {
  margin-top: 12px;
}

.mt-20 {
  margin-top: 20px;
}

.gap-8 {
  gap: 8px;
}

.d-flex {
  display: flex;
  align-items: center;
}

.d-none {
  display: none !important;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .page-content {
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  table.mgmt-table th,
  table.mgmt-table td {
    padding: 10px 12px;
  }
}