/* ==========================================================================
   TORUS INVESTMENTS UGANDA LIMITED - ADMIN CONTROL STYLESHEET
   Soft Luxury & Classic Architectural Dashboard
   ========================================================================== */

:root {
  --admin-bg: #0d1419;
  --admin-surface: #121c23;
  --admin-surface-hover: #16222b;
  --admin-card: rgba(18, 28, 35, 0.95);
  --admin-border: rgba(255, 255, 255, 0.08);
  --admin-border-focus: #006766;
  
  --admin-teal: #006766;
  --admin-teal-light: #008785;
  --admin-teal-dark: #004d4c;
  
  --admin-brick: #b5542a;
  --admin-brick-hover: #c66236;
  --admin-brick-dark: #99431f;

  --admin-gold: #c5a059;
  --admin-gold-light: #e6ca85;
  
  --admin-text-primary: #f8fafc;
  --admin-text-secondary: #94a3b8;
  --admin-text-muted: #64748b;
  
  --admin-success: #10b981;
  --admin-warning: #f59e0b;
  --admin-danger: #ef4444;

  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

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

body {
  background-color: var(--admin-bg);
  color: var(--admin-text-primary);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  overflow-x: hidden;
}

/* -------------------------------------------------------------
   NAVIGATION HEADER
   ------------------------------------------------------------- */
.admin-navbar {
  background: rgba(13, 20, 25, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--admin-border);
  padding: 0.85rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
}

.admin-brand img {
  height: 38px;
  width: auto;
}

.admin-brand-info h1 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-brand-badge {
  font-size: 0.65rem;
  background: rgba(0, 103, 102, 0.35);
  color: #33aca9;
  border: 1px solid rgba(0, 103, 102, 0.5);
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.admin-nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Server Status Badge */
.server-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--admin-border);
  transition: all 0.2s;
}

.server-status-pill .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--admin-muted);
}

.server-status-pill.online {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: #34d399;
}
.server-status-pill.online .status-dot {
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.8);
}

.server-status-pill.standalone {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}
.server-status-pill.standalone .status-dot {
  background: #f59e0b;
}

/* -------------------------------------------------------------
   BUTTONS & CONTROLS
   ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.15rem;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font-body);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  line-height: 1.2;
}

.btn-primary {
  background: var(--admin-brick);
  color: #ffffff;
  border-color: var(--admin-brick);
}
.btn-primary:hover {
  background: var(--admin-brick-hover);
  border-color: var(--admin-brick-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(181, 84, 42, 0.35);
}

.btn-teal {
  background: var(--admin-teal);
  color: #ffffff;
  border-color: var(--admin-teal);
}
.btn-teal:hover {
  background: var(--admin-teal-light);
  border-color: var(--admin-teal-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 103, 102, 0.35);
}

.btn-outline {
  background: transparent;
  color: var(--admin-text-primary);
  border-color: var(--admin-border);
}
.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}
.btn-danger:hover {
  background: var(--admin-danger);
  color: #ffffff;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* -------------------------------------------------------------
   LAYOUT & CONTAINER
   ------------------------------------------------------------- */
.admin-main {
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 2rem 4rem;
  flex: 1;
}

/* -------------------------------------------------------------
   STATS ROW
   ------------------------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  transition: transform 0.2s, border-color 0.2s;
}
.stat-card:hover {
  border-color: rgba(0, 103, 102, 0.4);
  transform: translateY(-2px);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: rgba(0, 103, 102, 0.15);
  color: #33aca9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}

.stat-icon.brick {
  background: rgba(181, 84, 42, 0.15);
  color: #e27d53;
}
.stat-icon.gold {
  background: rgba(197, 160, 89, 0.15);
  color: var(--admin-gold);
}
.stat-icon.green {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.stat-info .stat-value {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.1;
}
.stat-info .stat-label {
  font-size: 0.8rem;
  color: var(--admin-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

/* -------------------------------------------------------------
   ACTION BAR & FILTERING
   ------------------------------------------------------------- */
.actions-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 280px;
  max-width: 420px;
}

/* SVG Icon Normalization & Guaranteed Visibility */
svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}
.btn svg {
  margin-right: 0.35rem;
}
.btn-icon svg {
  margin: 0 !important;
}
.stat-icon svg {
  width: 24px;
  height: 24px;
}
.form-section-title svg {
  margin-right: 0.4rem;
  color: var(--admin-gold-light);
}

.search-box i,
.search-box svg {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--admin-text-muted);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  color: #ffffff;
  padding: 0.65rem 1rem 0.65rem 2.6rem;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s;
}
.search-box input:focus {
  border-color: var(--admin-teal);
  box-shadow: 0 0 0 2px rgba(0, 103, 102, 0.2);
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.filter-pill {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  color: var(--admin-text-secondary);
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.filter-pill:hover {
  background: var(--admin-surface-hover);
  color: #ffffff;
}
.filter-pill.active {
  background: var(--admin-teal);
  border-color: var(--admin-teal);
  color: #ffffff;
}

/* -------------------------------------------------------------
   PROJECTS TABLE & CARDS
   ------------------------------------------------------------- */
.projects-container {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

.table-header-bar {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
}

.table-header-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.projects-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.projects-table th {
  padding: 0.85rem 1.25rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--admin-text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--admin-border);
  background: rgba(255, 255, 255, 0.01);
}

.projects-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.875rem;
  vertical-align: middle;
}

.projects-table tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

.project-thumb-cell {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.project-thumb {
  width: 64px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: #000;
  border: 1px solid var(--admin-border);
  flex-shrink: 0;
}

.project-title-text {
  font-weight: 600;
  color: #ffffff;
  font-size: 0.95rem;
  line-height: 1.3;
}

.project-slug-text {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--admin-text-muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-residential { background: rgba(0, 103, 102, 0.2); color: #33aca9; border: 1px solid rgba(0, 103, 102, 0.4); }
.badge-commercial { background: rgba(181, 84, 42, 0.2); color: #e27d53; border: 1px solid rgba(181, 84, 42, 0.4); }
.badge-apartments { background: rgba(59, 130, 246, 0.2); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.4); }
.badge-civil { background: rgba(168, 85, 247, 0.2); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.4); }
.badge-interior { background: rgba(236, 72, 153, 0.2); color: #f472b6; border: 1px solid rgba(236, 72, 153, 0.4); }

.badge-completed { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-ongoing { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.badge-flagship { background: rgba(197, 160, 89, 0.2); color: var(--admin-gold-light); border: 1px solid rgba(197, 160, 89, 0.4); }

.table-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* -------------------------------------------------------------
   MODAL DIALOG (EDITOR & PREVIEWS)
   ------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

.modal-box {
  background: #0d1419;
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  transform: scale(0.96);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-box {
  transform: scale(1);
}

.modal-header {
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--admin-surface);
}

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--admin-text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: color 0.2s;
}
.modal-close-btn:hover {
  color: #ffffff;
}

.modal-body {
  padding: 2rem;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.modal-footer {
  padding: 1rem 2rem;
  border-top: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--admin-surface);
}

/* -------------------------------------------------------------
   FORM CONTROLS & SECTIONS
   ------------------------------------------------------------- */
.form-section-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--admin-gold-light);
  border-bottom: 1px solid var(--admin-border);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--admin-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-control {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-md);
  color: #ffffff;
  padding: 0.65rem 0.95rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s;
}
.form-control:focus {
  border-color: var(--admin-teal);
  box-shadow: 0 0 0 2px rgba(0, 103, 102, 0.25);
}

textarea.form-control {
  min-height: 90px;
  resize: vertical;
}

.form-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.9rem;
  color: #ffffff;
  padding: 0.65rem 0;
}

.form-checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--admin-brick);
  cursor: pointer;
}

/* -------------------------------------------------------------
   IMAGE UPLOAD & GALLERY MANAGER
   ------------------------------------------------------------- */
.dropzone-box {
  border: 2px dashed var(--admin-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.015);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.dropzone-box:hover, .dropzone-box.dragover {
  border-color: var(--admin-teal);
  background: rgba(0, 103, 102, 0.08);
}
.dropzone-box i {
  font-size: 2rem;
  color: var(--admin-teal-light);
}
.dropzone-box p {
  font-size: 0.85rem;
  color: var(--admin-text-secondary);
}

.cover-preview-wrap {
  position: relative;
  width: 100%;
  height: 200px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--admin-border);
  background: #000;
  margin-top: 0.75rem;
}
.cover-preview-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cover-preview-wrap .remove-img-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.75);
  color: #f87171;
  border: 1px solid rgba(255, 255, 255, 0.2);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}
.cover-preview-wrap .remove-img-btn:hover {
  background: var(--admin-danger);
  color: #fff;
}

/* Gallery Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.gallery-card {
  position: relative;
  height: 100px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--admin-border);
  background: #000;
  group: hover;
}

.gallery-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-card-actions {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  opacity: 0;
  transition: opacity 0.2s;
}
.gallery-card:hover .gallery-card-actions {
  opacity: 1;
}

.gallery-card-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #ffffff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.75rem;
  transition: background 0.2s;
}
.gallery-card-btn:hover {
  background: var(--admin-brick);
}
.gallery-card-btn.delete:hover {
  background: var(--admin-danger);
}

/* -------------------------------------------------------------
   DYNAMIC LISTS: SCOPE & SPECS
   ------------------------------------------------------------- */
.dynamic-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.dynamic-row .form-control {
  flex: 1;
}

/* -------------------------------------------------------------
   AUTH / LOGIN MODAL
   ------------------------------------------------------------- */
.auth-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  width: 100%;
  max-width: 440px;
  margin: auto;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
  text-align: center;
}

.auth-card .auth-logo {
  height: 52px;
  margin-bottom: 1.25rem;
}

.auth-card h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  color: #ffffff;
  margin-bottom: 0.5rem;
}

.auth-card p {
  color: var(--admin-text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.75rem;
}

/* -------------------------------------------------------------
   TOAST NOTIFICATION SYSTEM
   ------------------------------------------------------------- */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 9999;
}

.toast {
  background: #16222b;
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  color: #ffffff;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 380px;
}
.toast.success { border-color: rgba(16, 185, 129, 0.4); border-left: 4px solid var(--admin-success); }
.toast.error { border-color: rgba(239, 68, 68, 0.4); border-left: 4px solid var(--admin-danger); }
.toast.info { border-color: rgba(0, 103, 102, 0.4); border-left: 4px solid var(--admin-teal); }

@keyframes toastSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* -------------------------------------------------------------
   RESPONSIVE DESIGN
   ------------------------------------------------------------- */
@media (max-width: 768px) {
  .admin-navbar { padding: 0.75rem 1rem; }
  .admin-main { padding: 1.25rem 1rem 3rem; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .projects-table th:nth-child(4),
  .projects-table td:nth-child(4),
  .projects-table th:nth-child(5),
  .projects-table td:nth-child(5) {
    display: none;
  }
}
