/* Estilos globales para la app QR Matrices - Versión Mejorada */
:root{
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --muted: #64748b;
  --accent: #2563eb;
  --success: #16a34a;
  --error: #dc2626;
  --border: #e2e8f0;
  --text: #1e293b;
}

* { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, var(--bg) 0%, #eef2ff 100%);
  color: var(--text);
  margin: 0;
  padding: 24px 12px;
  line-height: 1.6;
}

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

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 16px;
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

header h1 {
  margin: 0;
  font-size: 1.8rem;
  color: var(--accent);
}

header div {
  display: flex;
  gap: 16px;
  align-items: center;
}

header a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.card {
  background: var(--card-bg);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.card h2 {
  margin-top: 0;
  color: var(--text);
  font-size: 1.5rem;
}

.card h3 {
  color: var(--accent);
  margin-top: 16px;
}

input, textarea, select {
  width: 100%;
  padding: 10px 12px;
  margin-top: 8px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-family: inherit;
  font-size: inherit;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

button {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

button:hover {
  background: #1d4ed8;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

button.secondary {
  background: #64748b;
}

button.secondary:hover {
  background: #475569;
}

.error {
  color: var(--error);
  font-weight: 500;
}

.info {
  color: var(--accent);
  font-weight: 500;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}

td, th {
  border-bottom: 1px solid #f1f5f9;
  padding: 12px;
  text-align: left;
}

th {
  background: #f8fafc;
  font-weight: 600;
  color: var(--text);
}

tr:hover {
  background: #fafbfc;
}

pre {
  background: #f8fafc;
  padding: 12px;
  border-radius: 8px;
  overflow: auto;
  border: 1px solid var(--border);
}

/* Matrix specific styles */
.matrix-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin: 16px 0;
}

.matrix-box {
  flex: 1 1 300px;
  background: #fbfdff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.matrix-box h3 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 1rem;
  color: var(--accent);
}

.matrix-box p {
  margin: 0;
}

.matrix-inner {
  overflow-x: auto;
  padding: 8px;
  background: white;
  border-radius: 6px;
  border: 1px solid #f1f5f9;
}

.matrix-table {
  border-collapse: collapse;
  margin: 0;
  min-width: 100%;
}

.matrix-table td {
  border: 1px solid #e6eefc;
  padding: 10px 12px;
  min-width: 50px;
  text-align: right;
  background: linear-gradient(180deg, #fff, #fbfdff);
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
}

.matrix-empty {
  color: var(--muted);
  font-style: italic;
  padding: 12px;
  text-align: center;
}

/* Controls and grid inputs */
.matrix-grid {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.matrix-cell {
  width: 100%;
  height: 44px;
  padding: 8px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  font-family: 'Courier New', monospace;
  transition: all 0.2s;
}

.matrix-cell:focus {
  border-color: var(--accent);
  background: #f0f7ff;
}

.controls {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 12px 0;
  flex-wrap: wrap;
}

.small {
  width: 80px !important;
}

.format-select {
  display: flex;
  gap: 16px;
  align-items: center;
  margin: 12px 0;
  flex-wrap: wrap;
}

.format-select label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.format-select select {
  margin: 0;
  width: auto;
}

.format-select input {
  margin: 0;
  width: 70px;
}

hr {
  border: none;
  border-top: 2px solid var(--border);
  margin: 20px 0;
}

/* Info boxes */
.info-box {
  background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 16px 0;
  font-size: 0.95rem;
  line-height: 1.6;
}

.info-box strong {
  color: var(--accent);
}

.info-box ul {
  margin: 8px 0;
  padding-left: 20px;
}

.info-box li {
  margin: 6px 0;
}

.section-title {
  color: #1e3a8a;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 8px;
  margin: 20px 0 12px 0;
}

/* Responsive */
@media (max-width: 768px) {
  header {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  header h1 {
    font-size: 1.4rem;
  }

  header div {
    justify-content: center;
  }

  .matrix-row {
    flex-direction: column;
  }

  .controls,
  .format-select {
    flex-direction: column;
    align-items: stretch;
  }

  .controls button,
  .format-select button {
    width: 100%;
  }

  .small {
    width: 100% !important;
  }

  button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  body {
    padding: 12px;
  }

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

  .matrix-table td {
    padding: 8px 6px;
    min-width: 40px;
    font-size: 0.85rem;
  }

  .matrix-box {
    flex: 1 1 100%;
  }
}
