/* ==========================================
   ADMIN PANEL STYLESHEET
   ========================================== */

/* Overlay & Backdrop */
.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 6, 0.85);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.admin-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Main Container */
.admin-modal {
  background: #181512;
  color: #f5f4f2;
  width: 100%;
  max-width: 960px;
  max-height: 90vh;
  border-radius: 12px;
  border: 1px solid rgba(184, 156, 110, 0.25);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  font-family: var(--font-sans, 'Jost', sans-serif);
}

/* Header Bar */
.admin-header {
  padding: 20px 28px;
  background: #110e0c;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-serif, 'Playfair Display', serif);
  font-size: 20px;
  font-weight: 600;
  color: #fff;
}

.admin-title span.badge-gold {
  background: var(--gold, #b89c6e);
  color: #fff;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  font-family: var(--font-sans, sans-serif);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.admin-close-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.2s;
  line-height: 1;
}

.admin-close-btn:hover {
  color: #fff;
}

/* Body Content */
.admin-body {
  padding: 28px;
  overflow-y: auto;
  flex: 1;
}

/* Login Screen */
.admin-login-wrap {
  max-width: 400px;
  margin: 40px auto;
  background: #201c18;
  padding: 36px;
  border-radius: 10px;
  border: 1px solid rgba(184, 156, 110, 0.2);
}

.admin-login-title {
  font-family: var(--font-serif, serif);
  font-size: 24px;
  margin-bottom: 8px;
  text-align: center;
  color: #fff;
}

.admin-login-sub {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
  margin-bottom: 24px;
}

.admin-form-group {
  margin-bottom: 20px;
}

.admin-form-group label {
  display: block;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--gold-light, #d4bd96);
  margin-bottom: 8px;
  font-weight: 500;
}

.admin-input,
.admin-textarea,
.admin-select {
  width: 100%;
  padding: 12px 14px;
  background: #14110f;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.admin-input:focus,
.admin-textarea:focus,
.admin-select:focus {
  border-color: var(--gold, #b89c6e);
  box-shadow: 0 0 0 3px rgba(184, 156, 110, 0.2);
}

.admin-login-error {
  color: #ff6b6b;
  font-size: 13px;
  margin-top: 12px;
  text-align: center;
  display: none;
}

/* Tabs Navigation */
.admin-tabs {
  display: flex;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 24px;
}

.admin-tab-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.admin-tab-btn:hover {
  color: #fff;
}

.admin-tab-btn.active {
  color: var(--gold-light, #d4bd96);
  border-bottom-color: var(--gold, #b89c6e);
}

/* Tab Panels */
.admin-tab-panel {
  display: none;
}

.admin-tab-panel.active {
  display: block;
}

/* Action Bar */
.admin-action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 14px;
}

.admin-btn {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.2s, transform 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.admin-btn-gold {
  background: var(--gold, #b89c6e);
  color: #fff;
}

.admin-btn-gold:hover {
  background: #a3875a;
}

.admin-btn-outline {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
}

.admin-btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
}

.admin-btn-danger {
  background: #c53030;
  color: #fff;
}

.admin-btn-danger:hover {
  background: #9b2c2c;
}

/* Data Table */
.admin-table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.admin-table th,
.admin-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: middle;
}

.admin-table th {
  background: #110e0c;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 1px;
}

.admin-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.admin-prop-thumb {
  width: 80px;
  height: 56px;
  object-fit: contain;
  object-position: center;
  border-radius: 4px;
  background: #110e0c;
}

/* Image Upload & Multi-Image Gallery Styles */
.admin-upload-dropzone {
  margin-top: 6px;
  position: relative;
  width: 100%;
  padding: 24px 16px;
  border-radius: 8px;
  border: 2px dashed rgba(184, 156, 110, 0.4);
  background: #110e0c;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.admin-upload-dropzone:hover,
.admin-upload-dropzone.dragover {
  border-color: var(--gold, #b89c6e);
  background: #1a1613;
}

.admin-upload-dropzone .upload-icon {
  font-size: 32px;
  color: var(--gold-light, #d4bd96);
  margin-bottom: 6px;
  line-height: 1;
}

.admin-upload-dropzone .upload-text {
  font-size: 13px;
  color: #f5f4f2;
}

.admin-upload-dropzone .upload-text strong {
  color: var(--gold-light, #d4bd96);
  text-decoration: underline;
}

.admin-upload-dropzone .upload-sub {
  display: block;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 4px;
}

.image-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
  padding: 10px;
  background: #110e0c;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  min-height: 110px;
  align-items: center;
}

.gallery-thumb-item {
  position: relative;
  height: 90px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: #1a1613;
}

.gallery-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #110e0c;
  display: block;
}

.gallery-thumb-item .thumb-primary-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: var(--gold, #b89c6e);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.5px;
  z-index: 2;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.gallery-thumb-item .thumb-actions {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 3;
}

.gallery-thumb-item:hover .thumb-actions {
  opacity: 1;
}

.gallery-thumb-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: background 0.2s, transform 0.1s;
}

.gallery-thumb-btn:hover {
  background: var(--gold, #b89c6e);
  transform: scale(1.1);
}

.gallery-thumb-btn.danger-btn:hover {
  background: #c53030;
}

.image-preview-placeholder {
  grid-column: 1 / -1;
  color: rgba(255, 255, 255, 0.4);
  font-size: 12px;
  text-align: center;
  padding: 20px 0;
}

/* Status Badges */
.status-pill {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  display: inline-block;
}

.status-pill.for-sale {
  background: rgba(56, 161, 105, 0.2);
  color: #68d391;
}

.status-pill.pending {
  background: rgba(221, 107, 32, 0.2);
  color: #fbd38d;
}

.status-pill.sold {
  background: rgba(229, 62, 62, 0.2);
  color: #feb2b2;
}

/* Footer & Status Bar */
.admin-footer-bar {
  padding: 14px 28px;
  background: #110e0c;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}

.supabase-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e53e3e;
}

.status-dot.connected {
  background: #38a169;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .admin-modal {
    max-height: 95vh;
    border-radius: 8px;
  }
  .admin-header, .admin-body {
    padding: 18px;
  }
  .admin-login-wrap {
    padding: 24px;
    margin: 10px auto;
  }
  .admin-tabs {
    overflow-x: auto;
    white-space: nowrap;
  }
}
