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

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
  color: #333;
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.header {
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  color: white;
  padding: 40px;
  text-align: center;
}

.logo-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
}

.logo-img {
  height: 100px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
}

.logo-section h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: center;
}

.title {
  font-size: 20px;
  font-weight: 600;
  margin: 30px 0 20px;
  line-height: 1.4;
}

.intro-text {
  font-size: 14px;
  margin: 15px 0;
  opacity: 0.95;
  text-align: justify;
}

.questionnaire-form {
  padding: 40px;
}

.form-section {
  margin-bottom: 40px;
  padding: 30px;
  background: #f8f9fa;
  border-radius: 15px;
  border-left: 5px solid #667eea;
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  color: #1e3c72;
  margin-bottom: 25px;
  padding-bottom: 10px;
  border-bottom: 2px solid #667eea;
}

.subsection-title {
  font-size: 18px;
  font-weight: 600;
  color: #2a5298;
  margin: 20px 0 15px;
  padding-bottom: 8px;
  border-bottom: 1px solid #667eea;
}

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

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: #333;
  font-size: 15px;
}

.required {
  color: #e74c3c;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 15px;
  transition: all 0.3s ease;
  font-family: inherit;
  background-color: white;
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="date"]:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  padding-right: 40px;
}

.form-group select option {
  padding: 10px;
}

.instructions {
  background: white;
  padding: 20px;
  border-radius: 10px;
  margin-top: 15px;
}

.instructions p {
  margin-bottom: 20px;
  font-weight: 600;
  color: #555;
}

.rating-scale {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

.scale-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 8px;
  font-weight: 600;
}

.scale-number {
  background: white;
  color: #667eea;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
}

.table-container {
  overflow-x: auto;
  margin-top: 20px;
  background: white;
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

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

/* Special styling for potensi table with before/after columns */
.potensi-table {
  table-layout: fixed;
}

/* Ensure both header groups (Sebelum and Sesudah) have equal width */
.potensi-table thead tr:first-child th.col-header-group {
  width: 20% !important;
  box-sizing: border-box;
  text-align: center;
  font-weight: 700;
  color: white;
  padding: 15px 10px;
}

/* Background colors for before/after headers with better contrast */
.potensi-table thead tr:first-child th.col-header-sebelum {
  background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%) !important;
  color: white !important;
}

.potensi-table thead tr:first-child th.col-header-sesudah {
  background: linear-gradient(135deg, #2d5016 0%, #22543d 100%) !important;
  color: white !important;
}

.rating-table thead {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.rating-table th {
  padding: 15px 10px;
  text-align: center;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.col-no {
  width: 5%;
}

.col-statement {
  width: 55%;
  text-align: left !important;
  padding-left: 15px !important;
}

.col-rating {
  width: 10%;
}

.rating-table tbody tr {
  transition: background-color 0.2s ease;
}

.rating-table tbody tr:hover {
  background-color: #f0f4ff;
}

.rating-table tbody td {
  padding: 15px 10px;
  border: 1px solid #e0e0e0;
  text-align: center;
  vertical-align: middle;
}

.rating-table tbody td:first-child {
  font-weight: 600;
  color: #667eea;
  background: #f8f9fa;
}

.rating-table tbody td:nth-child(2) {
  text-align: left;
  padding-left: 15px;
  color: #555;
}

.rating-table input[type="radio"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: #667eea;
  transition: transform 0.2s ease;
}

.rating-table input[type="radio"]:hover {
  transform: scale(1.2);
}

.signature-section {
  background: white;
  padding: 20px;
  border-radius: 10px;
}

.signature-container {
  border: 2px dashed #ddd;
  border-radius: 10px;
  padding: 15px;
  background: #fafafa;
}

#signatureCanvas {
  border: 1px solid #ddd;
  border-radius: 8px;
  background: white;
  cursor: crosshair;
  display: block;
  width: 100%;
  max-width: 400px;
  height: auto;
}

.signature-buttons {
  margin-top: 10px;
}

.form-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 40px;
  padding-top: 30px;
  border-top: 2px solid #e0e0e0;
}

.btn {
  padding: 15px 40px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

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

.btn-secondary {
  background: #6c757d;
  color: white;
  box-shadow: 0 4px 15px rgba(108, 117, 125, 0.4);
}

.btn-secondary:hover {
  background: #5a6268;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(108, 117, 125, 0.6);
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
}

.modal-content {
  background-color: white;
  margin: 15% auto;
  padding: 40px;
  border-radius: 20px;
  max-width: 500px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease;
}

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

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 20px;
}

.close:hover {
  color: #000;
}

.modal-content h2 {
  color: #667eea;
  margin-bottom: 20px;
}

.modal-content p {
  margin-bottom: 30px;
  color: #555;
  font-size: 16px;
}

/* Responsive Design */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  .header {
    padding: 25px 20px;
  }

  .logo-section h1 {
    font-size: 18px;
  }

  .title {
    font-size: 16px;
  }

  .questionnaire-form {
    padding: 20px;
  }

  .form-section {
    padding: 20px;
  }

  .rating-scale {
    grid-template-columns: 1fr;
  }

  .table-container {
    font-size: 12px;
  }

  .rating-table th,
  .rating-table td {
    padding: 10px 5px;
  }

  .col-statement {
    width: 50%;
  }

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

  .btn {
    width: 100%;
  }

  #signatureCanvas {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .rating-table {
    font-size: 11px;
  }

  .rating-table th,
  .rating-table td {
    padding: 8px 3px;
  }

  .rating-table input[type="radio"] {
    width: 16px;
    height: 16px;
  }
}

/* Print Styles */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .container {
        box-shadow: none;
        border-radius: 0;
    }

    .header {
        background: #1e3c72;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .form-actions,
    .signature-buttons {
        display: none;
    }

    .form-section {
        page-break-inside: avoid;
    }
}

/* Selection Page Styles */
.selection-page {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
}

.selection-container {
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.selection-card {
  display: flex;
  align-items: center;
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 15px;
  padding: 25px;
  text-decoration: none;
  color: #333;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  overflow: hidden;
}

.selection-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  border-color: #667eea;
}

.selection-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 100%;
  background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
  opacity: 0.7;
  transition: width 0.3s ease;
}

.selection-card:hover::before {
  width: 6px; /* Keep thin strip or expand if desired, I prefer keeping it thin but clearer opacity */
  opacity: 1;
}

.card-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: bold;
  margin-right: 25px;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
}

.card-content {
  flex: 1;
}

.card-content h3 {
  margin: 0 0 8px;
  color: #1e3c72;
  font-size: 18px;
}

.card-content p {
  margin: 0;
  color: #666;
  font-size: 14px;
  line-height: 1.5;
}

.card-arrow {
  font-size: 24px;
  color: #cbd5e0;
  margin-left: 20px;
  transition: all 0.3s ease;
}

.selection-card:hover .card-arrow {
  color: #667eea;
  transform: translateX(5px);
}

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

  .selection-card {
    padding: 20px;
    flex-direction: column;
    text-align: center;
  }

  .card-icon {
    margin: 0 0 15px 0;
  }

  .card-arrow {
    display: none;
  }
}
