/**
 * Status Drawer - Slide-out panel from RIGHT side
 * Beautiful, professional design matching Ocean Teal theme
 */

/* Floating Button */
.status-drawer-floating-btn {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--teal-light, #2dd4bf), var(--cyan, #22d3ee));
  border: none;
  border-radius: 50%;
  box-shadow: 
    0 4px 12px rgba(45, 212, 191, 0.3),
    0 2px 4px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.status-drawer-floating-btn:hover {
  transform: translateY(-50%) scale(1.1);
  box-shadow: 
    0 8px 20px rgba(45, 212, 191, 0.4),
    0 4px 8px rgba(0, 0, 0, 0.15);
}

.status-drawer-floating-btn:active {
  transform: translateY(-50%) scale(0.95);
}

.status-drawer-floating-btn svg {
  color: white;
}

.status-drawer-floating-btn.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) scale(0.8);
}

/* Drawer Panel - ENHANCED with 400px width */
.status-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 400px;
  background: linear-gradient(180deg, #ffffff 0%, #fafffe 100%);
  border-left: 1px solid rgba(20, 184, 166, 0.2);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.status-drawer.open {
  transform: translateX(0);
}

/* Header - ENHANCED with refresh button */
.status-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 20px;
  border-bottom: 1px solid rgba(20, 184, 166, 0.15);
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.08), rgba(34, 211, 238, 0.04));
}

.status-drawer-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--teal-dark, #0d7377);
  margin: 0;
  letter-spacing: -0.3px;
  flex: 1;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.refresh-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(45, 212, 191, 0.1);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}

.refresh-btn:hover {
  background: rgba(45, 212, 191, 0.2);
  transform: rotate(180deg);
}

.refresh-btn svg {
  color: var(--teal, #14b8a6);
}

.drawer-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(239, 68, 68, 0.1);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}

.drawer-close:hover {
  background: rgba(239, 68, 68, 0.2);
  transform: scale(1.1);
}

.drawer-close svg {
  color: var(--danger, #ef4444);
}

/* Body */
.status-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.status-drawer-body::-webkit-scrollbar {
  width: 6px;
}

.status-drawer-body::-webkit-scrollbar-track {
  background: transparent;
}

.status-drawer-body::-webkit-scrollbar-thumb {
  background: rgba(45, 212, 191, 0.3);
  border-radius: 3px;
}

/* Status Section */
.status-section {
  margin-bottom: 24px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(20, 184, 166, 0.1);
  border-radius: 12px;
  padding: 16px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--teal-dark, #0d7377);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.section-title svg {
  color: var(--teal, #14b8a6);
}

/* Collapsible Sections */
.section-title.collapsible {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 24px;
}

.section-title.collapsible:hover {
  color: var(--teal, #14b8a6);
}

.section-title.collapsible .chevron {
  position: absolute;
  right: 0;
  transition: transform 0.3s ease;
}

.section-title.collapsible.collapsed .chevron {
  transform: rotate(-90deg);
}

.collapsible-content {
  max-height: 1000px;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  opacity: 1;
}

.collapsible-content.collapsed {
  max-height: 0;
  opacity: 0;
}

/* Resources Summary */
.resources-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.resource-stat {
  text-align: center;
  padding: 12px;
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.06), rgba(34, 211, 238, 0.03));
  border: 1px solid rgba(20, 184, 166, 0.1);
  border-radius: 10px;
  transition: all 0.2s ease;
}

.resource-stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(45, 212, 191, 0.15);
}

.resource-stat.success {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(45, 212, 191, 0.04));
  border-color: rgba(16, 185, 129, 0.2);
}

.resource-stat.danger {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(239, 68, 68, 0.04));
  border-color: rgba(239, 68, 68, 0.2);
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--teal-dark, #0d7377);
  line-height: 1;
  margin-bottom: 6px;
  font-family: var(--font-mono, 'SF Mono', Consolas, monospace);
}

.resource-stat.success .stat-value {
  color: var(--success, #10b981);
}

.resource-stat.danger .stat-value {
  color: var(--danger, #ef4444);
}

.stat-label {
  font-size: 10px;
  color: var(--text-muted, #4a9b91);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* Status Items */
.status-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(20, 184, 166, 0.08);
  border-left: 3px solid var(--gray-300, #d1d5db);
  border-radius: 8px;
  margin-bottom: 8px;
  transition: all 0.2s ease;
}

.status-item:hover {
  transform: translateX(-4px);
  box-shadow: 0 2px 8px rgba(45, 212, 191, 0.12);
}

.status-item:last-child {
  margin-bottom: 0;
}

.status-item.status-online {
  border-left-color: var(--success, #10b981);
}

.status-item.status-offline {
  border-left-color: var(--danger, #ef4444);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gray-300, #d1d5db);
  flex-shrink: 0;
  position: relative;
}

.status-online .status-dot {
  background: var(--success, #10b981);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.status-online .status-dot::after {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  background: inherit;
  opacity: 0.3;
  animation: pulse-dot 2s ease infinite;
}

@keyframes pulse-dot {
  0%, 100% {
    transform: scale(1);
    opacity: 0.3;
  }
  50% {
    transform: scale(1.4);
    opacity: 0;
  }
}

.status-offline .status-dot {
  background: var(--danger, #ef4444);
}

.status-info {
  flex: 1;
  min-width: 0;
}

.status-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #0f2926);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-meta {
  font-size: 11px;
  color: var(--text-muted, #4a9b91);
  font-weight: 500;
}

/* Footer */
.drawer-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(20, 184, 166, 0.15);
  background: linear-gradient(180deg, transparent, rgba(45, 212, 191, 0.03));
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.last-update-label {
  font-size: 11px;
  color: var(--text-muted, #4a9b91);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.last-update-time {
  font-size: 12px;
  color: var(--teal, #14b8a6);
  font-weight: 600;
  font-family: var(--font-mono, 'SF Mono', Consolas, monospace);
}

/* Loading & Empty States */
.summary-loading,
.empty-state,
.error-state {
  text-align: center;
  padding: 20px;
  color: var(--text-muted, #4a9b91);
  font-size: 13px;
}

.summary-loading {
  animation: pulse-text 1.5s ease infinite;
}

@keyframes pulse-text {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.error-state {
  color: var(--danger, #ef4444);
}

/* Provider Items - ENHANCED */
.provider-item {
  padding: 12px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(20, 184, 166, 0.08);
  border-left: 3px solid var(--gray-300, #d1d5db);
  border-radius: 8px;
  margin-bottom: 8px;
  transition: all 0.2s ease;
}

.provider-item:hover {
  transform: translateX(-4px);
  box-shadow: 0 2px 8px rgba(45, 212, 191, 0.12);
}

.provider-item.online {
  border-left-color: var(--success, #10b981);
}

.provider-item.offline {
  border-left-color: var(--danger, #ef4444);
}

.provider-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.status-emoji {
  font-size: 14px;
  line-height: 1;
}

.provider-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #0f2926);
}

.provider-metrics {
  font-size: 11px;
  color: var(--text-muted, #4a9b91);
  font-weight: 500;
  margin-left: 22px;
}

/* Metric Items */
.metric-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 6px;
  margin-bottom: 6px;
}

.metric-item:last-child {
  margin-bottom: 0;
}

.metric-label {
  font-size: 12px;
  color: var(--text-muted, #4a9b91);
  font-weight: 600;
}

.metric-value {
  font-size: 12px;
  color: var(--text-primary, #0f2926);
  font-weight: 600;
  font-family: var(--font-mono, 'SF Mono', Consolas, monospace);
}

/* Breakdown Items */
.breakdown-section {
  margin-bottom: 16px;
}

.breakdown-section:last-child {
  margin-bottom: 0;
}

.breakdown-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--teal-dark, #0d7377);
  margin-bottom: 8px;
}

.breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 6px;
  margin-bottom: 4px;
}

.breakdown-item:last-child {
  margin-bottom: 0;
}

.breakdown-label {
  font-size: 11px;
  color: var(--text-muted, #4a9b91);
  font-weight: 600;
}

.breakdown-value {
  font-size: 11px;
  color: var(--text-primary, #0f2926);
  font-weight: 700;
  font-family: var(--font-mono, 'SF Mono', Consolas, monospace);
}

/* Error Items */
.error-item {
  padding: 10px 12px;
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-left: 3px solid var(--danger, #ef4444);
  border-radius: 8px;
  margin-bottom: 8px;
}

.error-item:last-child {
  margin-bottom: 0;
}

.error-provider {
  font-size: 12px;
  font-weight: 700;
  color: var(--danger, #ef4444);
  margin-bottom: 4px;
}

.error-message {
  font-size: 11px;
  color: var(--text-muted, #4a9b91);
  margin-bottom: 4px;
}

.error-action {
  font-size: 10px;
  color: var(--teal, #14b8a6);
  font-weight: 600;
  font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
  .status-drawer {
    width: 100%;
    max-width: 380px;
  }
  
  .status-drawer-floating-btn {
    right: 16px;
    width: 52px;
    height: 52px;
  }
}

@media (max-width: 480px) {
  .status-drawer {
    width: 100%;
  }
  
  .resources-summary {
    grid-template-columns: 1fr;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .status-drawer,
  .status-drawer-floating-btn,
  .status-item,
  .status-dot {
    animation: none;
    transition: none;
  }
}
