/* Status Page Specific Styles */

/* Remove navbar shadow on status page */
.navbar {
  box-shadow: none;
}

.status-main {
  min-height: calc(100vh - 200px);
  padding: 40px 20px;
  box-sizing: border-box;
  width: 100%;
  overflow-x: hidden; /* Prevent horizontal overflow */
}

.status-hero {
  text-align: center;
  margin: 10px auto 50px; /* Reduced top margin from 15px to 10px for tighter spacing */
  max-width: 800px;
}

.status-title {
  font-size: 2.5rem;
  font-weight: 500;
  color: var(--main-text-color);
  margin-bottom: 10px;
}

.status-subtitle {
  font-size: 1.1rem;
  font-weight: 300;
  color: var(--main-text-color);
  opacity: 0.7;
}

.status-container {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
  padding: 0 20px;
  width: 100%;
  box-sizing: border-box;
}

.status-card {
  background: var(--background-color);
  border-radius: 10px;
  padding: 25px;
  border: 1px solid rgba(231, 231, 231, 0.2);
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden; /* Prevent card content overflow */
}

/* Removed hover effect that caused cards to move */

/* Card Header with Action Button */
.card-header-with-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 25px;
  gap: 15px;
}

.card-header-with-action .status-card-title {
  margin-bottom: 0;
  text-align: left;
  flex: 1;
}

.reload-button {
  background: transparent;
  border: 1px solid rgba(231, 231, 231, 0.3);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  color: var(--main-text-color);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reload-button:hover {
  background: rgba(231, 231, 231, 0.1);
  border-color: rgba(231, 231, 231, 0.5);
}

.reload-button:active {
  transform: scale(0.95);
}

.reload-button svg {
  display: block;
}

.status-card-title {
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--main-text-color);
  margin: 0;
  text-align: left;
}

.status-title-container {
  display: flex;
  align-items: center;
  justify-content: flex-start; /* Changed from center to flex-start for left alignment */
  gap: 20px;
  margin-bottom: 20px; /* Increased from 15px to 20px for more space above data boxes */
  padding: 5px 0;
}

/* Uptime Chart Header */
.uptime-chart-header {
  display: flex;
  align-items: center;
  justify-content: center; /* Changed from space-between to center */
  margin-bottom: 10px; /* Reduced from 20px to reduce space between title and graph */
  gap: 15px;
  position: relative; /* For absolute positioning of reload button */
}

.uptime-chart-title {
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--main-text-color);
  margin: 0;
  text-align: center;
  flex: 0;
  white-space: nowrap;
}

.uptime-chart-header .reload-button {
  position: absolute;
  right: 0; /* Position reload button on the right */
}

/* Status Indicator - removed, using title instead */

/* Heartbeat Indicator */
.heartbeat-indicator {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  height: 40px;
  padding: 5px 10px;
  background: rgba(231, 231, 231, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(231, 231, 231, 0.15);
}

.heartbeat-bar {
  width: 6px;
  background: var(--main-text-color);
  border-radius: 3px;
  animation: heartbeat 1.2s ease-in-out infinite;
  box-shadow: 0 0 8px rgba(58, 58, 58, 0.3);
}

.heartbeat-bar:nth-child(1) {
  animation-delay: 0s;
  height: 15px;
}

.heartbeat-bar:nth-child(2) {
  animation-delay: 0.1s;
  height: 25px;
}

.heartbeat-bar:nth-child(3) {
  animation-delay: 0.2s;
  height: 35px;
}

.heartbeat-bar:nth-child(4) {
  animation-delay: 0.3s;
  height: 25px;
}

.heartbeat-bar:nth-child(5) {
  animation-delay: 0.4s;
  height: 15px;
}

@keyframes heartbeat {
  0%, 100% {
    transform: scaleY(1);
    opacity: 0.7;
  }
  50% {
    transform: scaleY(1.3);
    opacity: 1;
  }
}

/* Status colors for heartbeat */
.heartbeat-online .heartbeat-bar {
  background: #4CAF50;
  box-shadow: 0 0 8px rgba(76, 175, 80, 0.4);
}

.heartbeat-offline .heartbeat-bar {
  background: #f44336;
  box-shadow: 0 0 8px rgba(244, 67, 54, 0.4);
  animation: none;
  opacity: 0.5;
}

.heartbeat-maintenance .heartbeat-bar {
  background: #FF9800;
  box-shadow: 0 0 8px rgba(255, 152, 0, 0.4);
}

.status-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  box-shadow: 
    inset 3px 3px 6px rgba(0, 0, 0, 0.2),
    inset -3px -3px 6px rgba(255, 255, 255, 0.8),
    0 0 15px currentColor;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.1);
  }
}

.status-online {
  background: #4CAF50;
  color: #4CAF50;
}

.status-offline {
  background: #f44336;
  color: #f44336;
}

.status-maintenance {
  background: #FF9800;
  color: #FF9800;
}

.status-text {
  font-size: 1.8rem;
  font-weight: 500;
  color: var(--main-text-color);
}

/* Status Info */
.status-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.status-info-item {
  background: rgba(231, 231, 231, 0.05);
  border-radius: 10px;
  padding: 15px 20px;
  text-align: left;
  border: 1px solid rgba(231, 231, 231, 0.15);
}

.status-info-label {
  display: block;
  font-size: 1rem;
  font-weight: 400;
  color: var(--main-text-color);
  opacity: 0.7;
  margin-bottom: 8px;
}

.status-info-value {
  display: block;
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--main-text-color);
}

/* Uptime Heartbeat Visualization */
.uptime-heartbeat-container {
  height: 100px; /* Reduced from 180px to make bars shorter */
  margin: 20px 0;
  padding: 20px; /* Equal padding on all sides */
  background: rgba(231, 231, 231, 0.05);
  border-radius: 10px;
  border: 1px solid rgba(231, 231, 231, 0.15);
  display: flex;
  align-items: flex-end;
  gap: 2px; /* Reduced from 3px to make more space-efficient */
  overflow-x: visible; /*to fix the tool tip cutoff*/
  overflow-y: visible; /* Visible for tooltips */
}

.uptime-heartbeat-container::-webkit-scrollbar {
  height: 12px;
  background-color: transparent;
}

.uptime-heartbeat-container::-webkit-scrollbar-track {
  background-color: transparent; /* Transparent track background */
  border-radius: 10px;
}

.uptime-heartbeat-container::-webkit-scrollbar-thumb {
  background-color: rgba(30, 30, 30, 0.95); /* Darker scrollbar thumb for better visibility */
  border-radius: 10px;
}

.uptime-heartbeat-container::-webkit-scrollbar-thumb:hover {
  background-color: rgba(30, 30, 30, 1); /* Fully opaque on hover */
}

.uptime-bar {
  flex: 1;
  min-width: 12px; /* Reduced from 15px to be more space-efficient */
  max-width: 45px; /* Reduced from 50px */
  border-radius: 4px 4px 0 0;
  transition: opacity 0.3s ease, z-index 0s; /* Removed transform transition */
  position: relative;
  cursor: pointer;
  z-index: 1; /* Base z-index */
}

.uptime-bar:hover {
  /* Removed transform to prevent movement */
  opacity: 0.95;
  z-index: 9998; /* High z-index when hovering, just below tooltip */
}

.uptime-bar.status-online {
  background: linear-gradient(to top, #4CAF50, #66BB6A);
  box-shadow: 0 -2px 8px rgba(76, 175, 80, 0.3);
}

.uptime-bar.status-offline {
  background: linear-gradient(to top, #f44336, #EF5350);
  box-shadow: 0 -2px 8px rgba(244, 67, 54, 0.3);
}

.uptime-bar.status-maintenance {
  background: linear-gradient(to top, #FF9800, #FFA726);
  box-shadow: 0 -2px 8px rgba(255, 152, 0, 0.3);
}

.uptime-bar.status-no-data {
  background: linear-gradient(to top, #9E9E9E, #BDBDBD);
  box-shadow: 0 -2px 8px rgba(158, 158, 158, 0.2);
  opacity: 0.5;
}

.uptime-bar-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(58, 58, 58, 0.95); /* Consistent dark background for all tooltips */
  color: white;
  padding: 5px 8px; /* Further reduced padding */
  border-radius: 5px;
  font-size: 0.75rem; /* Even smaller font */
  line-height: 1.3;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 9999; /* Increased from 1000 to ensure it's above everything */
  margin-bottom: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.uptime-bar:hover .uptime-bar-tooltip {
  opacity: 1 !important; /* Force full opacity on hover regardless of parent */
}

/* Inline Legend */
.status-legend-inline {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 25px;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid rgba(58, 58, 58, 0.1);
}

.legend-item-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--main-text-color);
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.legend-dot.status-online {
  background: #4CAF50;
}

.legend-dot.status-offline {
  background: #f44336;
}

.legend-dot.status-maintenance {
  background: #FF9800;
}

.legend-dot.status-no-data {
  background: #9E9E9E;
}

/* Inline Legend */
.status-legend-inline {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 15px;
  margin-bottom: 10px;
  padding: 12px;
  background: rgba(231, 231, 231, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(231, 231, 231, 0.15);
}

.uptime-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 15px;
}

.uptime-stat {
  background: rgba(231, 231, 231, 0.05);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  border: 1px solid rgba(231, 231, 231, 0.15);
}

.uptime-stat-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--main-text-color);
  opacity: 0.92;
  margin-bottom: 10px;
}

.uptime-stat-value {
  display: block;
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--main-text-color);
}

/* Status Legend */
.status-legend {
  margin-top: 20px;
}

.legend-items {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 1rem;
  color: var(--main-text-color);
}

.legend-item .status-dot {
  animation: none;
}

/* Spin animation for reload button */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.reload-button.loading {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
  .status-title {
    font-size: 2rem;
  }

  .status-subtitle {
    font-size: 1rem;
  }

  .status-card {
    padding: 20px;
  }

  .status-text {
    font-size: 1.4rem;
  }
  
  .status-main-indicator {
    flex-direction: column;
    text-align: center;
    padding: 20px;
    gap: 16px;
  }
  
  .status-main-text {
    font-size: 1.5rem;
  }
  
  .status-sub-text {
    font-size: 0.9rem;
  }

  .status-info {
    grid-template-columns: 1fr;
  }

  .uptime-stats {
    grid-template-columns: 1fr;
  }

  #uptime-chart {
    height: 250px !important;
  }

  /* Increased padding for mobile to prevent tooltip cutoff */
  .uptime-heartbeat-container {
    padding-top: 50px; /* Adjusted for shorter bars */
    overflow-x: hidden; /* Hide scrollbar on mobile */
  }
}

@media screen and (max-width: 490px) {
  .status-title {
    font-size: 1.8rem;
  }

  .status-hero {
    margin: 20px auto 40px;
    padding: 0 10px;
  }

  .status-container {
    gap: 20px;
    padding: 0 10px;
    max-width: 100%;
  }

  .status-card {
    padding: 20px;
    border-radius: 10px;
  }

  /* Mobile adjustments for heartbeat container - extra padding for tooltips */
  .uptime-heartbeat-container {
    padding: 60px 20px 20px 20px; /* Equal left/right padding to match desktop */
    height: 100px; /* Reduced from 140px for shorter bars */
    margin: 15px 0;
    overflow-x: visible; /* Hide scrollbar on mobile */
  }

  .uptime-bar {
    min-width: 12px;
    max-width: 35px;
    gap: 2px;
  }

  .uptime-bar-tooltip {
    font-size: 0.65rem;
    padding: 3px 5px;
    line-height: 1.2;
  }

  .card-header-with-action {
    flex-direction: row;
    align-items: center;
  }

  .card-header-with-action .status-card-title {
    font-size: 1.2rem;
  }

  .reload-button {
    padding: 8px 10px;
  }

  .reload-button svg {
    width: 16px;
    height: 16px;
  }

  .status-legend-inline {
    flex-wrap: wrap;
    gap: 12px;
    padding: 8px;
    margin-top: 10px;
  }

  .legend-item-inline {
    font-size: 0.8rem;
  }

  .legend-dot {
    width: 10px;
    height: 10px;
  }

  .status-info {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .status-info-item {
    padding: 15px;
  }

  .status-info-value {
    font-size: 1.5rem;
  }

  .heartbeat-indicator {
    padding: 3px 8px;
    height: 32px;
  }

  .status-text {
    font-size: 1.5rem;
  }

  .status-card-title {
    font-size: 1.3rem;
  }
}
