/* 
  MorphixIQ Standalone Admin Panel Stylesheet
  ===========================================
  Designed for independent cross-domain deployment (e.g. admin.morphixiq.com).
  Dark cyber glassmorphism design system.
*/

:root {
  --bg-dark: #07090e;
  --bg-card: rgba(15, 23, 42, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --border-color: rgba(255, 255, 255, 0.1);
  --border-glow: rgba(0, 168, 255, 0.4);
  
  --blue-cyan: #00a8ff;
  --cyan-glow: #00e5ff;
  --emerald-green: #10b981;
  --purple-accent: #8b5cf6;
  --pink-accent: #ec4899;
  --amber-orange: #f59e0b;
  --danger-red: #ef4444;
  
  --text-main: #f8fafc;
  --text-slate: #cbd5e1;
  --text-muted: #64748b;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  
  --sidebar-width: 260px;
  --header-height: 70px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-main: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
}

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

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(at 10% 10%, rgba(0, 168, 255, 0.08) 0px, transparent 50%),
    radial-gradient(at 90% 90%, rgba(139, 92, 246, 0.08) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-slate);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

/* Sidebar Styles */
.admin-sidebar {
  width: var(--sidebar-width);
  background: rgba(11, 15, 25, 0.95);
  border-right: 1px solid var(--border-color);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  height: var(--header-height);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-header img {
  height: 34px;
  object-fit: contain;
}

.sidebar-brand-badge {
  background: rgba(0, 168, 255, 0.15);
  border: 1px solid var(--blue-cyan);
  color: var(--blue-cyan);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-menu {
  flex: 1;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.75rem 1rem;
  color: var(--text-slate);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-item i {
  font-size: 1.1rem;
  color: var(--text-muted);
  width: 22px;
  text-align: center;
  transition: color 0.2s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.nav-item:hover i {
  color: var(--blue-cyan);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(0, 168, 255, 0.18), rgba(0, 168, 255, 0.05));
  border-left: 3px solid var(--blue-cyan);
  color: #fff;
}

.nav-item.active i {
  color: var(--blue-cyan);
}

.nav-badge {
  margin-left: auto;
  background: rgba(0, 168, 255, 0.2);
  color: var(--blue-cyan);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
}

.sidebar-footer {
  padding: 1.25rem 1rem;
  border-top: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
}

/* Main Content Area */
.admin-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Header Navbar */
.admin-header {
  height: var(--header-height);
  background: rgba(11, 15, 25, 0.85);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-title h1 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.api-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--emerald-green);
  color: var(--emerald-green);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.api-status-badge.disconnected {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--danger-red);
  color: var(--danger-red);
}

.api-status-badge.testing {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--amber-orange);
  color: var(--amber-orange);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

/* User controls in header */
.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-profile-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.8rem;
  border-radius: 30px;
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
}

.avatar-initial {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-cyan), var(--purple-accent));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
}

/* Page Body Container */
.admin-container {
  padding: 2rem;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* KPI Overview Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  backdrop-filter: blur(12px);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-glow);
}

.kpi-icon {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.kpi-icon.cyan { background: rgba(0, 168, 255, 0.15); color: var(--blue-cyan); border: 1px solid rgba(0, 168, 255, 0.3); }
.kpi-icon.purple { background: rgba(139, 92, 246, 0.15); color: var(--purple-accent); border: 1px solid rgba(139, 92, 246, 0.3); }
.kpi-icon.pink { background: rgba(236, 72, 153, 0.15); color: var(--pink-accent); border: 1px solid rgba(236, 72, 153, 0.3); }
.kpi-icon.emerald { background: rgba(16, 185, 129, 0.15); color: var(--emerald-green); border: 1px solid rgba(16, 185, 129, 0.3); }

.kpi-details .kpi-val {
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}

.kpi-details .kpi-lbl {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  font-weight: 500;
}

/* Glass Panels */
.glass-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-main);
  margin-bottom: 2rem;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.panel-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-title i {
  color: var(--blue-cyan);
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, #00a8ff, #0066ff);
  color: #fff;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(0, 168, 255, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #00c3ff, #0055ff);
  box-shadow: 0 6px 20px rgba(0, 168, 255, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-slate);
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--danger-red);
  color: var(--danger-red);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-danger:hover {
  background: var(--danger-red);
  color: #fff;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-slate);
  margin-bottom: 0.4rem;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--blue-cyan);
  box-shadow: 0 0 0 3px rgba(0, 168, 255, 0.2);
}

.form-select option {
  background: #0f172a;
  color: #fff;
}

/* Inquiries List & Tiles */
.inquiry-tile {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  transition: border-color 0.2s ease;
}

.inquiry-tile:hover {
  border-color: var(--border-glow);
}

.inquiry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.client-initial-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(0, 168, 255, 0.3), rgba(139, 92, 246, 0.3));
  border: 1px solid var(--blue-cyan);
  color: #fff;
  font-weight: 800;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Side Drawer Overlay */
.drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  justify-content: flex-end;
}

.drawer-panel {
  width: 100%;
  max-width: 580px;
  background: #0b0f19;
  border-left: 1px solid var(--border-color);
  height: 100vh;
  padding: 2rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.8);
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

/* Modal Popup */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-content {
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 600px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0,0,0,0.8);
}

/* Log Table */
.log-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.log-table th, .log-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.88rem;
}

.log-table th {
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.log-table tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* Responsive adjustments for Admin Hub */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
}

@media (max-width: 1024px) {
  .admin-sidebar {
    transform: translateX(-100%);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.8);
  }
  .admin-sidebar.mobile-open {
    transform: translateX(0);
  }
  .admin-main {
    margin-left: 0;
  }
  .admin-header {
    left: 0;
    padding: 1rem 1.25rem;
  }
  .admin-content {
    padding: 1.5rem 1.25rem;
  }
}

@media (max-width: 640px) {
  .admin-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    height: auto;
    padding: 1rem;
  }
  .header-actions {
    width: 100%;
    justify-content: space-between;
  }
  .admin-stats-grid,
  .admin-inquiries-grid {
    grid-template-columns: 1fr !important;
  }
  .drawer-panel {
    max-width: 100vw;
    padding: 1.25rem;
  }
  .modal-content {
    padding: 1.25rem;
    width: 95vw;
  }
}
