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

body {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
  color: #e2e8f0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  min-height: 100vh;
  padding: 40px 20px;
}

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

.section {
  display: none;
  animation: fadeIn 0.4s ease;
}

.section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.header {
  text-align: center;
  margin-bottom: 40px;
}

h1 {
  font-size: 2.5rem;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 10px;
}

.subtitle {
  color: #94a3b8;
  font-size: 0.9rem;
}

.search-section {
  background: #1e293b;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 30px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.search {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.search input {
  flex: 1;
  padding: 14px 18px;
  border: 2px solid #334155;
  border-radius: 12px;
  background: #0f172a;
  color: #f1f5f9;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.search input:focus {
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

.search input::placeholder {
  color: #64748b;
}

.btn {
  padding: 14px 32px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #0ea5e9, #3b82f6);
  color: white;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -5px rgba(14, 165, 233, 0.4);
}

.btn:active {
  transform: translateY(0);
}

.btn-success {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}

.btn-success:hover {
  box-shadow: 0 10px 20px -5px rgba(34, 197, 94, 0.4);
}

.btn-purple {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
}

.btn-purple:hover {
  box-shadow: 0 10px 20px -5px rgba(139, 92, 246, 0.4);
}

.btn-back {
  background: linear-gradient(135deg, #64748b, #475569);
}

.btn-back:hover {
  box-shadow: 0 10px 20px -5px rgba(100, 116, 139, 0.4);
}

.btn-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.status {
  display: none;
  padding: 14px 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  font-weight: 500;
  animation: slideIn 0.3s ease;
}

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

.loading { display: block; background: linear-gradient(135deg, #1d4ed8, #2563eb); text-align: center; }
.success { display: block; background: linear-gradient(135deg, #15803d, #16a34a); text-align: center; }
.error { display: block; background: linear-gradient(135deg, #b91c1c, #dc2626); text-align: center; }

.cards-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.nic-card, .dns-card, .mail-card, .o365-card {
  background: linear-gradient(135deg, #1e293b, #1e1b4b);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

.nic-card-header, .dns-card-header, .mail-card-header, .o365-card-header {
  cursor: pointer;
  padding: 20px 24px;
  transition: opacity 0.2s ease;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nic-card-header:hover, .dns-card-header:hover, .mail-card-header:hover, .o365-card-header:hover {
  opacity: 0.85;
}

.nic-card-header { background: linear-gradient(135deg, #0ea5e9, #3b82f6); }
.dns-card-header { background: linear-gradient(135deg, #0ea5e9, #3b82f6); }
.mail-card-header { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.o365-card-header { background: linear-gradient(135deg, #f97316, #ea580c); }

.nic-card-header h2, .dns-card-header h2, .mail-card-header h2, .o365-card-header h2 {
  color: white;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.nic-card-header h2::before { content: "🏢"; font-size: 1.5rem; }
.dns-card-header h2::before { content: "🌐"; font-size: 1.5rem; }
.mail-card-header h2::before { content: "📧"; font-size: 1.5rem; }
.o365-card-header h2::before { content: "🟠"; font-size: 1.5rem; }

.toggle-icon {
  font-size: 1.5rem;
  color: white;
  transition: transform 0.3s ease;
  display: inline-block;
}

.toggle-icon.collapsed { transform: rotate(-90deg); }

.nic-card-content,
.dns-card-content,
.mail-card-content,
.o365-card-content {
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  transition: all 0.3s ease;
  max-height: 2000px;
  overflow: hidden;
  opacity: 1;
}

.nic-card-content.collapsed,
.dns-card-content.collapsed,
.mail-card-content.collapsed,
.o365-card-content.collapsed {
  max-height: 0;
  padding: 0 24px;
  opacity: 0;
  gap: 0;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.info-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #94a3b8;
  font-weight: 600;
}

.info-value {
  font-size: 1rem;
  font-weight: 500;
  color: #f1f5f9;
  word-break: break-word;
}

.dns-values-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dns-value-item {
  font-size: 1rem;
  font-weight: 500;
  color: #f1f5f9;
  word-break: break-word;
  padding: 4px 0;
}

.dns-value-item.cname { color: #60a5fa; }
.dns-value-item.a-record { color: #34d399; }
.dns-value-item.no-record { color: #94a3b8; font-style: italic; }
.dns-value-item.o365 { color: #fbbf24; }
.dns-value-item.ok { color: #22c55e; font-weight: 600; cursor: pointer; }
.dns-value-item.ok:hover { text-decoration: underline; }
.dns-value-item.diff { color: #ef4444; font-weight: 600; cursor: pointer; }
.dns-value-item.diff:hover { text-decoration: underline; }

.soa-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.soa-item {
  display: flex;
  gap: 12px;
  padding: 4px 0;
  font-size: 1rem;
  color: #f1f5f9;
}

.soa-item .soa-label {
  color: #94a3b8;
  min-width: 100px;
  font-weight: 400;
}

.soa-item .soa-value {
  color: #60a5fa;
  font-weight: 500;
  word-break: break-word;
}

.info-value.na {
  color: #94a3b8;
  font-style: italic;
}

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(4px);
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: #1e293b;
  border-radius: 20px;
  padding: 30px;
  max-width: 800px;
  width: 95%;
  max-height: 85vh;
  overflow-y: auto;
  border: 1px solid #334155;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-content .modal-close {
  float: right;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.8rem;
  cursor: pointer;
  padding: 0 8px;
  line-height: 1;
}

.modal-content .modal-close:hover {
  color: #f1f5f9;
}

.modal-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #334155;
  flex-wrap: wrap;
  gap: 8px;
}

.modal-title-row h3 {
  color: #f1f5f9;
  margin: 0;
  font-size: 1.2rem;
}

.modal-badge {
  font-size: 0.8rem;
  padding: 4px 14px;
  border-radius: 30px;
  font-weight: 600;
}

.modal-badge.ok {
  background: #15803d;
  color: #f1f5f9;
}

.modal-badge.diff {
  background: #b91c1c;
  color: #f1f5f9;
}

.modal-subtitle {
  color: #94a3b8;
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.dns-server-block {
  margin-bottom: 16px;
  padding: 14px 16px;
  background: #0f172a;
  border-radius: 12px;
  border-left: 4px solid #3b82f6;
}

.dns-server-block.diff-server {
  border-left-color: #ef4444;
}

.dns-server-block.ok-server {
  border-left-color: #22c55e;
}

.dns-server-block .server-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}

.dns-server-block .server-name {
  color: #60a5fa;
  font-weight: 600;
  font-size: 1rem;
}

.dns-server-block .server-status {
  font-size: 0.8rem;
  font-weight: 500;
}

.dns-server-block .server-status.ok-status {
  color: #22c55e;
}

.dns-server-block .server-status.diff-status {
  color: #ef4444;
}

.record-group {
  margin-top: 4px;
  padding: 4px 0;
}

.record-group .record-type-label {
  color: #94a3b8;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 2px;
}

.record-group .record-values {
  color: #e2e8f0;
  font-size: 0.9rem;
  font-family: 'Courier New', monospace;
  white-space: pre-wrap;
  word-break: break-word;
  padding-left: 8px;
}

.record-group .record-values .no-record {
  color: #64748b;
  font-style: italic;
}

.calculator-card {
  background: linear-gradient(135deg, #1e293b, #1e1b4b);
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
  max-width: 700px;
  margin: 0 auto;
}

.calculator-card .form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.calculator-card .form-group label {
  font-weight: 500;
  color: #cbd5e1;
  font-size: 0.95rem;
}

.calculator-card .form-group input,
.calculator-card .form-group select {
  padding: 12px 14px;
  border: 1.5px solid #334155;
  border-radius: 14px;
  font-size: 1rem;
  background: #0f172a;
  color: #f1f5f9;
  transition: 0.2s;
  outline: none;
  width: 100%;
}

.calculator-card .form-group input:focus,
.calculator-card .form-group select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.calculator-card .row-2 {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.calculator-card .row-2 .form-group {
  flex: 1 1 180px;
}

.calculator-card .btn-group-calc {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 10px 0 18px;
}

.calculator-card .output-box {
  background: #0f172a;
  border-radius: 20px;
  padding: 18px 22px;
  margin-top: 20px;
  border-left: 6px solid #3b82f6;
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.7;
  color: #e2e8f0;
  min-height: 120px;
  transition: 0.2s;
  border: 1px solid #334155;
}

.calculator-card .output-box:empty::before {
  content: "⏺ Los datos de red aparecerán aquí";
  color: #64748b;
  font-style: italic;
  font-family: 'Segoe UI', sans-serif;
}

.calc-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

@media (max-width: 768px) {
  body { padding: 20px 15px; }
  h1 { font-size: 1.8rem; }
  .search { flex-direction: column; }
  .search .btn { width: 100%; }
  .btn-group { flex-direction: column; }
  .btn-group .btn { width: 100%; }
  .nic-card-content,
  .dns-card-content,
  .mail-card-content,
  .o365-card-content {
    grid-template-columns: 1fr;
  }
  .info-value, .dns-value-item { font-size: 0.85rem; }
  .soa-item { flex-direction: column; gap: 2px; }
  .soa-item .soa-label { min-width: auto; }
  .calculator-card { padding: 20px; }
  .calc-header-actions { flex-direction: column; align-items: stretch; }
  .modal-content { padding: 20px; }
}

#resultado {
  display: none;
}