/* 
 * KB Group - Admin Control Panel Stylesheet
 * Dark Emerald Theme accents, structured layout, form components
 */

:root {
  --admin-sidebar-w: 260px;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
}

/* Layout Core */
.admin-layout {
  display: flex;
  min-height: 100vh;
  background-color: #f3f4f6;
  font-family: 'Inter', sans-serif;
  color: #1f2937;
}

/* Sidebar Styling */
.admin-sidebar {
  width: var(--admin-sidebar-w);
  background-color: #064e3b;
  color: #ffffff;
  padding: 30px 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
  z-index: 10;
  border-right: 2px solid #d4af37;
}

.admin-sidebar-header {
  padding: 0 24px 30px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 20px;
}

.admin-logo {
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-logo span {
  color: #d4af37;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 12px;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 600;
  font-size: 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.admin-nav-item:hover, .admin-nav-item.active {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.08);
}

.admin-nav-item.active {
  background-color: #d4af37;
  color: #064e3b;
}

.admin-nav-item svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2px;
}

.admin-sidebar-footer {
  margin-top: auto;
  padding: 20px 24px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}

/* Main Content Area */
.admin-main {
  margin-left: var(--admin-sidebar-w);
  flex-grow: 1;
  padding: 40px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  border-bottom: 1px solid rgba(6, 78, 59, 0.1);
  padding-bottom: 20px;
}

.admin-title h1 {
  font-size: 28px;
  font-family: 'Outfit', sans-serif;
  color: #064e3b;
}

.admin-title p {
  color: #6b7280;
  font-size: 14px;
  margin-top: 4px;
}

.admin-quick-actions {
  display: flex;
  gap: 12px;
}

/* View Sections */
.admin-view {
  display: none;
  animation: fadeIn 0.3s ease;
}

.admin-view.active {
  display: block;
}

/* Dashboard Overview Widgets */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-bottom: 40px;
}

.widget-card {
  background-color: #ffffff;
  border-radius: 12px;
  padding: 24px;
  border: 1px solid rgba(6, 78, 59, 0.08);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.01);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.widget-info h3 {
  font-size: 14px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.widget-val {
  font-size: 28px;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  color: #064e3b;
}

.widget-icon {
  width: 50px;
  height: 50px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.widget-icon.green { background-color: rgba(6, 78, 59, 0.1); color: #064e3b; }
.widget-icon.gold { background-color: rgba(212, 175, 55, 0.15); color: #d4af37; }
.widget-icon.blue { background-color: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.widget-icon.red { background-color: rgba(239, 68, 68, 0.1); color: #ef4444; }

.widget-icon svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2px;
}

/* Content Panels */
.panel {
  background-color: #ffffff;
  border-radius: 12px;
  border: 1px solid rgba(6, 78, 59, 0.08);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.01);
  padding: 30px;
  margin-bottom: 30px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  border-bottom: 1px solid #f3f4f6;
  padding-bottom: 16px;
}

.panel-title h2 {
  font-size: 18px;
  color: #064e3b;
}

/* Data Tables */
.admin-table-container {
  overflow-x: auto;
}

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

.admin-table th, .admin-table td {
  padding: 14px 20px;
  border-bottom: 1px solid #f3f4f6;
  font-size: 14px;
}

.admin-table th {
  background-color: #f9fafb;
  font-weight: 700;
  color: #064e3b;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.5px;
}

.admin-table tr:hover td {
  background-color: #f9fafb;
}

.admin-table img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-green { background-color: rgba(16, 185, 129, 0.1); color: #10b981; }
.badge-gold { background-color: rgba(212, 175, 55, 0.15); color: #b48a1a; }
.badge-blue { background-color: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.badge-gray { background-color: #e5e7eb; color: #4b5563; }

.actions-cell {
  display: flex;
  gap: 8px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover {
  background-color: #f3f4f6;
}

.btn-icon.edit:hover { border-color: #d4af37; color: #d4af37; }
.btn-icon.delete:hover { border-color: #ef4444; color: #ef4444; }

.btn-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2px;
}

/* Form Styles */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

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

.admin-input, .admin-select, .admin-textarea {
  width: 100%;
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  background-color: #ffffff;
}

.admin-input:focus, .admin-select:focus, .admin-textarea:focus {
  border-color: #064e3b;
  box-shadow: 0 0 0 3px rgba(6, 78, 59, 0.1);
}

.admin-textarea {
  resize: vertical;
  min-height: 100px;
}

.admin-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #064e3b;
}

/* Image Upload Utility */
.upload-box {
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  background-color: #fafafa;
  cursor: pointer;
  transition: all 0.2s;
}

.upload-box:hover {
  border-color: #064e3b;
  background-color: rgba(6, 78, 59, 0.01);
}

.upload-preview {
  max-width: 100%;
  max-height: 150px;
  margin: 12px auto 0;
  border-radius: 6px;
  display: none;
}

/* Dynamic Specifications Entry */
.specs-builder-row {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
  align-items: center;
}

.specs-builder-row input {
  flex: 1;
}

.btn-remove-spec {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  padding: 6px;
}

.btn-remove-spec svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5px;
}

/* Inquiry CRM Detail view list */
.inquiry-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.inquiry-item {
  border: 1px solid #f3f4f6;
  border-radius: 8px;
  background-color: #ffffff;
  padding: 20px;
  transition: all 0.2s;
  cursor: pointer;
}

.inquiry-item:hover {
  border-color: #064e3b;
  box-shadow: 0 4px 12px rgba(6, 78, 59, 0.04);
}

.inquiry-item.unread {
  border-left: 4px solid #d4af37;
}

.inquiry-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.inquiry-sender-info h3 {
  font-size: 16px;
  color: #064e3b;
}

.inquiry-sender-info p {
  font-size: 13px;
  color: #6b7280;
  margin-top: 2px;
}

.inquiry-meta {
  text-align: right;
  font-size: 12px;
  color: #9ca3af;
}

.inquiry-body-collapsed {
  font-size: 14px;
  color: #4b5563;
  line-height: 1.5;
  white-space: pre-line;
}

.inquiry-actions-bar {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  border-top: 1px solid #f3f4f6;
  padding-top: 12px;
}

/* Modal for Admin Edits */
.admin-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
}

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

.admin-modal-content {
  background-color: #ffffff;
  border-radius: 12px;
  border: 1px solid #d4af37;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  transform: translateY(-20px);
  transition: all 0.3s ease;
  padding: 30px;
}

.admin-modal.active .admin-modal-content {
  transform: translateY(0);
}

.admin-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #f3f4f6;
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.admin-modal-header h2 {
  font-size: 20px;
  color: #064e3b;
}

.admin-modal-footer {
  margin-top: 30px;
  border-top: 1px solid #f3f4f6;
  padding-top: 20px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Fade in animation */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsiveness */
@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .admin-sidebar { width: 70px; }
  .admin-sidebar-header, .admin-sidebar-footer, .admin-nav-item span { display: none; }
  .admin-logo { padding-left: 6px; }
  :root { --admin-sidebar-w: 70px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
