/* Grade Badges */
.grade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 600;
}

.grade-badge.large {
  width: 40px;
  height: 40px;
  font-size: 16px;
}

.grade-A { background: var(--grade-a-bg); color: var(--grade-a-text); }
.grade-B { background: var(--grade-b-bg); color: var(--grade-b-text); }
.grade-C { background: var(--grade-c-bg); color: var(--grade-c-text); }
.grade-D { background: var(--grade-d-bg); color: var(--grade-d-text); }
.grade-F { background: var(--grade-f-bg); color: var(--grade-f-text); }

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
}

.status-draft {
  background: #F1F3F5;
  color: #495057;
}

.status-published {
  background: var(--success-green-light);
  color: var(--success-green);
}

.status-running {
  background: var(--primary-blue-light);
  color: var(--primary-blue);
}

.status-running::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1s ease-in-out infinite;
}

/* Filter Pills */
.filter-pills {
  display: flex;
  gap: 8px;
}

.filter-pill {
  height: 28px;
  padding: 0 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--page-bg);
  color: var(--muted-text);
  cursor: pointer;
  transition: all 120ms ease;
}

.filter-pill:hover {
  border-color: var(--primary-blue);
}

.filter-pill.active {
  background: var(--primary-blue);
  color: white;
  border-color: var(--primary-blue);
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.data-table thead {
  background: var(--page-bg);
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted-text);
  border-bottom: 1px solid var(--border);
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 100ms ease;
}

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

.data-table tbody tr:hover {
  background: #F8FAFC;
  cursor: pointer;
}

.data-table td {
  padding: 16px;
  font-size: 14px;
}

/* Pillar Bars */
.pillar-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pillar-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pillar-label {
  font-size: 10px;
  color: var(--muted-text);
  width: 28px;
}

.pillar-bar-track {
  flex: 1;
  height: 3px;
  background: rgba(205, 218, 234, 0.4);
  border-radius: 2px;
  overflow: hidden;
}

.pillar-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 600ms ease-out;
}

.pillar-bar-fill.organic { background: var(--pillar-organic); }
.pillar-bar-fill.website { background: var(--pillar-website); }
.pillar-bar-fill.market { background: var(--pillar-market); }

.pillar-value {
  font-size: 10px;
  font-weight: 600;
  color: var(--body-text);
  width: 28px;
  text-align: right;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
}

.toast {
  width: 300px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  animation: slideUp 250ms ease-out;
}

.toast.dismissing {
  animation: slideDown 200ms ease-in forwards;
}

.toast-accent {
  width: 4px;
  height: 100%;
  border-radius: 2px;
  position: absolute;
  left: 0;
  top: 0;
}

.toast.success .toast-accent { background: var(--success-green); }
.toast.error .toast-accent { background: var(--danger-red); }
.toast.info .toast-accent { background: var(--primary-blue); }

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast-content {
  flex: 1;
  font-size: 13px;
  color: var(--body-text);
}

.toast-close {
  width: 16px;
  height: 16px;
  cursor: pointer;
  color: var(--muted-text);
  transition: color 120ms ease;
}

.toast-close:hover {
  color: var(--body-text);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 150ms ease-out;
}

.modal-overlay.dismissing {
  animation: fadeOut 150ms ease-in forwards;
}

.modal-card {
  background: white;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 24px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUpModal 250ms ease-out;
}

.modal-card.dismissing {
  animation: slideDownModal 200ms ease-in forwards;
}

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

.modal-title {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  width: 24px;
  height: 24px;
  cursor: pointer;
  color: var(--muted-text);
  transition: color 120ms ease;
}

.modal-close:hover {
  color: var(--body-text);
}

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary-blue);
  border-radius: 8px;
  transition: width 400ms ease-out;
}

/* Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner.large {
  width: 24px;
  height: 24px;
  border-width: 3px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  color: var(--border);
}

.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--body-text);
  margin-bottom: 8px;
}

.empty-state-text {
  font-size: 14px;
  color: var(--muted-text);
  margin-bottom: 20px;
}

/* Floating Labels */
.form-field {
  position: relative;
  margin-bottom: 20px;
}

.form-field input,
.form-field textarea {
  width: 100%;
  padding: 12px;
  padding-top: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.form-field label {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--muted-text);
  pointer-events: none;
  transition: all 200ms ease-out;
}

.form-field input:focus + label,
.form-field input:not(:placeholder-shown) + label,
.form-field textarea:focus + label,
.form-field textarea:not(:placeholder-shown) + label,
.form-field.has-value label {
  top: 8px;
  font-size: 11px;
  transform: translateY(0);
  color: var(--primary-blue);
}

.form-field input:focus,
.form-field textarea:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(7, 82, 130, 0.2);
}

/* Drag-and-Drop Bullets */
.bullets-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bullet-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--page-bg);
  border-radius: 6px;
  cursor: move;
  transition: all 150ms ease;
}

.bullet-item:hover {
  background: #E8F1F8;
}

.bullet-item.dragging {
  opacity: 0.5;
}

.bullet-item.drag-over {
  border-top: 2px solid var(--primary-blue);
}

.drag-handle {
  width: 16px;
  height: 16px;
  color: var(--muted-text);
  cursor: grab;
  flex-shrink: 0;
}

.drag-handle:active {
  cursor: grabbing;
}

.bullet-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary-blue);
  flex-shrink: 0;
}

.bullet-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  padding: 4px;
}

.bullet-input:focus {
  outline: none;
  background: white;
  border-radius: 4px;
}

.bullet-remove {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--muted-text);
  cursor: pointer;
  display: none;
  transition: all 120ms ease;
}

.bullet-item:hover .bullet-remove {
  display: flex;
  align-items: center;
  justify-content: center;
}

.bullet-remove:hover {
  background: var(--danger-red-light);
  color: var(--danger-red);
}

/* Action Steps */
.action-step-card {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 16px;
  padding: 20px;
  background: var(--page-bg);
  border-radius: 8px;
  margin-bottom: 12px;
}

.step-number-large {
  font-size: 32px;
  font-weight: 600;
  color: var(--muted-text);
  opacity: 0.3;
}

.step-content-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Insight Cards */
.insight-card-item {
  background: var(--page-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
  position: relative;
  transition: all 150ms ease;
}

.insight-card-item:hover {
  border-color: var(--primary-blue);
  box-shadow: 0 2px 8px rgba(7, 82, 130, 0.1);
}

.insight-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.insight-card-type {
  flex-shrink: 0;
  width: 120px;
}

.insight-card-type select {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  background: white;
  cursor: pointer;
}

.insight-card-type select option[value="critical"] {
  color: var(--danger-red);
}

.insight-card-type select option[value="warning"] {
  color: var(--accent-orange);
}

.insight-card-type select option[value="opportunity"] {
  color: var(--success-green);
}

.insight-card-type select option[value="blue"] {
  color: var(--primary-blue);
}

.insight-card-remove {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--muted-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 120ms ease;
  flex-shrink: 0;
}

.insight-card-remove:hover {
  background: var(--danger-red-light);
  color: var(--danger-red);
}

.insight-card-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.insight-card-fields input,
.insight-card-fields textarea {
  width: 100%;
}

.insight-card-fields input {
  font-weight: 600;
  font-size: 14px;
}

.insight-card-fields textarea {
  min-height: 80px;
  font-size: 13px;
  line-height: 1.6;
}

.insight-cards-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted-text);
  font-size: 13px;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border);
  transition: 150ms;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 150ms;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--primary-blue);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* Page Loading Bar */
.page-loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--primary-blue);
  z-index: 9999;
  transition: width 300ms ease-out, opacity 200ms ease-in;
  opacity: 1;
}

.page-loading-bar.complete {
  width: 100% !important;
  opacity: 0;
}

/* Confirm Dialog */
.confirm-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 360px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  z-index: 1001;
  animation: fadeIn 150ms ease-out;
}

.confirm-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--body-text);
  margin-bottom: 12px;
}

.confirm-message {
  font-size: 14px;
  color: var(--muted-text);
  line-height: 1.6;
  margin-bottom: 24px;
}

.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.confirm-actions button {
  min-width: 80px;
}

/* Skeleton Loading */
.skeleton {
  background: #F1F3F5;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.skeleton::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
  animation: shimmer 1.4s infinite;
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
}

.skeleton-text.large {
  height: 20px;
}

.skeleton-circle {
  border-radius: 50%;
}
