/* Tengeh Ex - Global Stylesheet */
:root {
  --status-red: #ff4d4d;
  --status-yel: #FBE622;
  --status-grn: #009e49;
  --status-gry: #4a5d6e;
  --status-info: #3498db;
  --brand-orange: #F23800;
  --bg: #0b1621;
  --card: #152636;
  --border: #2c445a;
  --text-main: #ffffff;
  --text-muted: #8caebd;
  --radius: 8px;
  --deviation-orange: #F2994A;
}

body {
  margin: 0;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text-main);
  padding-bottom: 30px;
}

/* Header & Typography */
header {
  background: rgba(11, 22, 33, 0.95);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.logo-container {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.xfloat-logo {
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s;
  height: 22px;
  width: auto;
  display: block;
}

.xfloat-logo:hover {
  transform: scale(1.05);
  opacity: 0.85;
}

.page-title {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
  border-left: 1px solid var(--border);
  padding-left: 16px;
  letter-spacing: 0.5px;
  line-height: 1;
  padding-bottom: 2px;
  white-space: nowrap;
}

/* breadcrumb inside .page-title */
.bc {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  line-height: 1;
}

.bc-link {
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s;
}

.bc-link:hover {
  color: var(--brand-orange);
}

.bc-sep {
  color: var(--border);
  font-weight: 300;
  font-size: 15px;
}

.bc-current {
  color: var(--text);
  font-weight: 700;
}

.sub-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin: 0;
}

/* Controls */
.top-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.refresh-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.refresh-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

select.refresh-select {
  background: var(--card);
  color: #fff;
  border: 1px solid var(--border);
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 11px;
  outline: none;
  cursor: pointer;
}

.admin-btn {
  background: transparent;
  border: 1px solid var(--brand-orange);
  color: var(--brand-orange);
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.5px;
}

.admin-btn:hover {
  background: var(--brand-orange);
  color: white;
}

.back-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  font-size: 11px;
  font-weight: bold;
  transition: 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.back-btn:hover {
  border-color: var(--brand-orange);
  color: #fff;
}

/* Main Container */
.wrap {
  padding: 20px;
  max-width: 98%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* Common Indicators & Tools */
.trend-arrow {
  font-size: 14px;
  font-weight: 900;
}

.deviation-icon {
  color: var(--deviation-orange);
  font-size: 10px;
  cursor: help;
  animation: pulse-orange 2s infinite;
}

@keyframes pulse-orange {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }

  100% {
    opacity: 1;
  }
}

.fault-flag {
  color: var(--status-yel);
  font-size: 18px;
  margin-right: 4px;
  animation: pulse 1s infinite;
  vertical-align: middle;
}

@keyframes pulse {
  0% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.4;
    transform: scale(1.1);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.alert-flag-icon {
  font-size: 16px;
  margin-right: 4px;
  vertical-align: middle;
}

.alert-flag-icon.blinking {
  animation: fastBlink 1s infinite;
}

@keyframes fastBlink {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}

/* Shared Log Table Styles */
.log-container {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px;
  width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
}

.log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 10px;
}

.log-title {
  font-size: 16px;
  font-weight: bold;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.log-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: 800px;
}

.log-table th {
  text-align: left;
  padding: 10px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  font-size: 11px;
  cursor: pointer;
  user-select: none;
}

.log-table th:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.log-table td {
  padding: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #fff;
}

.sort-icon {
  font-size: 9px;
  margin-left: 4px;
  opacity: 0.3;
}

.sort-icon.active {
  opacity: 1;
  color: var(--brand-orange);
}

.log-status {
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: bold;
  font-size: 10px;
  display: inline-block;
}

.status-active {
  background: rgba(255, 77, 77, 0.2);
  color: var(--status-red);
  border: 1px solid var(--status-red);
}

.status-ack {
  background: rgba(251, 230, 34, 0.2);
  color: var(--status-yel);
  border: 1px solid var(--status-yel);
}

.status-resolved {
  background: rgba(0, 158, 73, 0.2);
  color: var(--status-grn);
  border: 1px solid var(--status-grn);
}

.status-verifying {
  background: rgba(52, 152, 219, 0.2);
  color: var(--status-blue);
  border: 1px solid var(--status-blue);
}

.status-auto-solved {
  background: rgba(0, 158, 73, 0.1);
  color: var(--status-grn);
  border: 1px solid var(--status-grn);
  font-style: italic;
}

.row-closed td {
  color: var(--status-gry);
  opacity: 0.6;
}

.row-closed .log-status {
  opacity: 0.7;
}

.action-link {
  cursor: pointer;
  text-decoration: underline;
  color: var(--text-muted);
  margin-right: 8px;
  font-weight: bold;
}

.action-link:hover {
  color: #fff;
}

/* Fault Overlay Modal */
#faultOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.fault-box {
  background: var(--card);
  padding: 30px;
  border-radius: 12px;
  text-align: center;
  max-width: 450px;
  border: 2px solid var(--status-red);
  box-shadow: 0 0 30px rgba(255, 77, 77, 0.3);
}

.fault-title {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 10px;
  color: var(--status-red);
  text-transform: uppercase;
}

.fault-msg {
  font-size: 16px;
  color: #fff;
  margin-bottom: 10px;
  line-height: 1.4;
}

.fault-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 25px;
  font-family: monospace;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 10px;
}

.fault-actions {
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
}

.btn-ack {
  background: var(--status-yel);
  color: #000;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
}

.btn-solve-nav {
  background: transparent;
  border: 1px solid var(--status-grn);
  color: var(--status-grn);
  padding: 10px 20px;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
}

.btn-resolve {
  background: var(--status-grn);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
}

/* Modal General Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(3px);
}

.modal-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 25px;
  width: 300px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.modal-title {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 10px;
  color: #fff;
}

.modal-text {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 15px;
}

.modal-btn {
  padding: 8px 20px;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
  border: none;
  font-size: 12px;
}

.btn-confirm {
  background: var(--brand-orange);
  color: #fff;
}

.btn-cancel {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.btn-cancel:hover {
  border-color: #fff;
  color: #fff;
}

/* Responsive Media Queries */
@media (max-width: 1200px) {
  .grid {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

@media (max-width: 992px) {
  .grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }

  .middle-section {
    grid-template-columns: 1fr !important;
  }

  .main-dashboard {
    grid-template-columns: 1fr 1fr !important;
  }
}

@media (max-width: 768px) {
  .grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .main-dashboard {
    grid-template-columns: 1fr !important;
  }

  .control-panel {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .cp-right {
    border-left: none;
    padding-left: 0;
    margin-left: 0;
  }

  table {
    min-width: 100%;
  }
}

@media (max-width: 576px) {
  .grid {
    grid-template-columns: 1fr !important;
  }

  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
  }

  .top-controls {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  .wrap {
    padding: 10px;
    gap: 15px;
  }

  .panel-box {
    height: auto !important;
    min-height: 400px;
  }

  .admin-btn, .back-btn, select.refresh-select {
    font-size: 10px;
    padding: 4px 8px;
  }

  .card {
    padding: 10px;
  }

  .card-header h2 {
    font-size: 14px;
  }

  .dot {
    width: 25px !important;
    height: 25px !important;
  }
  
  .info-bar {
      padding: 10px;
  }
}

/* App Mode: Monitor Only hiding rules */
.mode-monitor-only .control-element {
  display: none !important;
}