/* ─── AT6 Feedback System – CSS Style Sheet ─── */

:root {
  --bg-primary: #070709;
  --bg-secondary: #0f0f13;
  --bg-card: #14141a;
  
  --text-primary: #ffffff;
  --text-secondary: #8e8e9f;
  --text-muted: #5a5a6a;
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(255, 255, 255, 0.25);
  
  --accent-primary: #ffffff;
  --accent-secondary: rgba(255, 255, 255, 0.1);
  --accent-danger: #ff5252;
  --accent-warning: #ffd740;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition-normal: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: all 0.15s ease;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* ─── Background Orbs & Effects ─────────────────────────────────────────── */
.decorations {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.15;
  will-change: transform;
}

.orb-1 {
  width: 40vw;
  height: 40vw;
  background: radial-gradient(circle, #8a2be2 0%, transparent 80%);
  top: -10vw;
  left: -10vw;
  animation: orbFloat 25s infinite alternate ease-in-out;
}

.orb-2 {
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, #00ffff 0%, transparent 80%);
  bottom: -15vw;
  right: -10vw;
  animation: orbFloat 30s infinite alternate-reverse ease-in-out;
}

@keyframes orbFloat {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(5vw, 8vw) scale(1.1); }
  100% { transform: translate(-2vw, -4vw) scale(0.95); }
}

/* ─── Main App Layout ─────────────────────────────────────────────────────── */
.app-layout {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 540px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.app-header {
  margin-bottom: 36px;
  text-align: center;
}

/* Header logo title animation */
.logo-text {
  display: inline-block;
  font-size: 2.8rem;
  font-weight: 900;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  will-change: transform, opacity, filter, letter-spacing, text-shadow;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  animation: logoReveal 1.6s cubic-bezier(0.25, 1.25, 0.4, 1) forwards;
}

@keyframes logoReveal {
  0% {
    opacity: 0;
    transform: perspective(800px) rotateX(-90deg) rotateY(-10deg) scale(0.3) translateY(-80px) translateZ(-150px);
    letter-spacing: -0.15em;
    filter: blur(12px) brightness(3);
    text-shadow: 0 0 0px rgba(255, 255, 255, 0);
  }
  35% {
    opacity: 0.9;
    filter: blur(4px) brightness(2);
  }
  100% {
    opacity: 1;
    transform: perspective(800px) rotateX(0deg) rotateY(0deg) scale(1) translateY(0) translateZ(0);
    letter-spacing: 0.15em;
    filter: blur(0) brightness(1);
    text-shadow: 
      0 0 15px rgba(255, 255, 255, 0.5),
      0 0 35px rgba(255, 255, 255, 0.25);
  }
}

.main-content {
  width: 100%;
}

/* ─── Feedback Card Container ────────────────────────────────────────────── */
.feedback-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0; /* Padding is handled by absolute panes to ensure exact measurements */
  width: 100%;
  box-shadow: 
    0 30px 60px rgba(0, 0, 0, 0.6), 
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
  position: relative;
  transition: height 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: height;
}

/* ─── Step Transitions ──────────────────────────────────────────────────── */
.step-pane {
  position: absolute;
  top: 44px;
  left: 36px;
  width: calc(100% - 72px); /* 36px left + 36px right = 72px padding */
  opacity: 0;
  pointer-events: none;
  transform: translateX(60px);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.5s ease;
  will-change: transform, opacity;
}

.step-pane.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.step-pane.left-out {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-60px);
}

/* ─── Text / Typography Elements ────────────────────────────────────────── */
h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.4;
  color: #ffffff;
}

.step-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.intro-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
  text-align: center;
  margin-bottom: 36px;
}

/* ─── Buttons & Actions ─────────────────────────────────────────────────── */
.btn-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.btn-primary {
  background: var(--text-primary);
  color: var(--bg-primary);
  border: 1px solid var(--text-primary);
  padding: 12px 28px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.12);
  transition: var(--transition-normal);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover {
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.22);
  transform: translateY(-2px);
}

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

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-normal);
}

.btn-secondary:hover {
  color: var(--text-primary);
  border-color: var(--border-active);
  background: rgba(255, 255, 255, 0.02);
  transform: translateY(-1px);
}

.step-actions {
  display: flex;
  gap: 12px;
  margin-top: 36px;
}

.step-actions button {
  flex: 1;
}

/* Start Button delay fade */
#start-btn.hidden {
  opacity: 0;
  transform: scale(0.9) translateY(10px);
  pointer-events: none;
}

#start-btn.visible {
  opacity: 1;
  transform: scale(1) translateY(0);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

#start-btn.disabled-btn {
  background: #202025 !important;
  color: var(--text-muted) !important;
  border-color: #202025 !important;
  box-shadow: none !important;
  cursor: not-allowed;
}

/* ─── Rate Limit Banner ─────────────────────────────────────────────────── */
.limit-status-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
  transition: var(--transition-normal);
}

.limit-status-box.limited {
  border-color: rgba(239, 83, 80, 0.25);
  background: rgba(239, 83, 80, 0.04);
  color: #ef5350;
}

.limit-status-box.limited .limit-dot {
  background-color: #ef5350;
  box-shadow: 0 0 10px #ef5350;
}

.limit-dot {
  width: 8px;
  height: 8px;
  background-color: #4caf50;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 10px #4caf50;
}

/* ─── Category Choice Grid (Step 1) ──────────────────────────────────────── */
.category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.cat-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 12px;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-normal);
  text-align: center;
}

.cat-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-active);
  background: rgba(255, 255, 255, 0.04);
  transform: translateY(-2px);
}

.cat-btn.selected {
  border-color: var(--text-primary);
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.08);
}

/* ─── Input Fields & Counter Styling ──────────────────────────────────────── */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
  text-align: left;
}

.input-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.input-container, .textarea-container {
  position: relative;
  width: 100%;
}

.input-group input[type="text"], 
.input-group textarea {
  width: 100%;
  background: #141418;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition-normal);
}

.input-group input[type="text"]:focus, 
.input-group textarea:focus {
  border-color: var(--border-active);
  background: #18181e;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.04);
}

.char-counter {
  position: absolute;
  right: 12px;
  bottom: 12px;
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.input-container .char-counter {
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
}

.input-container input {
  padding-right: 60px !important;
}

.textarea-container textarea {
  padding-bottom: 32px !important;
}

.fade-in {
  animation: fadeIn 0.4s ease forwards;
}

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

/* ─── Priority Selector (Step 2) ────────────────────────────────────────── */
.priority-selector {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.priority-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  color: var(--text-secondary);
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition-normal);
  display: flex;
  align-items: center;
  text-align: left;
}

.priority-btn:hover {
  border-color: var(--border-active);
  background: rgba(255, 255, 255, 0.04);
  transform: translateX(4px);
}

.priority-btn.selected {
  border-color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.08);
}

.priority-num {
  font-size: 1.4rem;
  font-weight: 900;
  width: 32px;
  color: var(--text-muted);
  transition: var(--transition-normal);
}

.priority-btn:hover .priority-num,
.priority-btn.selected .priority-num {
  color: #ffffff;
}

.priority-label {
  font-weight: 700;
  font-size: 0.95rem;
  margin-right: 12px;
}

.priority-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-grow: 1;
}

.priority-btn.selected[data-priority="1"] .priority-num { color: #4caf50; }
.priority-btn.selected[data-priority="2"] .priority-num { color: #ffd740; }
.priority-btn.selected[data-priority="3"] .priority-num { color: #ef5350; }

/* ─── Success Pane (Step 4) ──────────────────────────────────────────────── */
#step-4 {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.success-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(76, 175, 80, 0.06);
  border: 1px solid rgba(76, 175, 80, 0.2);
  color: #4caf50;
  margin-bottom: 24px;
}

/* ─── Error Message Display ─────────────────────────────────────────────── */
.error-msg {
  color: #ef5350;
  font-size: 0.8rem;
  margin-top: 14px;
  text-align: center;
  background: rgba(239, 83, 80, 0.06);
  border: 1px solid rgba(239, 83, 80, 0.15);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* ─── Legal Footer & Modals ─────────────────────────────────────────────── */
.app-footer {
  margin-top: 36px;
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
  align-items: center;
}

.app-footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition-fast);
}

.app-footer a:hover {
  color: var(--text-secondary);
}

.sep {
  color: var(--border-subtle);
  user-select: none;
}

/* Modal styling matching CLIP! */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 5, 8, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 24px;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: #0f0f13;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 36px 32px;
  max-width: 480px;
  width: 100%;
  text-align: left;
  box-shadow: 
    0 30px 60px rgba(0, 0, 0, 0.6), 
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: modalAppear 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: transform, opacity;
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}

@keyframes modalAppear {
  0% {
    opacity: 0;
    transform: translateY(25px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal h2 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 20px;
  color: #ffffff;
  background: linear-gradient(135deg, #ffffff 40%, #b2b2c2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  flex-shrink: 0;
}

.modal-body {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  overflow-y: auto;
  margin-bottom: 28px;
  padding-right: 8px;
}

.modal-body p {
  margin-bottom: 16px;
}

.modal-body strong {
  color: #ffffff;
}

.modal-body code {
  font-family: monospace;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 2px 5px;
  border-radius: 4px;
  color: #ffffff;
}

.link-highlight {
  color: #ffffff;
  text-decoration: underline;
  transition: var(--transition-fast);
}

.link-highlight:hover {
  opacity: 0.8;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
}

.modal-actions button {
  width: 100%;
}

/* Custom Scrollbar for Modal Body */
.scrollable::-webkit-scrollbar {
  width: 5px;
}

.scrollable::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}

.scrollable::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.scrollable::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Spinner for Loading states */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-left-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 480px) {
  .feedback-container {
    padding: 32px 24px;
  }
  .category-grid {
    grid-template-columns: 1fr;
  }
}
