/* EMS Binary Entropy Heatmap Styles - Premium Dashboard Design */

:root {
  --yellow: #FFFF00;
  --red: #fc2848;
  --maroon: #a52848;
  --black: #000;
  --dark-gray: #111;
  --light-gray: #222;
  --green: #00ff88;
  --cyan: #0ff;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, var(--black) 0%, var(--dark-gray) 50%, var(--light-gray) 100%);
  color: #ffffff;
  line-height: 1.6;
  min-height: 100vh;
  padding: 20px;
}

.header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(102, 126, 234, 0.1);
  box-shadow: 0 4px 30px rgba(102, 126, 234, 0.1);
  margin-bottom: 2rem;
  border-radius: 1rem;
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 4rem;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  transition: all 0.3s ease;
}

.logo-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  overflow: hidden;
}

.logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.ems-badge {
  margin-left: 1rem;
  padding-left: 1rem;
  border-left: 2px solid rgba(102, 126, 234, 0.3);
  font-weight: 600;
  color: #667eea;
  font-size: 1.2rem;
}

.nav-links {
  display: flex;
  gap: 1rem;
}

.nav-btn {
  background: linear-gradient(135deg, var(--yellow) 0%, var(--red) 100%);
  color: var(--black);
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 255, 0, 0.3);
}

.dashboard {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr 1fr;
}

.main-panel {
  grid-column: 1 / -1;
}

.panel {
  background: linear-gradient(135deg, rgba(17, 17, 17, 0.95) 0%, rgba(34, 34, 34, 0.9) 100%);
  backdrop-filter: blur(10px);
  border-radius: 1rem;
  box-shadow: 0 8px 32px 0 rgba(252, 40, 72, 0.15);
  border: 1px solid rgba(255, 255, 0, 0.2);
  padding: 2rem;
  transition: all 0.3s ease;
}

.panel:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px 0 rgba(252, 40, 72, 0.25);
  border-color: rgba(252, 40, 72, 0.4);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(252, 40, 72, 0.3);
}

.panel-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--yellow);
  background: linear-gradient(90deg, var(--yellow), var(--red));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.confidence-badge {
  background: rgba(0, 255, 136, 0.2);
  color: var(--green);
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid rgba(0, 255, 136, 0.3);
}

.confidence-badge.medium {
  background: rgba(255, 255, 0, 0.2);
  color: var(--yellow);
  border-color: rgba(255, 255, 0, 0.3);
}

.confidence-badge.low {
  background: rgba(252, 40, 72, 0.2);
  color: var(--red);
  border-color: rgba(252, 40, 72, 0.3);
}

/* Heatmap Controls */
.heatmap-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.heatmap-controls label {
  color: var(--yellow);
  font-weight: bold;
  white-space: nowrap;
}

.heatmap-controls select {
  padding: 0.5rem 1rem;
  background: #ffffff;
  color: #333333;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 0.5rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  min-width: 180px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.heatmap-controls select:hover {
  border-color: var(--green);
  box-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
  background: #f8f9fa;
}

.heatmap-controls select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
  background: #ffffff;
}

/* Enhanced dropdown options styling */
.heatmap-controls select option {
  background: #ffffff;
  color: #333333;
  padding: 0.5rem;
  font-weight: 500;
}

.heatmap-controls select option:disabled {
  background: #f8f9fa;
  color: #6c757d;
  font-style: italic;
  font-weight: 600;
}

.heatmap-controls select option:hover {
  background: #e8f5e8;
  color: #2c5530;
}

.heatmap-controls select option[value^="pool:"] {
  background: #fff3cd;
  color: #856404;
}

.heatmap-controls select option[value^="system-pool:"] {
  background: #d1ecf1;
  color: #0c5460;
}

.heatmap-controls select option[value="System Quantum Pool"] {
  background: #d4edda;
  color: #155724;
  font-weight: 600;
}

/* Heatmap Container */
.heatmap-container {
  background: rgba(0, 0, 0, 0.5);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin: 1rem 0;
  border: 1px solid #333;
  text-align: center;
}

.heatmap-container h4 {
  color: var(--cyan);
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.heatmap-canvas-wrapper {
  overflow: auto;
  max-height: 600px;
  border: 2px solid var(--green);
  border-radius: 0.5rem;
  background: #0a0a0a;
  padding: 1rem;
  margin: 1rem 0;
  box-shadow: inset 0 0 20px rgba(0, 255, 136, 0.1);
}

#heatmapCanvas {
  border: 1px solid rgba(0, 255, 136, 0.3);
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  transition: transform 0.3s ease;
  min-width: 400px;
  min-height: 400px;
  cursor: crosshair;
  background: var(--dark-gray);
}

.zoom-controls {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin: 1rem 0;
  align-items: center;
  flex-wrap: wrap;
}

.zoom-btn {
  padding: 0.5rem 1rem;
  background: rgba(0, 255, 136, 0.2);
  color: var(--green);
  border: 1px solid rgba(0, 255, 136, 0.3);
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.3s ease;
  min-width: 50px;
}

.zoom-btn:hover {
  background: rgba(0, 255, 136, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 255, 136, 0.2);
}

.zoom-info {
  color: #ccc;
  margin-left: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.bit-legend {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin: 1rem 0;
  font-size: 0.9rem;
}

.bit-sample {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 0.5rem;
  border: 1px solid #333;
}

.bit-color {
  width: 16px;
  height: 16px;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.bit-one {
  background: var(--green);
  box-shadow: 0 0 8px rgba(0, 255, 136, 0.4);
}

.bit-zero {
  background: var(--dark-gray);
}

.heatmap-status {
  color: var(--yellow);
  margin-top: 1rem;
  font-style: italic;
  padding: 1rem;
  background: rgba(255, 255, 0, 0.1);
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 0, 0.2);
}

.stats-display {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.stat-item {
  background: rgba(0, 0, 0, 0.3);
  padding: 1rem;
  border-radius: 0.5rem;
  text-align: center;
  border: 1px solid #333;
  transition: all 0.3s ease;
}

.stat-item:hover {
  border-color: var(--green);
  transform: translateY(-2px);
}

.stat-value {
  display: block;
  font-weight: bold;
  color: var(--green);
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  text-shadow: 0 0 8px rgba(0, 255, 136, 0.3);
}

.stat-label {
  font-size: 0.8rem;
  color: #ccc;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Source Information */
.source-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.source-info-card {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 0.5rem;
  padding: 1.5rem;
  border: 1px solid #333;
  text-align: center;
  transition: all 0.3s ease;
}

.source-info-card:hover {
  border-color: var(--cyan);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 255, 255, 0.1);
}

.source-name {
  color: var(--cyan);
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.source-type {
  color: var(--yellow);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.source-desc {
  font-size: 0.85rem;
  color: #ccc;
  line-height: 1.4;
}

/* Technical Details */
.tech-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.tech-item {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 0.5rem;
  padding: 1rem;
  border: 1px solid #333;
}

.tech-label {
  color: var(--cyan);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}

.tech-value {
  color: var(--green);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.tech-desc {
  font-size: 0.8rem;
  color: #999;
  line-height: 1.3;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: inherit;
  font-size: 0.9rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--yellow) 0%, var(--red) 100%);
  color: var(--black);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-success {
  background: linear-gradient(135deg, var(--green) 0%, #00aa66 100%);
  color: var(--black);
  font-weight: bold;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 255, 0, 0.3);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn:disabled:hover {
  transform: none;
}

/* Entropy Assessment */
.entropy-assessment {
  background: rgba(0, 255, 136, 0.05);
  border: 1px solid rgba(0, 255, 136, 0.2);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.entropy-assessment h4 {
  color: var(--green);
  margin-bottom: 1rem;
}

.pattern-analysis {
  color: #ccc;
  line-height: 1.6;
}

.crypto-assessment {
  margin-top: 1.5rem;
  padding: 1rem;
  background: rgba(0, 255, 136, 0.1);
  border-radius: 0.5rem;
  border: 1px solid rgba(0, 255, 136, 0.2);
  line-height: 1.6;
}

/* Result Controls */
.result-controls {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
  justify-content: space-between;
}

/* Loading States */
.loading {
  position: relative;
}

.loading::after {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: var(--yellow);
  animation: spin 1s ease-in-out infinite;
  margin-left: 0.5rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Canvas Auto-Scaling */
#heatmapCanvas[width="26"], 
#heatmapCanvas[width="25"],
#heatmapCanvas[width="27"],
#heatmapCanvas[width="28"],
#heatmapCanvas[width="29"],
#heatmapCanvas[width="30"] {
  width: 500px !important;
  height: 500px !important;
  image-rendering: pixelated;
}

.canvas-zoomed {
  transform-origin: top left;
}

/* Responsive Design */
@media (max-width: 768px) {
  .dashboard {
    grid-template-columns: 1fr;
  }
  
  .header-content {
    flex-direction: column;
    height: auto;
    padding: 1rem;
    gap: 1rem;
  }

  .heatmap-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .heatmap-controls select {
    width: 100%;
  }

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

  .stats-display {
    grid-template-columns: repeat(2, 1fr);
  }

  .zoom-controls {
    flex-wrap: wrap;
    justify-content: center;
  }

  .bit-legend {
    flex-direction: column;
    gap: 1rem;
  }

  .result-controls {
    flex-direction: column;
  }

  #heatmapCanvas {
    min-width: 300px;
    min-height: 300px;
  }

  .tech-details {
    grid-template-columns: 1fr;
  }
}

/* Advanced hover effects */
.panel:hover .panel-title {
  background: linear-gradient(90deg, var(--green), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.heatmap-canvas-wrapper:hover {
  border-color: var(--cyan);
  box-shadow: inset 0 0 30px rgba(0, 255, 255, 0.15);
}

/* Shimmer effect for quality indicators */
.stat-item:hover .stat-value {
  position: relative;
  overflow: hidden;
}

.stat-item:hover .stat-value::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Additional enhancements */
.confidence-badge {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Glow effects */
.btn-primary:hover {
  box-shadow: 0 8px 25px rgba(255, 255, 0, 0.4), 0 0 20px rgba(255, 40, 72, 0.3);
}

.btn-success:hover {
  box-shadow: 0 8px 25px rgba(0, 255, 136, 0.4), 0 0 20px rgba(0, 255, 136, 0.2);
}
