/* ---------------------------------------------------------------------------
   Base
   --------------------------------------------------------------------------- */

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

body {
  font-family: 'Amazon Ember', Arial, sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.5;
}

/* ---------------------------------------------------------------------------
   Header
   --------------------------------------------------------------------------- */

header {
  background: #232f3e;
  color: #fff;
  padding: 0 24px;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

header h1 {
  font-size: 18px;
  font-weight: 600;
}

header nav a {
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  opacity: 0.85;
}

header nav a:hover {
  opacity: 1;
}

/* ---------------------------------------------------------------------------
   Main
   --------------------------------------------------------------------------- */

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

/* ---------------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------------- */

footer {
  text-align: center;
  padding: 24px;
  color: #888;
  font-size: 13px;
}

/* ---------------------------------------------------------------------------
   List header + filter
   --------------------------------------------------------------------------- */

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.list-header h2 {
  font-size: 20px;
}

.filter-bar {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.filter-bar select {
  padding: 6px 10px;
  border: 1px solid #d5d9d9;
  border-radius: 4px;
}

/* ---------------------------------------------------------------------------
   Table
   --------------------------------------------------------------------------- */

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

thead th {
  background: #f0f0f0;
  font-weight: 600;
  padding: 12px 16px;
  text-align: left;
  font-size: 13px;
  color: #555;
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid #e0e0e0;
  font-size: 14px;
  vertical-align: top;
}

tbody tr:last-child td {
  border-bottom: none;
}
tbody tr:hover {
  background: #fafafa;
}

.target-summary {
  color: #666;
}

.actions {
  white-space: nowrap;
}
.actions .btn {
  margin-right: 4px;
}

/* ---------------------------------------------------------------------------
   Badges
   --------------------------------------------------------------------------- */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-active {
  background: #e6f4ea;
  color: #1e7e34;
}
.badge-draft {
  background: #fff8e1;
  color: #f57f17;
}
.badge-inactive {
  background: #f5f5f5;
  color: #666;
}
.badge-expired {
  background: #fde7e7;
  color: #c62828;
}

/* ---------------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------------- */

.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  border: none;
  font-size: 14px;
  text-decoration: none;
  text-align: center;
  transition: opacity 0.15s;
}

.btn:hover {
  opacity: 0.85;
}

.btn-primary {
  background: #ff9900;
  color: #fff;
}
.btn-secondary {
  background: #e0e0e0;
  color: #333;
}
.btn-danger {
  background: #d32f2f;
  color: #fff;
}
.btn-cancel {
  background: transparent;
  color: #666;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* ---------------------------------------------------------------------------
   Form
   --------------------------------------------------------------------------- */

.form-container {
  background: #fff;
  padding: 24px;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.form-container h2 {
  margin-bottom: 20px;
}

fieldset {
  border: none;
  border-radius: 2rem 2rem 2rem 2rem;
  background-color: #fafafa;
  margin-top: 0;
  margin-bottom: 20px;
  padding-left: 2rem;
  padding-right: 2rem;
  padding-top: 1.2rem;
  padding-bottom: 1.6rem;
}

legend {
  font-weight: 600;
  font-size: 20px;
  padding-top: 50px;
  color: #232f3e;
}

label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
  margin-top: 12px;
}

label:first-of-type {
  margin-top: 8px;
}

input[type='text'],
input[type='number'],
input[type='datetime-local'],
textarea,
select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d5d9d9;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
}

textarea {
  resize: vertical;
}

input:disabled {
  background: #f0f0f0;
  color: #999;
  cursor: not-allowed;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: normal;
  margin-top: 12px;
  cursor: pointer;
}

.checkbox-label input[type='checkbox'] {
  width: auto;
}

.required {
  color: #d32f2f;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

/* ---------------------------------------------------------------------------
   Question blocks
   --------------------------------------------------------------------------- */

.question-block {
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 12px;
  background: #fafafa;
}

.question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

/* ---------------------------------------------------------------------------
   Stats bar
   --------------------------------------------------------------------------- */

.stats-bar {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
}

.stat {
  background: #fff;
  padding: 16px 24px;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: #232f3e;
}
.stat-label {
  display: block;
  font-size: 13px;
  color: #666;
  margin-top: 4px;
}

/* ---------------------------------------------------------------------------
   Response breakdown
   --------------------------------------------------------------------------- */

.question-summary {
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  margin-bottom: 16px;
}

.question-summary h3 {
  font-size: 15px;
  margin-bottom: 4px;
}
.question-type {
  color: #888;
  font-size: 12px;
}

.avg-rating {
  margin: 12px 0 8px;
}

.rating-distribution,
.choice-distribution {
  margin-top: 8px;
}

.rating-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 13px;
}

.rating-row span:first-child {
  width: 100px;
  text-align: right;
}
.rating-row span:last-child {
  width: 60px;
}

.bar-bg {
  flex: 1;
  height: 16px;
  background: #f0f0f0;
  border-radius: 8px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: #ff9900;
  border-radius: 8px;
  transition: width 0.3s;
}

.open-text-responses {
  margin-top: 12px;
}

.open-text-item {
  padding: 10px 14px;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  margin-bottom: 8px;
  font-size: 14px;
  background: #fafafa;
}

/* ---------------------------------------------------------------------------
   States
   --------------------------------------------------------------------------- */

.loading {
  color: #888;
  padding: 40px 0;
  text-align: center;
}
.empty-state {
  color: #888;
  padding: 24px 0;
  text-align: center;
}
.error {
  color: #d32f2f;
  padding: 24px 0;
  text-align: center;
}

/* ---------------------------------------------------------------------------
   Toast
   --------------------------------------------------------------------------- */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  z-index: 10000;
  animation: slideIn 0.3s ease-out;
}

.toast-success {
  background: #1e7e34;
}
.toast-error {
  background: #d32f2f;
}

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