/* AWS SimuLab - Lab 2: IAM Styles */

:root {
  --aws-orange: #ff9900;
  --aws-blue: #232f3e;
  --aws-light-blue: #146eb4;
  --success-green: #28a745;
  --error-red: #dc3545;
  --warning-yellow: #ffc107;
  --bg-light: #f8f9fa;
  --bg-white: #ffffff;
  --border-color: #dee2e6;
  --text-dark: #212529;
  --text-muted: #6c757d;
  --iam-purple: #6f42c1;
  --iam-dark: #3d2465;
}

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

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

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

/* Header */
.header {
  background: linear-gradient(135deg, var(--iam-purple) 0%, var(--iam-dark) 100%);
  color: white;
  padding: 20px 30px;
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

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

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

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

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

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

.user-label {
  font-size: 13px;
  opacity: 0.8;
}

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

/* Breadcrumb */
.breadcrumb {
  background: var(--bg-white);
  padding: 12px 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.breadcrumb .active {
  color: var(--iam-purple);
  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;
}

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

.progress-card h3 {
  margin-bottom: 15px;
  color: var(--iam-purple);
}

.progress-bar {
  height: 30px;
  background: #e9ecef;
  border-radius: 15px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--iam-purple), var(--aws-orange));
  transition: width 0.4s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 14px;
}

.progress-text {
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--iam-purple);
}

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

/* Tasks List */
.tasks-list h4 {
  margin-bottom: 15px;
  color: var(--iam-purple);
}

.tasks-list ul {
  list-style: none;
}

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

.task.completed {
  background: #d4edda;
}

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

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

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

/* Info Box */
.info-box h4 {
  margin-bottom: 10px;
  color: var(--iam-purple);
}

.info-box ul {
  list-style: none;
  padding-left: 0;
}

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

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

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

/* Content Area */
.content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.lab-section {
  background: var(--bg-white);
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
}

.lab-section.disabled {
  opacity: 0.5;
  pointer-events: none;
}

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

.section-header h2 {
  color: var(--iam-purple);
  font-size: 22px;
}

.section-status {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  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;
}

.warning-text {
  color: var(--error-red);
}

/* Info Panel */
.info-panel {
  background: #e3f2fd;
  border-left: 4px solid var(--aws-light-blue);
  padding: 15px;
  border-radius: 6px;
  margin-bottom: 20px;
}

.info-panel h4 {
  color: var(--aws-light-blue);
  margin-bottom: 8px;
}

.info-panel ul {
  margin-left: 20px;
  margin-top: 8px;
}

.info-panel li {
  margin: 5px 0;
}

.info-panel code {
  background: rgba(0,0,0,0.05);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
}

/* Scenario Box */
.scenario-box {
  background: #fff8e1;
  border: 2px solid var(--warning-yellow);
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.scenario-box h4 {
  color: #f57c00;
  margin-bottom: 10px;
}

.scenario-box p {
  line-height: 1.8;
}

/* Form Elements */
.form-card {
  background: var(--bg-light);
  padding: 25px;
  border-radius: 8px;
}

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

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--iam-purple);
}

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

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--iam-purple);
}

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

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

/* Tag Input */
.tag-input-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.form-input-inline {
  padding: 8px 10px;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  font-size: 14px;
}

.form-input-inline:focus {
  outline: none;
  border-color: var(--iam-purple);
}

/* Validation feedback */
.validation-feedback {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  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.warning {
  display: block;
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffc107;
}

/* Checkbox and Radio */
.checkbox-group label,
.radio-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  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(--iam-purple);
  background: #f3f0f7;
}

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

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

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

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

.btn-primary {
  background: var(--iam-purple);
  color: white;
}

.btn-primary:hover {
  background: var(--iam-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(111,66,193,0.3);
}

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

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

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

.btn-simulation {
  background: var(--bg-white);
  color: var(--text-dark);
  border: 2px solid var(--border-color);
  margin: 8px;
  padding: 10px 16px;
  font-size: 14px;
}

.btn-simulation:hover {
  border-color: var(--iam-purple);
  background: #f3f0f7;
}

.btn-simulation.allowed {
  border-color: var(--success-green);
  background: #d4edda;
  color: #155724;
}

.btn-simulation.denied {
  border-color: var(--error-red);
  background: #f8d7da;
  color: #721c24;
}

/* Loading */
.loading {
  text-align: center;
  padding: 10px;
  color: var(--iam-purple);
  font-weight: 600;
}

/* Alert Container */
#alertContainer {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  max-width: 400px;
}

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: slideIn 0.3s ease;
  font-size: 14px;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    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.warning {
  background: #fff3cd;
  color: #856404;
  border-left: 4px solid var(--warning-yellow);
}

/* Warning Box */
.warning-box {
  background: #fff3cd;
  border: 2px solid #ffc107;
  padding: 15px;
  border-radius: 6px;
  margin: 15px 0;
  color: #856404;
  font-size: 14px;
}

/* Simulation Panel */
.simulation-panel {
  background: var(--bg-white);
  padding: 20px;
  border-radius: 8px;
  border: 2px solid var(--border-color);
  margin-bottom: 20px;
}

.simulation-panel h4 {
  color: var(--iam-purple);
  margin-bottom: 10px;
}

.simulation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 15px 0;
}

.simulation-results {
  margin-top: 15px;
  padding: 15px;
  background: var(--bg-light);
  border-radius: 6px;
  min-height: 60px;
}

.simulation-result-item {
  padding: 8px;
  margin: 5px 0;
  border-radius: 4px;
  font-size: 13px;
}

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

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

/* Summary Box */
.summary-box {
  background: var(--bg-white);
  padding: 20px;
  border-radius: 8px;
  border: 2px solid var(--iam-purple);
  margin-bottom: 20px;
}

.summary-box h4 {
  color: var(--iam-purple);
  margin-bottom: 15px;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  padding: 10px;
  margin: 5px 0;
  background: var(--bg-light);
  border-radius: 4px;
  font-size: 14px;
}

.summary-item strong {
  color: var(--iam-purple);
}

/* Completion Section */
.completion-section {
  margin-top: 30px;
}

.success-card {
  background: linear-gradient(135deg, var(--iam-purple) 0%, var(--iam-dark) 100%);
  color: white;
  padding: 35px;
  border-radius: 15px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.success-icon {
  font-size: 64px;
  margin-bottom: 15px;
}

.success-card h2 {
  font-size: 28px;
  margin-bottom: 10px;
}

.success-score {
  font-size: 20px;
  margin: 15px 0;
}

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

.success-card li {
  padding: 6px 0;
}

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

  .sidebar {
    order: 2;
  }

  .content {
    order: 1;
  }

  .tag-input-group {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .header {
    flex-direction: column;
    gap: 10px;
  }

  .lab-section {
    padding: 20px;
  }

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

  .simulation-actions {
    flex-direction: column;
  }

  .btn-simulation {
    width: 100%;
    margin: 5px 0;
  }
}

/* ===== 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%;
  }
}
