/* ============================================================
   HK Properties Zm - Admin Panel Stylesheet (Redesigned)
   Matches the violet/purple theme of the public site
   ============================================================ */

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

:root {
  --primary:       #7c3aed;
  --primary-dark:  #5b21b6;
  --primary-light: #a78bfa;
  --primary-pale:  #f5f3ff;
  --accent:        #06b6d4;
  --white:         #ffffff;
  --off-white:     #f8fafc;
  --light-gray:    #f1f5f9;
  --border:        #e2e8f0;
  --mid-gray:      #cbd5e1;
  --dark-gray:     #475569;
  --text:          #0f172a;
  --text-light:    #64748b;
  --success:       #10b981;
  --danger:        #ef4444;
  --warning:       #f59e0b;

  --sidebar-width: 256px;
  --header-height: 64px;

  --grad-primary: linear-gradient(135deg, #7c3aed 0%, #a78bfa 100%);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(124,58,237,0.10);
  --shadow-lg: 0 12px 40px rgba(124,58,237,0.15);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 50px;

  --font:    'Inter', sans-serif;
  --font-h:  'Poppins', sans-serif;
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============================================================
   BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--light-gray);
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ============================================================
   ADMIN LAYOUT
   ============================================================ */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.admin-sidebar {
  width: var(--sidebar-width);
  background: var(--text); /* Deep slate - premium dark sidebar */
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 100;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-brand img {
  height: 40px;
  width: auto;
  border-radius: 8px;
  flex-shrink: 0;
}
.sidebar-brand-text .name {
  font-family: var(--font-h);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--white);
  line-height: 1;
}
.sidebar-brand-text .sub {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 3px;
}

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-section-label {
  font-size: 0.62rem;
  font-weight: 700;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 14px 10px 6px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  color: rgba(255,255,255,0.65);
  transition: var(--transition);
  position: relative;
}
.sidebar-link:hover {
  background: rgba(124,58,237,0.2);
  color: var(--white);
}
.sidebar-link.active {
  background: var(--grad-primary);
  color: var(--white);
  box-shadow: 0 4px 16px rgba(124,58,237,0.3);
}
.nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: var(--white);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  min-width: 20px;
  text-align: center;
}
.sidebar-link.active .nav-badge {
  background: rgba(255,255,255,0.25);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar-sm {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--grad-primary);
  color: var(--white);
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.user-name { font-size: 0.88rem; font-weight: 600; color: var(--white); }
.user-role { font-size: 0.7rem; color: rgba(255,255,255,0.45); text-transform: capitalize; }

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.admin-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top Header Bar */
.admin-topbar {
  height: var(--header-height);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-sm);
}
.topbar-title {
  font-family: var(--font-h);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.topbar-user .user-avatar-sm {
  width: 36px; height: 36px;
}
.topbar-user-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

/* Content */
.admin-content {
  padding: 28px;
  flex: 1;
}

/* ============================================================
   BUTTONS (Admin)
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-xl);
  font-size: 0.875rem;
  font-weight: 600;
  transition: var(--transition);
  cursor: pointer;
  border: none;
  white-space: nowrap;
  font-family: var(--font-h);
}
.btn-primary {
  background: var(--grad-primary);
  color: var(--white);
  box-shadow: 0 4px 14px rgba(124,58,237,0.3);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(124,58,237,0.4);
  filter: brightness(1.05);
}
.btn-secondary {
  background: var(--light-gray);
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover {
  background: var(--border);
}
.btn-danger {
  background: #fee2e2;
  color: var(--danger);
  border: 1.5px solid #fecaca;
}
.btn-danger:hover {
  background: var(--danger);
  color: var(--white);
  border-color: var(--danger);
}
.btn-success {
  background: #d1fae5;
  color: #065f46;
  border: 1.5px solid #a7f3d0;
}
.btn-success:hover {
  background: var(--success);
  color: var(--white);
}
.btn-sm { padding: 7px 14px; font-size: 0.8rem; }
.btn-lg { padding: 13px 28px; font-size: 1rem; }
.btn-icon {
  padding: 8px;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  justify-content: center;
  flex-shrink: 0;
}

/* ============================================================
   CARDS
   ============================================================ */
.admin-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.admin-card-title {
  font-family: var(--font-h);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Stat Cards (Dashboard) */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: var(--transition);
}
.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: rgba(124,58,237,0.2);
}
.stat-card-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-card-icon.violet { background: linear-gradient(135deg, #7c3aed, #a78bfa); color: white; }
.stat-card-icon.cyan   { background: linear-gradient(135deg, #06b6d4, #0891b2); color: white; }
.stat-card-icon.green  { background: linear-gradient(135deg, #10b981, #059669); color: white; }
.stat-card-icon.pink   { background: linear-gradient(135deg, #ec4899, #db2777); color: white; }

.stat-card-num {
  font-family: var(--font-h);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.stat-card-label {
  font-size: 0.78rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* ============================================================
   TABLES
   ============================================================ */
.admin-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.admin-table th {
  background: var(--light-gray);
  color: var(--text-light);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.admin-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: var(--primary-pale); }

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 30px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.status-badge.for-sale  { background: #ede9fe; color: #7c3aed; }
.status-badge.for-rent  { background: #ecfeff; color: #0891b2; }
.status-badge.sold      { background: #d1fae5; color: #065f46; }
.status-badge.rented    { background: #fef3c7; color: #92400e; }
.status-badge.featured  { background: linear-gradient(135deg,#7c3aed,#a78bfa); color: white; }
.status-badge.unread    { background: #fee2e2; color: #991b1b; }
.status-badge.read      { background: #f1f5f9; color: #64748b; }

/* ============================================================
   FORMS (Admin)
   ============================================================ */
.form-section {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 28px;
  border: 1px solid var(--border);
  margin-bottom: 24px;
}
.form-section-title {
  font-family: var(--font-h);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.form-section-title svg { color: var(--primary); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-full { grid-column: 1 / -1; }
.form-group { margin-bottom: 0; }
.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-label.required::after {
  content: ' *';
  color: var(--danger);
}
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--off-white);
  transition: var(--transition);
  outline: none;
  font-family: var(--font);
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.08);
}
.form-textarea { resize: vertical; min-height: 120px; }
.form-hint { font-size: 0.76rem; color: var(--text-light); margin-top: 5px; }
.form-error { font-size: 0.76rem; color: var(--danger); margin-top: 5px; }
.form-checkbox-group { display: flex; align-items: center; gap: 8px; }
.form-checkbox-group input[type="checkbox"] { accent-color: var(--primary); width: 16px; height: 16px; }
.form-checkbox-group label { font-size: 0.88rem; font-weight: 500; color: var(--text); }

/* Image upload area */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--off-white);
}
.upload-area:hover, .upload-area.dragover {
  border-color: var(--primary);
  background: var(--primary-pale);
}
.upload-area input[type="file"] { display: none; }
.upload-icon { color: var(--primary); margin: 0 auto 12px; opacity: 0.7; }
.upload-title { font-weight: 600; color: var(--text); margin-bottom: 4px; }
.upload-hint { font-size: 0.82rem; color: var(--text-light); }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 20px;
}
.alert-success { background: #d1fae5; color: #065f46; border-left: 4px solid var(--success); }
.alert-danger  { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--danger); }
.alert-warning { background: #fef3c7; color: #92400e; border-left: 4px solid var(--warning); }
.alert-info    { background: #e0f2fe; color: #0c4a6e; border-left: 4px solid var(--accent); }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}
.page-header-left h1 {
  font-family: var(--font-h);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}
.page-header-left p {
  font-size: 0.88rem;
  color: var(--text-light);
  margin-top: 4px;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: 8px;
}
.breadcrumb a:hover { color: var(--primary); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.admin-login-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.admin-login-wrapper::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  top: -200px; right: -150px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124,58,237,0.25) 0%, transparent 70%);
}
.admin-login-wrapper::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  bottom: -100px; left: -100px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(6,182,212,0.2) 0%, transparent 70%);
}
.login-card {
  background: var(--white);
  border-radius: 24px;
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.35);
  position: relative;
  z-index: 1;
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo img {
  height: 60px;
  margin: 0 auto 14px;
  border-radius: 10px;
}
.login-title {
  font-family: var(--font-h);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
}
.login-sub {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 4px;
}
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-control {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--off-white);
  transition: var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--primary);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.1);
}

/* ============================================================
   INQUIRY CARD
   ============================================================ */
.inquiry-card {
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  padding: 20px 24px;
  margin-bottom: 16px;
  transition: var(--transition);
}
.inquiry-card.unread {
  border-left: 4px solid var(--primary);
  background: var(--primary-pale);
}
.inquiry-card:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(124,58,237,0.3);
}
.inquiry-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.inquiry-name { font-weight: 700; color: var(--text); font-size: 0.95rem; }
.inquiry-time { font-size: 0.78rem; color: var(--text-light); }
.inquiry-contact { display: flex; gap: 16px; font-size: 0.85rem; color: var(--text-light); margin-bottom: 12px; flex-wrap: wrap; }
.inquiry-contact a { color: var(--primary); font-weight: 500; }
.inquiry-message { font-size: 0.88rem; color: var(--dark-gray); line-height: 1.6; background: var(--light-gray); padding: 12px 16px; border-radius: var(--radius-sm); }
.inquiry-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

/* ============================================================
   MISCELLANEOUS UTILITIES
   ============================================================ */
.table-thumb {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}
.table-thumb-placeholder {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  background: var(--primary-pale);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}
.prop-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.3;
}
.prop-location {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 2px;
}
.table-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.action-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  color: var(--text-light);
}
.action-btn:hover, .action-btn.edit:hover {
  background: var(--primary-pale);
  color: var(--primary);
}
.action-btn.delete:hover {
  background: #fee2e2;
  color: var(--danger);
}
.topbar-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  position: relative;
  transition: var(--transition);
  background: var(--light-gray);
}
.topbar-btn:hover {
  background: var(--primary-pale);
  color: var(--primary);
}
.notification-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--white);
}
/* primary-pale variable for admin (matches public CSS) */
:root { --primary-pale: #f5f3ff; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .admin-sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .form-grid-3 { grid-template-columns: 1fr; }
  .login-card { padding: 32px 24px; }
}
@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
  .admin-content { padding: 16px; }
}
