/* CropShare PWA — Custom Styles */

/* Password wall shake animation */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}
.shake { animation: shake 0.5s ease-in-out; }

/* Screen transitions */
.screen-enter {
  animation: fadeSlideIn 0.3s ease-out forwards;
}
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* QR scanner viewfinder */
#qr-reader {
  border-radius: 12px;
  overflow: hidden;
}
#qr-reader video {
  border-radius: 12px;
}
#qr-reader__scan_region {
  border-radius: 8px;
}

/* Star rating */
.star-rating button {
  transition: transform 0.1s ease;
}
.star-rating button:hover {
  transform: scale(1.2);
}
.star-rating button:active {
  transform: scale(0.95);
}

/* Card hover effect */
.flow-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.flow-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

/* Loading spinner */
.spinner {
  border: 3px solid rgba(46, 91, 42, 0.1);
  border-top-color: #4A9CA8;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Progress bar fill animation */
.progress-fill {
  transition: width 0.8s ease-out;
}

/* Tooltip */
.tooltip {
  position: relative;
}
.tooltip .tooltip-text {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #1A2B1A;
  color: #F0F5F0;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  transition: opacity 0.2s;
  z-index: 50;
}
.tooltip:hover .tooltip-text,
.tooltip:focus .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #F0F5F0; }
::-webkit-scrollbar-thumb { background: #8A9B8A; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #5A6B5A; }

/* ── Behind the Scenes Panel ──────────────────────────────── */

.debug-panel {
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.5);
}

.debug-log-scroll::-webkit-scrollbar { width: 4px; }
.debug-log-scroll::-webkit-scrollbar-track { background: transparent; }
.debug-log-scroll::-webkit-scrollbar-thumb { background: #334155; border-radius: 2px; }

.debug-entry {
  border-left: 2px solid transparent;
  transition: border-color 0.15s, background-color 0.15s;
}
.debug-entry:hover {
  border-left-color: #475569;
}

/* ── Revocation Alert Pulse ─────────────────────────────── */

@keyframes alertPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
.alert-pulse {
  animation: alertPulse 2s ease-in-out infinite;
}

/* ── Tier Comparison ────────────────────────────────────── */

.tier-card {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.tier-card:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

/* Revocation toggle switch */
.revoke-toggle {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 11px;
  transition: background-color 0.2s;
  cursor: pointer;
  border: none;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
}
.revoke-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  transition: transform 0.2s;
}
.revoke-toggle.active::after {
  transform: translateX(18px);
}

/* ── Credential Report View ───────────────────────────────── */

.report-header {
  position: relative;
  overflow: hidden;
}
.report-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #4A9CA8, #2E5B2A, #D4A017);
  border-radius: 12px 12px 0 0;
}

.report-section {
  animation: reportFadeIn 0.2s ease-out;
}

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

.report-field {
  transition: background-color 0.15s ease;
}
.report-field:hover {
  background-color: rgba(74, 156, 168, 0.05);
}

/* ── Motion Design System ────────────────────────────────── */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutRight {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(16px); }
}

@keyframes checkmarkAppear {
  from { opacity: 0; transform: scale(0.3) rotate(-90deg); }
  to { opacity: 1; transform: scale(1) rotate(0deg); }
}

@keyframes pulseBadge {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7); }
  50% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
}

/* Expand/collapse transition (Tailwind doesn't provide this) */
.transition-expand {
  transition: max-height 300ms ease-out, opacity 300ms ease-out, padding 300ms ease-out;
}

/* ── Accessibility ─────────────────────────────────────── */

/* Skip link — visible only on focus */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  z-index: 9999;
  padding: 8px 16px;
  background: #2E5B2A;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  border-radius: 0 0 8px 0;
}
.skip-link:focus {
  top: 0;
}

/* Trust ring SVG stroke animation */
.trust-ring-stroke {
  transition: stroke-dasharray 0.8s ease-out;
}

/* Minimum 44px touch target for mobile (WCAG 2.5.5) */
.touch-target {
  min-height: 44px;
  min-width: 44px;
}

/* Visible focus styles for keyboard navigation */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid #4A9CA8;
  outline-offset: 2px;
}
