/* AWS SimuLab Extended - Estilos completos */

:root {
  --aws-orange: #ff9900;
  --aws-blue: #232f3e;
  --aws-light-blue: #146eb4;
  --success-green: #28a745;
  --error-red: #dc3545;
  --warning-yellow: #ffc107;
  --info-blue: #17a2b8;
  --bg-light: #f8f9fa;
  --bg-white: #ffffff;
  --border-color: #dee2e6;
  --text-dark: #212529;
  --text-muted: #6c757d;
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 8px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.2);
}

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

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  color: var(--text-dark);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px;
}

/* ===== HEADER ===== */
.header {
  background: var(--aws-blue);
  color: white;
  padding: 20px 30px;
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
}

.logo {
  display: flex;
  align-items: center;
  gap: 15px;
}

.aws-icon {
  font-size: 36px;
}

.logo h1 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 4px;
}

.logo p {
  font-size: 13px;
  opacity: 0.8;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.user-label {
  font-size: 12px;
  opacity: 0.7;
}

.user-name {
  font-weight: 600;
  background: rgba(255,255,255,0.1);
  padding: 6px 14px;
  border-radius: 20px;
}

.timer {
  background: var(--aws-orange);
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 14px;
  font-family: 'Courier New', monospace;
}

/* ===== BREADCRUMB ===== */
.breadcrumb {
  background: var(--bg-white);
  padding: 12px 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
}

.breadcrumb .active {
  color: var(--aws-orange);
  font-weight: 600;
}

/* ===== MAIN LAYOUT ===== */
.main-content {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
}

/* ===== SIDEBAR ===== */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 20px;
  height: fit-content;
}

.progress-card,
.tasks-list,
.info-box {
  background: var(--bg-white);
  padding: 20px;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
}

.progress-card h3,
.tasks-list h4,
.info-box h4 {
  margin-bottom: 15px;
  color: var(--aws-blue);
  font-size: 16px;
}

.progress-bar {
  height: 32px;
  background: #e9ecef;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 12px;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--aws-light-blue), var(--aws-orange));
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 13px;
}

.progress-text,
.progress-percentage,
.estimated-time {
  text-align: center;
  font-size: 14px;
  margin-bottom: 8px;
}

.progress-text {
  font-weight: 600;
  color: var(--aws-blue);
}

.progress-percentage {
  color: var(--text-muted);
  font-size: 13px;
}

.estimated-time {
  color: var(--info-blue);
  font-size: 12px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
}

/* ===== TASKS LIST ===== */
.tasks-list ul {
  list-style: none;
  max-height: 600px;
  overflow-y: auto;
}

.task {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 8px;
  background: var(--bg-light);
  transition: all 0.3s ease;
  cursor: default;
}

.task:hover {
  background: #e2e6ea;
}

.task.completed {
  background: #d4edda;
}

.task-icon {
  font-size: 18px;
  margin-right: 10px;
  min-width: 24px;
}

.task-name {
  flex: 1;
  font-size: 13px;
  line-height: 1.4;
}

.task-points {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  margin-left: 8px;
}

/* ===== INFO BOX ===== */
.info-box ul {
  list-style: none;
  padding-left: 0;
}

.info-box li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}

.info-box li:last-child {
  border-bottom: none;
}

.info-box a {
  color: var(--aws-light-blue);
  text-decoration: none;
  transition: color 0.2s;
}

.info-box a:hover {
  color: var(--aws-orange);
  text-decoration: underline;
}

/* ===== CONTENT AREA ===== */
.content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.lab-section {
  background: var(--bg-white);
  padding: 30px;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
}

.lab-section.disabled {
  opacity: 0.5;
  pointer-events: none;
  filter: grayscale(0.3);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border-color);
}

.section-header h2 {
  color: var(--aws-blue);
  font-size: 22px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-status {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-light);
  color: var(--text-muted);
}

.section-status.completed {
  background: var(--success-green);
  color: white;
}

.section-description {
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.8;
  font-size: 15px;
}

/* ===== BANNERS ===== */
.info-banner {
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  border-left: 4px solid var(--info-blue);
  padding: 15px 18px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.6;
}

.warning-box {
  background: #fff3cd;
  border: 2px solid var(--warning-yellow);
  padding: 16px 18px;
  border-radius: 8px;
  margin: 16px 0;
  color: #856404;
  font-size: 14px;
  line-height: 1.6;
}

/* ===== FORMS ===== */
.form-card {
  background: var(--bg-light);
  padding: 26px;
  border-radius: 10px;
}

.form-card h4 {
  color: var(--aws-blue);
  margin-bottom: 16px;
  margin-top: 24px;
  font-size: 18px;
}

.form-card h4:first-child {
  margin-top: 0;
}

.section-divider {
  margin-top: 32px !important;
  padding-top: 24px;
  border-top: 2px dashed var(--border-color);
}

.form-group {
  margin-bottom: 22px;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--aws-blue);
  font-size: 14px;
}

.form-input,
.form-textarea,
select.form-input {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.3s ease;
  font-family: inherit;
  background: white;
}

.form-input:focus,
.form-textarea:focus,
select.form-input:focus {
  outline: none;
  border-color: var(--aws-light-blue);
  box-shadow: 0 0 0 3px rgba(20, 110, 180, 0.1);
}

.form-input:disabled,
.form-textarea:disabled {
  background: #e9ecef;
  cursor: not-allowed;
}

.form-textarea {
  font-family: 'Courier New', monospace;
  resize: vertical;
  line-height: 1.5;
}

.form-input-small {
  width: calc(50% - 5px);
  display: inline-block;
  padding: 10px 12px;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  font-size: 13px;
}

.tag-input-group {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.form-group small {
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.form-group small strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text-dark);
}

/* ===== VALIDATION FEEDBACK ===== */
.validation-feedback {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  display: none;
}

.validation-feedback.success {
  display: block;
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.validation-feedback.error {
  display: block;
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.validation-feedback.info {
  display: block;
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* ===== CHECKBOX & RADIO ===== */
.checkbox-group label,
.radio-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  background: var(--bg-white);
  border: 2px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 10px;
}

.checkbox-group label:hover,
.radio-label:hover {
  border-color: var(--aws-light-blue);
  background: #f0f8ff;
}

.checkbox-group label.checked,
.radio-label.checked {
  border-color: var(--aws-light-blue);
  background: #e3f2fd;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.radio-label input[type="radio"],
.checkbox-group input[type="checkbox"] {
  margin-top: 3px;
  cursor: pointer;
  width: 18px;
  height: 18px;
}

.radio-label small,
.checkbox-group small {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 4px;
  line-height: 1.4;
}

.radio-label strong,
.checkbox-group strong {
  color: var(--text-dark);
  font-size: 14px;
}

/* ===== BUTTONS ===== */
.btn-primary,
.btn-secondary,
.btn-test {
  padding: 12px 24px;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
}

.btn-primary {
  background: var(--aws-orange);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: #ec8400;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(255, 153, 0, 0.3);
}

.btn-primary:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--bg-light);
  color: var(--text-dark);
  border: 2px solid var(--border-color);
}

.btn-secondary:hover {
  background: #e2e6ea;
  border-color: var(--aws-blue);
}

.btn-test {
  background: var(--info-blue);
  color: white;
  padding: 8px 16px;
  font-size: 13px;
}

.btn-test:hover {
  background: #138496;
}

.btn-large {
  width: 100%;
  padding: 16px;
  font-size: 16px;
}

/* ===== LOADING ===== */
.loading {
  text-align: center;
  padding: 12px;
  color: var(--aws-light-blue);
  font-weight: 600;
  font-size: 14px;
}

.loading::after {
  content: '...';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

/* ===== ALERTS ===== */
#alertContainer {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  max-width: 420px;
}

.alert {
  padding: 14px 18px;
  border-radius: 8px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 14px;
  line-height: 1.5;
}

@keyframes slideIn {
  from {
    transform: translateX(450px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.alert.success {
  background: #d4edda;
  color: #155724;
  border-left: 4px solid var(--success-green);
}

.alert.error {
  background: #f8d7da;
  color: #721c24;
  border-left: 4px solid var(--error-red);
}

.alert.info {
  background: #d1ecf1;
  color: #0c5460;
  border-left: 4px solid var(--info-blue);
}

/* ===== TEST CHECKLIST ===== */
.test-checklist {
  background: white;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.test-checklist h4 {
  margin-bottom: 16px;
  color: var(--aws-blue);
}

.test-item {
  padding: 16px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  margin-bottom: 12px;
  background: var(--bg-light);
}

.test-item label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
  cursor: pointer;
}

.test-item label strong {
  flex: 1;
  font-size: 14px;
  line-height: 1.5;
}

.test-item.passed {
  border-color: var(--success-green);
  background: #d4edda;
}

.test-item.failed {
  border-color: var(--error-red);
  background: #f8d7da;
}

.test-checkbox {
  width: 20px;
  height: 20px;
  margin-top: 2px;
}

.test-result {
  margin-top: 10px;
  padding: 10px;
  border-radius: 4px;
  font-size: 13px;
  display: none;
}

.test-result.success {
  display: block;
  background: #d4edda;
  color: #155724;
}

.test-result.error {
  display: block;
  background: #f8d7da;
  color: #721c24;
}

/* ===== SUMMARY BOX ===== */
.summary-box {
  background: white;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 24px;
  border: 2px solid var(--aws-light-blue);
}

.summary-box h4 {
  margin-bottom: 16px;
  color: var(--aws-blue);
}

.config-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.config-table tr {
  border-bottom: 1px solid var(--border-color);
}

.config-table tr:last-child {
  border-bottom: none;
}

.config-table td {
  padding: 10px 12px;
}

.config-table td:first-child {
  width: 180px;
  color: var(--text-muted);
}

.config-table td:last-child {
  font-family: 'Courier New', monospace;
  color: var(--text-dark);
  word-break: break-all;
}

/* ===== COMPLETION SECTION ===== */
.completion-section {
  margin-top: 32px;
}

.success-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 40px;
  border-radius: 16px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.success-icon {
  font-size: 72px;
  margin-bottom: 16px;
  animation: bounce 1s ease;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

.success-card h2 {
  font-size: 32px;
  margin-bottom: 16px;
}

.success-score {
  font-size: 22px;
  margin: 16px 0;
  font-weight: 600;
}

.completion-time {
  font-size: 18px;
  margin-bottom: 24px;
  opacity: 0.9;
}

.achievement-level {
  display: inline-block;
  padding: 12px 28px;
  background: rgba(255,255,255,0.2);
  border-radius: 30px;
  font-size: 20px;
  font-weight: 700;
  margin: 16px 0;
}

.success-card h3 {
  font-size: 20px;
  margin: 24px 0 16px;
}

.success-card ul {
  list-style: none;
  text-align: left;
  max-width: 600px;
  margin: 0 auto 24px;
  font-size: 15px;
}

.success-card li {
  padding: 8px 0;
  line-height: 1.6;
}

.next-steps {
  background: rgba(255,255,255,0.1);
  padding: 24px;
  border-radius: 12px;
  margin: 24px 0;
}

.next-steps h3 {
  margin-top: 0;
}

.next-steps ul {
  text-align: left;
  max-width: 500px;
  margin: 12px auto 0;
}

.action-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 28px;
  flex-wrap: wrap;
}

.action-buttons button {
  min-width: 200px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
  .main-content {
    grid-template-columns: 280px 1fr;
  }
}

@media (max-width: 1024px) {
  .main-content {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    order: 2;
  }

  .content {
    order: 1;
  }

  .tasks-list ul {
    max-height: none;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 12px;
  }

  .header {
    flex-direction: column;
    gap: 12px;
    padding: 16px 20px;
  }

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

  .lab-section {
    padding: 20px;
  }

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

  .form-card {
    padding: 20px;
  }

  .tag-input-group {
    flex-direction: column;
  }

  .form-input-small {
    width: 100%;
  }

  #alertContainer {
    left: 12px;
    right: 12px;
    max-width: none;
  }

  .action-buttons {
    flex-direction: column;
  }

  .action-buttons button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .logo h1 {
    font-size: 20px;
  }

  .logo p {
    font-size: 11px;
  }

  .section-header h2 {
    font-size: 18px;
  }

  .success-card {
    padding: 28px 20px;
  }

  .success-icon {
    font-size: 56px;
  }

  .success-card h2 {
    font-size: 24px;
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  .sidebar,
  .header,
  .breadcrumb,
  #alertContainer,
  .action-buttons {
    display: none;
  }

  .main-content {
    grid-template-columns: 1fr;
  }

  .lab-section {
    page-break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* ===== Mejoras: barra de navegación, pasos y avisos (añadido) ===== */
.lab-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
}

.lab-toolbar .btn-mini {
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 8px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid var(--border-color, #dee2e6);
  color: var(--aws-blue, #232f3e);
  cursor: pointer;
  font-weight: 600;
}

.lab-toolbar .btn-mini:hover {
  border-color: var(--aws-orange, #ff9900);
  color: var(--aws-orange, #ff9900);
}

.lab-toolbar .nube-estado {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted, #6c757d);
}

.progress-steps {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--aws-blue, #232f3e);
}

.progress-steps .paso-num {
  color: var(--aws-orange, #ff9900);
  font-size: 15px;
}

/* Gráfico sin conexión (Lab 3) */
.grafico-fallback {
  border: 1px dashed var(--border-color, #dee2e6);
  border-radius: 10px;
  padding: 16px;
  background: var(--bg-light, #f8f9fa);
}

.grafico-fallback h4 {
  margin-bottom: 10px;
  color: var(--aws-blue, #232f3e);
  font-size: 15px;
}

.grafico-fila {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  margin-bottom: 6px;
}

.grafico-fila > span:first-child {
  flex: 0 0 170px;
  color: var(--text-muted, #6c757d);
}

.grafico-barra {
  display: inline-block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #ff9900, #e74c3c);
  min-width: 6px;
}

.grafico-fila > span:last-child {
  font-weight: 700;
  color: var(--aws-blue, #232f3e);
}

.summary-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color, #dee2e6);
  font-size: 14px;
}

/* Servicios asignados sin arrastrar (Lab 3, tablets/móvil) */
.service-card.asignado {
  border-left: 4px solid var(--aws-orange, #ff9900);
  cursor: pointer;
}

.service-card:focus {
  outline: 3px solid rgba(255, 153, 0, 0.5);
}

@media (max-width: 768px) {
  .lab-toolbar .btn-mini {
    flex: 1 1 auto;
    justify-content: center;
  }

  .lab-toolbar .nube-estado {
    margin-left: 0;
  }

  .grafico-fila > span:first-child {
    flex: 1 1 100%;
  }
}
