/* Admin Dashboard Style Definitions */

:root {
  --admin-sidebar-w: 260px;
  --admin-card-bg: rgba(30, 41, 59, 0.7);
  --admin-border: rgba(255, 255, 255, 0.08);
}

/* Authentication Overlay */
.login-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  padding: 20px;
}

.login-box {
  background: var(--admin-card-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--admin-border);
  padding: 40px;
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.login-logo {
  height: 60px;
  margin-bottom: 24px;
}

.login-box h2 {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

.login-box p {
  color: var(--slate-400);
  font-size: 14px;
  margin-bottom: 24px;
}

.login-error-msg {
  color: #ef4444;
  font-size: 13px;
  margin-top: 15px;
  font-weight: 500;
}

/* Dashboard Layout */
.admin-dashboard {
  display: flex;
  min-height: 100vh;
  background-color: #0b0f19;
  color: #f1f5f9;
}

/* Sidebar Styling */
.sidebar {
  width: var(--admin-sidebar-w);
  background: #0f172a;
  border-right: 1px solid var(--admin-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
  z-index: 100;
}

.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sidebar-logo {
  height: 40px;
}

.badge {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 30px;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  font-weight: 600;
}

.badge.local {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.badge.mssql {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
}

.sidebar-menu {
  flex: 1;
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: var(--slate-400);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s ease;
}

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

.menu-item.active {
  background: var(--primary);
  color: #fff;
}

.menu-item svg {
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid var(--admin-border);
}

/* Workspace Container */
.workspace {
  margin-left: var(--admin-sidebar-w);
  flex: 1;
  padding: 40px;
  min-width: 0; /* Prevents overflow issues */
}

.workspace-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  gap: 20px;
}

.workspace-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
}

.workspace-card {
  background: var(--admin-card-bg);
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  padding: 24px;
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

/* Admin Table Design */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.admin-table th {
  padding: 14px 18px;
  border-bottom: 2px solid var(--admin-border);
  color: var(--slate-300);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-table td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--admin-border);
  color: var(--slate-200);
  font-size: 14px;
  vertical-align: middle;
}

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

.table-img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--admin-border);
}

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

/* Dialog Modals */
.modal-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

.modal-dialog-box {
  background: #1e293b;
  border: 1px solid var(--admin-border);
  border-radius: 16px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: translateY(-20px);
  transition: transform 0.3s ease;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-dialog-overlay.active .modal-dialog-box {
  transform: translateY(0);
}

.modal-dialog-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-dialog-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--slate-400);
  cursor: pointer;
  transition: color 0.2s ease;
}

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

.modal-dialog-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

/* Form Styles */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  margin-bottom: 18px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--slate-300);
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  padding: 10px 14px;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.helper-text {
  font-size: 11px;
  color: var(--slate-400);
  margin-top: 4px;
}

/* RTL Adaptability inside Workspace */
[dir="rtl"] .sidebar {
  left: auto;
  right: 0;
  border-right: none;
  border-left: 1px solid var(--admin-border);
}

[dir="rtl"] .workspace {
  margin-left: 0;
  margin-right: var(--admin-sidebar-w);
}

[dir="rtl"] .menu-item {
  text-align: right;
}

/* Responsive Overrides */
@media (max-width: 992px) {
  .sidebar {
    width: 70px;
  }
  .sidebar-logo {
    display: none;
  }
  .sidebar-header {
    padding: 15px;
    justify-content: center;
  }
  .badge {
    display: none;
  }
  .menu-item span {
    display: none;
  }
  .workspace {
    margin-left: 70px;
    padding: 20px;
  }
  .sidebar-footer button span {
    display: none;
  }
  [dir="rtl"] .sidebar {
    right: 0;
    left: auto;
  }
  [dir="rtl"] .workspace {
    margin-right: 70px;
    margin-left: 0;
  }
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
  min-width: 250px;
  max-width: 350px;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.error {
  border-left: 4px solid #ef4444;
  background: rgba(127, 29, 29, 0.95);
}

[dir="rtl"] .toast-container {
  right: auto;
  left: 24px;
}

/* --- Features List/Tags Editor Styling --- */
.features-list-editor {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px;
  min-height: 50px;
  margin-top: 6px;
}

.feature-editor-tag {
  display: inline-flex;
  align-items: center;
  background: rgba(var(--primary-rgb), 0.1) !important;
  border: 1px solid rgba(var(--primary-rgb), 0.25);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: #f1f5f9;
  transition: all 0.2s ease;
}

.feature-editor-tag:hover {
  background: rgba(var(--primary-rgb), 0.15) !important;
  border-color: rgba(var(--primary-rgb), 0.4);
}

.feature-editor-tag .tag-remove-btn {
  margin-left: 8px;
  cursor: pointer;
  color: #ef4444;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  transition: color 0.2s ease;
}

[dir="rtl"] .feature-editor-tag .tag-remove-btn {
  margin-left: 0;
  margin-right: 8px;
}

.feature-editor-tag .tag-remove-btn:hover {
  color: #f87171;
}

.features-add-group input {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
}

.features-add-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.2);
}
