/**
 * CSS - Sistema de Cursos Policiales
 * Diseño moderno, profesional y responsive
 */

:root {
  --primary: #1e3a5f;
  --primary-light: #2d5a8a;
  --primary-dark: #0f1f33;
  --accent: #d4af37;
  --accent-light: #f4d03f;
  --turquesa: #00bcd4;
  --turquesa-dark: #00897b;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --white: #ffffff;
  --font-main: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: 1.6;
  color: var(--gray-700);
  background: linear-gradient(
    180deg,
    #0f1f33 0%,
    #1e3a5f 30%,
    #2d5a8a 60%,
    #4a90c4 100%
  );
  min-height: 100vh;
  background-attachment: fixed;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}
a {
  text-decoration: none;
  color: inherit;
}
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}
ul {
  list-style: none;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}
@media (min-width: 640px) {
  .container {
    padding: 0 24px;
  }
}
@media (min-width: 1024px) {
  .container {
    padding: 0 32px;
  }
}

/* HEADER */
.header {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 100%
  );
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-lg);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--white);
  font-weight: 700;
  font-size: 18px;
}

.logo-img {
  height: 45px;
  width: auto;
  object-fit: contain;
  border-radius: 8px;
}

@media (min-width: 768px) {
  .logo-img {
    height: 80px;
  }
}

@media (min-width: 768px) {
  .logo {
    font-size: 22px;
  }
}

.nav {
  display: none;
  gap: 8px;
}
@media (min-width: 768px) {
  .nav {
    display: flex;
  }
}

.nav a {
  padding: 10px 18px;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: all 0.2s;
}
.nav a:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--white);
}

.menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--white);
  font-size: 24px;
  border-radius: var(--radius-md);
}
@media (min-width: 768px) {
  .menu-btn {
    display: none;
  }
}

/* HERO */
.hero {
  background: rgba(0, 0, 0, 0.15);
  color: var(--white);
  padding: 60px 0 80px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Ccircle cx='30' cy='30' r='4'/%3E%3C/g%3E%3C/svg%3E");
}

.hero-content {
  position: relative;
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 188, 212, 0.15);
  border: 1px solid rgba(0, 188, 212, 0.5);
  padding: 8px 20px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 600;
  color: #80deea;
  margin-bottom: 24px;
}

.hero h1 {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 20px;
}

@media (min-width: 768px) {
  .hero {
    padding: 80px 0 100px;
  }
  .hero h1 {
    font-size: 48px;
  }
}

@media (min-width: 1024px) {
  .hero h1 {
    font-size: 56px;
  }
}

.hero p {
  font-size: 18px;
  opacity: 0.9;
  margin-bottom: 32px;
  max-width: 550px;
  margin-left: auto;
  margin-right: auto;
}

/* SECTIONS */
.section {
  padding: 60px 0;
  background: rgba(255, 255, 255, 0.08);
}
@media (min-width: 768px) {
  .section {
    padding: 80px 0;
  }
}

.section-header {
  text-align: center;
  margin-bottom: 48px;
}
.section-header h2 {
  font-size: 28px;
  font-weight: 800;
  color: var(--white);
  margin-bottom: 12px;
}
@media (min-width: 768px) {
  .section-header h2 {
    font-size: 36px;
  }
}
.section-header p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 17px;
  max-width: 500px;
  margin: 0 auto;
}

/* COURSES GRID */
.courses-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
@media (min-width: 640px) {
  .courses-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 1024px) {
  .courses-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
  }
}

/* COURSE CARD */
.course-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.course-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
}

.course-image {
  position: relative;
  height: 200px;
  background: linear-gradient(
    135deg,
    var(--primary-light),
    var(--primary-dark)
  );
  overflow: hidden;
}

.course-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.course-card:hover .course-image img {
  transform: scale(1.08);
}

.course-badges {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-policial {
  background: var(--primary);
  color: var(--white);
}
.badge-publico {
  background: var(--success);
  color: var(--white);
}
.badge-cupos {
  background: rgba(255, 255, 255, 0.95);
  color: var(--gray-700);
}
.badge-warning {
  background: var(--warning);
  color: var(--white);
}
.badge-danger {
  background: var(--danger);
  color: var(--white);
}

.course-content {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.course-content h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 12px;
  line-height: 1.3;
}
.course-content p {
  color: var(--gray-500);
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 20px;
  flex: 1;
}

.course-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-100);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--gray-600);
  font-size: 14px;
}
.meta-item svg {
  width: 18px;
  height: 18px;
  color: var(--primary);
  flex-shrink: 0;
}

.course-footer {
  padding: 0 24px 24px;
}

/* VER MAS (indicador en tarjeta) */
.card-ver-mas {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--turquesa-dark);
  font-weight: 600;
  font-size: 14px;
  margin-top: auto;
  padding-top: 16px;
  transition: gap 0.2s ease;
}

.course-card:hover .card-ver-mas {
  gap: 10px;
  color: var(--turquesa);
}

.card-ver-mas svg {
  transition: transform 0.2s ease;
}

.course-card:hover .card-ver-mas svg {
  transform: translateX(3px);
}

/* =============================================
   MODAL DETALLE DEL CURSO
   ============================================= */

.modal-detalle-content {
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
}

.detalle-imagen {
  position: relative;
  width: 100%;
  height: 240px;
  background: linear-gradient(
    135deg,
    var(--primary-light),
    var(--primary-dark)
  );
  overflow: hidden;
}

@media (min-width: 640px) {
  .detalle-imagen {
    height: 280px;
  }
}

.detalle-imagen img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detalle-badges {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.detalle-body {
  padding: 28px 24px 24px;
}

@media (min-width: 640px) {
  .detalle-body {
    padding: 32px 32px 28px;
  }
}

.detalle-body h2 {
  font-size: 24px;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1.3;
  margin-bottom: 20px;
}

@media (min-width: 640px) {
  .detalle-body h2 {
    font-size: 28px;
  }
}

/* Estilos para la descripción HTML del curso */
.detalle-descripcion {
  color: var(--gray-600);
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--gray-200);
}

.detalle-descripcion p {
  margin-bottom: 12px;
}

.detalle-descripcion p:last-child {
  margin-bottom: 0;
}

.detalle-descripcion ul,
.detalle-descripcion ol {
  margin: 12px 0;
  padding-left: 24px;
  list-style: disc;
}

.detalle-descripcion ol {
  list-style: decimal;
}

.detalle-descripcion li {
  margin-bottom: 6px;
  padding-left: 4px;
}

.detalle-descripcion strong {
  color: var(--gray-800);
  font-weight: 600;
}

.detalle-descripcion em {
  color: var(--gray-500);
  font-style: italic;
}

/* Grilla de info del curso */
.detalle-info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 28px;
}

@media (min-width: 480px) {
  .detalle-info-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.detalle-info-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  background: var(--gray-50);
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-100);
}

.detalle-info-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
}

.detalle-info-icon svg {
  width: 20px;
  height: 20px;
}

.detalle-info-item strong {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-400);
  margin-bottom: 4px;
}

.detalle-info-item span {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-800);
}

.detalle-footer {
  padding-top: 4px;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 15px;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 100%
  );
  color: var(--white);
  box-shadow: 0 4px 15px rgba(30, 58, 95, 0.35);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(30, 58, 95, 0.45);
}

.btn-accent {
  background: linear-gradient(
    135deg,
    var(--turquesa) 0%,
    var(--turquesa-dark) 100%
  );
  color: var(--white);
  box-shadow: 0 4px 15px rgba(0, 188, 212, 0.35);
}
.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 188, 212, 0.45);
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
}
.btn-secondary:hover {
  background: var(--gray-200);
}

.btn-block {
  width: 100%;
}
.btn-disabled,
.btn:disabled {
  background: var(--gray-200) !important;
  color: var(--gray-400) !important;
  cursor: not-allowed !important;
  transform: none !important;
  box-shadow: none !important;
}
.btn svg {
  width: 18px;
  height: 18px;
}

/* MODAL */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal.active {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--white);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.3s ease;
}

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

.modal-header {
  padding: 24px 24px 0;
  text-align: center;
}
.modal-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 8px;
}
.modal-header p {
  color: var(--primary);
  font-weight: 600;
  font-size: 15px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--gray-400);
  transition: all 0.2s;
  font-size: 20px;
  z-index: 10;
}
.modal-close:hover {
  background: var(--gray-100);
  color: var(--gray-700);
}

/* Botón cerrar sobre imagen (fondo semitransparente) */
.modal-detalle-content .modal-close {
  background: rgba(0, 0, 0, 0.4);
  color: var(--white);
}
.modal-detalle-content .modal-close:hover {
  background: rgba(0, 0, 0, 0.6);
  color: var(--white);
}

.modal-body {
  padding: 24px;
}

/* FORMS */
.form-group {
  margin-bottom: 20px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 480px) {
  .form-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

.form-label {
  display: block;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 8px;
  font-size: 14px;
}
.form-label .required {
  color: var(--danger);
}

.form-input,
.form-select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 15px;
  transition: all 0.2s;
  background: var(--white);
}
.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(30, 58, 95, 0.1);
}
.form-input.error,
.form-select.error {
  border-color: var(--danger);
}

.form-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 6px;
  display: none;
}
.form-error.show {
  display: block;
}
.form-hint {
  color: var(--gray-500);
  font-size: 13px;
  margin-top: 6px;
}

/* Radio buttons */
.radio-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.radio-label {
  flex: 1;
  min-width: 140px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  font-weight: 500;
}
.radio-label:hover {
  border-color: var(--primary-light);
}
.radio-input {
  display: none;
}
.radio-input:checked + .radio-label {
  border-color: var(--primary);
  background: rgba(30, 58, 95, 0.05);
  color: var(--primary);
}

.radio-custom {
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-300);
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
}
.radio-input:checked + .radio-label .radio-custom {
  border-color: var(--primary);
}
.radio-input:checked + .radio-label .radio-custom::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  background: var(--primary);
  border-radius: 50%;
}

/* Police fields */
.police-fields {
  display: none;
  background: linear-gradient(
    135deg,
    rgba(30, 58, 95, 0.03),
    rgba(30, 58, 95, 0.08)
  );
  border: 1px solid rgba(30, 58, 95, 0.15);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-top: 20px;
}
.police-fields.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

.police-fields-header {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(30, 58, 95, 0.15);
}
.police-fields-header svg {
  width: 22px;
  height: 22px;
}

/* Alert */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  margin-bottom: 20px;
}
.alert svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}
.alert-warning {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #92400e;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--gray-100);
}
.form-actions .btn {
  flex: 1;
}

/* CONTACT */
.section-alt {
  background: rgba(255, 255, 255, 0.85);
}

.section-alt .section-header h2 {
  color: var(--gray-900);
}
.section-alt .section-header p {
  color: var(--gray-500);
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 640px) {
  .contact-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 1024px) {
  .contact-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.contact-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-lg);
  transition: all 0.2s;
}
.contact-item:hover {
  background: rgba(255, 255, 255, 0.9);
}

.contact-icon {
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  flex-shrink: 0;
}
.contact-icon svg {
  width: 24px;
  height: 24px;
}
.contact-text strong {
  display: block;
  color: var(--gray-900);
  font-weight: 600;
  margin-bottom: 4px;
}
.contact-text span {
  color: var(--gray-500);
  font-size: 15px;
}

/* FOOTER */
.footer {
  background: rgba(0, 0, 0, 0.4);
  color: rgba(255, 255, 255, 0.6);
  padding: 40px 0;
  text-align: center;
}
.footer p {
  font-size: 14px;
}

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}
.empty-state svg {
  width: 80px;
  height: 80px;
  color: var(--gray-300);
  margin-bottom: 24px;
}
.empty-state h3 {
  font-size: 22px;
  color: var(--gray-700);
  margin-bottom: 8px;
}
.empty-state p {
  color: var(--gray-500);
}

/* LOADING */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.btn-loading {
  display: none;
  align-items: center;
  gap: 10px;
}
.btn.loading .btn-text {
  display: none;
}
.btn.loading .btn-loading {
  display: flex;
}

.hidden {
  display: none !important;
}
