/* agents-sandbox.css - Styles for Agents Sandbox with collapsible sidebar */

/* ==========================================
   COLLAPSIBLE SIDEBAR STYLES
   ========================================== */

/* Sidebar Collapsible Container */
.sidebar-collapsible {
  width: var(--sidebar-width);
  background-color: #f2f4f7;
  border-right: 1px solid var(--border-color);
  margin-top: var(--top-nav-height);
  height: calc(100vh - var(--top-nav-height));
  position: fixed;
  left: 0;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.3s ease;
  z-index: 100;
}

/* Sidebar Collapsed State */
.sidebar-collapsible.collapsed {
  width: 60px;
}

.sidebar-collapsible.collapsed .submenu-item {
  padding: 12px;
  justify-content: center;
}

.sidebar-collapsible.collapsed .submenu-item-text {
  opacity: 0;
  width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.2s ease, width 0.2s ease;
}

.sidebar-collapsible:not(.collapsed) .submenu-item-text {
  opacity: 1;
  width: auto;
  transition: opacity 0.3s ease 0.1s;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px 12px;
  background: linear-gradient(135deg, var(--primary-color) 0%, #2563eb 100%);
  border: none;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  color: white;
  transition: background 0.2s ease;
}

.sidebar-toggle:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.sidebar-toggle i {
  font-size: 1rem;
  transition: transform 0.3s ease;
}

.sidebar-collapsible.collapsed .sidebar-toggle i {
  transform: rotate(180deg);
}

/* Submenu styling for collapsible sidebar */
.sidebar-collapsible .submenu {
  padding: 8px 0;
}

.sidebar-collapsible .submenu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin: 4px 8px;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  color: var(--text-gray);
  font-size: 0.875rem;
  position: relative;
}

.sidebar-collapsible .submenu-item:hover {
  background-color: rgba(59, 130, 246, 0.1);
  color: var(--primary-color);
}

.sidebar-collapsible .submenu-item.active {
  background: linear-gradient(135deg, var(--primary-color) 0%, #2563eb 100%);
  color: white;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.sidebar-collapsible .submenu-item i {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

/* ==========================================
   TOOLTIP FOR COLLAPSED STATE
   ========================================== */

.sidebar-collapsible.collapsed .submenu-item::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: #1f2937;
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sidebar-collapsible.collapsed .submenu-item::before {
  content: '';
  position: absolute;
  left: calc(100% + 2px);
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-right-color: #1f2937;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.sidebar-collapsible.collapsed .submenu-item:hover::after,
.sidebar-collapsible.collapsed .submenu-item:hover::before {
  opacity: 1;
}

/* ==========================================
   PARENT CONTAINER OVERRIDES
   ========================================== */

/* Reset content-area styles when agents-sandbox is loaded */
.content-area:has(.sidebar-collapsible) {
  margin-left: 0;
  width: 100%;
  padding: 0;
}

.content-container:has(.sidebar-collapsible) {
  margin: 0;
  padding: 0;
  width: 100%;
}

/* ==========================================
   MAIN CONTENT ADJUSTMENT
   ========================================== */

.agents-sandbox-main-content {
  margin-left: var(--sidebar-width);
  margin-top: 0;
  padding: 0;
  min-height: calc(100vh - var(--top-nav-height));
  transition: margin-left 0.3s ease;
  background-color: var(--bg-dark);
}

.agents-sandbox-main-content.sidebar-collapsed {
  margin-left: 60px;
}

/* Override sandbox-container styles for agents-sandbox page */
.agents-sandbox-main-content .sandbox-container {
  max-width: none;
  margin: 0;
  padding: 20px;
}

.agents-sandbox-main-content .sandbox-content {
  max-width: none;
}

/* ==========================================
   AGENTS SANDBOX CONTAINER STYLES
   ========================================== */

.agents-sandbox-container {
  padding: 20px;
  max-width: 1600px;
  margin: 0 auto;
}

.agents-sandbox-header {
  margin-bottom: 24px;
}

.agents-sandbox-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-color, #1f2937);
  margin: 0 0 8px 0;
}

.agents-sandbox-subtitle {
  color: var(--text-secondary, #6b7280);
  font-size: 0.875rem;
  margin: 0;
}

/* ==========================================
   SIDEBAR SECTION DIVIDER
   ========================================== */

.sidebar-collapsible .sidebar-section-title {
  padding: 12px 16px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-gray);
  opacity: 0.7;
}

.sidebar-collapsible.collapsed .sidebar-section-title {
  opacity: 0;
  height: 0;
  padding: 0;
  overflow: hidden;
}

/* ==========================================
   ANIMATION KEYFRAMES
   ========================================== */

@keyframes slideInText {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.sidebar-collapsible:not(.collapsed) .submenu-item-text {
  animation: slideInText 0.3s ease;
}

/* ==========================================
   RESPONSIVE ADJUSTMENTS
   ========================================== */

@media (max-width: 768px) {
  .sidebar-collapsible {
    width: 60px;
  }

  .sidebar-collapsible .submenu-item-text {
    display: none;
  }

  .agents-sandbox-main-content {
    margin-left: 60px;
  }

  .sidebar-collapsible .submenu-item {
    justify-content: center;
  }
}

/* ==========================================
   SCROLLBAR STYLING
   ========================================== */

.sidebar-collapsible::-webkit-scrollbar {
  width: 6px;
}

.sidebar-collapsible::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-collapsible::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.sidebar-collapsible::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* Hide scrollbar when collapsed */
.sidebar-collapsible.collapsed::-webkit-scrollbar {
  width: 0;
}

/* ==========================================
   AGENT STATUS PAGE STYLES
   ========================================== */

/* Agent Status List */
.agent-status-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.agent-status-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  transition: all 0.2s ease;
}

.agent-status-item:hover {
  border-color: #3b82f6;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.agent-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.agent-name {
  font-weight: 600;
  font-size: 1rem;
  color: #1f2937;
}

.agent-type {
  font-size: 0.75rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Agent Toggles Container */
.agent-toggles {
  display: flex;
  align-items: center;
  gap: 24px;
}

.toggle-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: #4b5563;
  white-space: nowrap;
}

/* Modern Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #e5e7eb;
  transition: 0.3s;
  border-radius: 28px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .toggle-slider {
  background-color: #10b981;
}

input:checked + .toggle-slider.training {
  background-color: #8b5cf6;
}

input:checked + .toggle-slider:before {
  transform: translateX(24px);
}

input:disabled + .toggle-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Agent Status Loading/Empty/Error States */
.agent-status-loading,
.agent-status-empty,
.agent-status-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  color: #6b7280;
  gap: 12px;
}

.agent-status-loading i,
.agent-status-empty i,
.agent-status-error i {
  font-size: 2.5rem;
  opacity: 0.5;
}

.agent-status-error {
  color: #ef4444;
}

.agent-status-error i {
  color: #ef4444;
}

/* Toast Notification */
.toast-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 20px;
  border-radius: 8px;
  color: white;
  font-weight: 500;
  font-size: 0.875rem;
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.toast-notification.success {
  background-color: #10b981;
}

.toast-notification.error {
  background-color: #ef4444;
}

.toast-notification i {
  font-size: 1.1rem;
}

/* ==========================================
   SEARCH AND TOOLBAR STYLES
   ========================================== */

.agent-status-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 14px;
  flex: 1;
  max-width: 400px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box:focus-within {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-box i {
  color: #9ca3af;
  font-size: 0.875rem;
}

.search-input {
  border: none;
  outline: none;
  flex: 1;
  font-size: 0.875rem;
  color: #1f2937;
  background: transparent;
}

.search-input::placeholder {
  color: #9ca3af;
}

.agent-status-count {
  font-size: 0.875rem;
  color: #6b7280;
  white-space: nowrap;
}

/* ==========================================
   PAGINATION STYLES
   ========================================== */

.pagination-container {
  margin-top: 24px;
  display: flex;
  justify-content: center;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s;
}

.pagination-btn:hover:not(.disabled):not(.active) {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.pagination-btn.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: white;
}

.pagination-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-btn i {
  font-size: 0.75rem;
}

.pagination-ellipsis {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  color: #6b7280;
  font-size: 0.875rem;
}

/* Responsive pagination */
@media (max-width: 640px) {
  .agent-status-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    max-width: none;
  }

  .agent-status-count {
    text-align: center;
  }

  .pagination-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    font-size: 0.75rem;
  }

  .agent-status-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .agent-toggles {
    width: 100%;
    justify-content: space-between;
  }

  .toggle-group {
    flex-direction: column;
    gap: 6px;
  }

  .toggle-label {
    font-size: 0.7rem;
  }
}
