:root {
  /* IoT Factory Brand Colors */
  --iot-primary: #00a8cc; /* Azul principal (mejor contraste que #00d4ff) */
  --iot-primary-light: #00d4ff; /* Azul claro para acentos */
  --iot-primary-dark: #0088aa; /* Azul oscuro para hover */

  /* Grays con buen contraste */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Semantic Colors */
  --success: #059669;
  --warning: #d97706;
  --error: #dc2626;
  --info: #0284c7;

  /* Background */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
}

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

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(
    135deg,
    var(--bg-primary) 0%,
    var(--bg-secondary) 50%,
    var(--bg-tertiary) 100%
  );
  min-height: 100vh;
  padding: 20px;
  color: var(--gray-800);
}

.container {
  max-width: 1400px;
  margin: 0 auto;
}

/* Header */
header {
  background: rgba(255, 255, 255, 0.95);
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  margin-bottom: 30px;
  text-align: center;
  position: relative;
}

.logout-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  padding: 8px 16px;
  font-size: 0.9em;
  background: var(--gray-300);
  color: var(--gray-700);
}

.logout-btn:hover {
  background: var(--gray-400);
}

.header-logo {
  margin-bottom: 15px;
}

.logo-img {
  width: 120px;
  height: auto;
  display: inline-block;
}

.logo-fallback {
  display: none;
  font-size: 3em;
}

h1 {
  color: var(--iot-primary);
  font-size: 2.5em;
  margin-bottom: 10px;
}

.subtitle {
  color: var(--gray-600);
  font-size: 1.1em;
  font-weight: 400;
}

.subtitle::after {
  content: " | IoT Factory";
  color: var(--iot-primary);
  font-weight: 600;
}

/* Stats */
.stats {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.stat-card {
  flex: 1;
  min-width: 200px;
  background: rgba(255, 255, 255, 0.95);
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.stat-label {
  color: var(--gray-600);
  font-size: 0.9em;
  margin-bottom: 5px;
  font-weight: 500;
}

.stat-value {
  color: var(--iot-primary);
  font-size: 2em;
  font-weight: bold;
}

/* Controls */
.controls {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

button {
  background: linear-gradient(
    135deg,
    var(--iot-primary) 0%,
    var(--iot-primary-dark) 100%
  );
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1em;
  font-weight: 600;
  transition: all 0.3s;
  box-shadow: 0 4px 10px rgba(0, 168, 204, 0.3);
}

button:hover {
  background: linear-gradient(135deg, var(--iot-primary-dark) 0%, #006688 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 168, 204, 0.4);
}

button:focus {
  outline: 3px solid var(--iot-primary-light);
  outline-offset: 2px;
}

button.danger {
  background: var(--error);
}

button.danger:hover {
  background: #b91c1c;
}

button.danger:focus {
  outline-color: var(--error);
}

.filter-input {
  flex: 1;
  min-width: 200px;
  padding: 12px;
  border: 2px solid var(--iot-primary);
  border-radius: 8px;
  font-size: 1em;
  background: rgba(255, 255, 255, 0.95);
  color: var(--gray-800);
}

.filter-input:focus {
  outline: none;
  border-color: var(--iot-primary-dark);
  box-shadow: 0 0 0 3px rgba(0, 168, 204, 0.15);
}

.filter-input::placeholder {
  color: var(--gray-500);
}

/* Request Cards */
.requests-container {
  display: grid;
  gap: 20px;
}

.request-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.request-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.request-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  flex-wrap: wrap;
  gap: 10px;
}

.method {
  padding: 5px 15px;
  border-radius: 20px;
  font-weight: bold;
  color: white;
  font-size: 0.9em;
}

.method.GET {
  background: var(--info);
}
.method.POST {
  background: var(--success);
}
.method.PUT {
  background: var(--warning);
}
.method.DELETE {
  background: var(--error);
}
.method.PATCH {
  background: #7c3aed;
}

.timestamp {
  color: var(--gray-600);
  font-size: 0.9em;
}

.path {
  font-size: 1.2em;
  font-weight: bold;
  color: var(--gray-800);
  margin-bottom: 10px;
  word-break: break-all;
}

.section {
  margin: 15px 0;
}

.section-title {
  font-weight: bold;
  color: var(--iot-primary);
  margin-bottom: 8px;
  font-size: 0.95em;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.json-viewer {
  background: var(--gray-50);
  padding: 15px;
  border-radius: 8px;
  overflow-x: auto;
  font-family: "Courier New", monospace;
  font-size: 0.9em;
  max-height: 400px;
  overflow-y: auto;
  color: var(--gray-800);
}

.key-value {
  display: flex;
  padding: 5px 0;
  border-bottom: 1px solid var(--gray-200);
}

.key-value:last-child {
  border-bottom: none;
}

.key {
  font-weight: bold;
  color: var(--iot-primary);
  min-width: 150px;
  word-break: break-word;
}

.value {
  color: var(--gray-700);
  word-break: break-all;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.empty-state-icon {
  font-size: 4em;
  margin-bottom: 20px;
}

.empty-state-text {
  color: var(--gray-600);
  font-size: 1.2em;
}

.badge {
  display: inline-block;
  background: linear-gradient(
    135deg,
    var(--iot-primary) 0%,
    var(--iot-primary-dark) 100%
  );
  color: white;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.8em;
  font-weight: 600;
  margin-left: 10px;
}

/* Toggle Switch */
.auto-refresh {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.95);
  padding: 12px 20px;
  border-radius: 8px;
}

.toggle {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--gray-300);
  transition: 0.4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--iot-primary);
}

input:checked + .slider:before {
  transform: translateX(26px);
}

input:focus + .slider {
  box-shadow: 0 0 0 3px rgba(0, 168, 204, 0.15);
}

/* Responsive */
@media (max-width: 768px) {
  h1 {
    font-size: 1.8em;
  }

  .request-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .stats {
    flex-direction: column;
  }
}
