/* App-specific styles — builds on top of theme.css */

/* === APP LAYOUT === */
.app-main { min-height: calc(100vh - 60px - 120px); }
.page-container { max-width: var(--max-w); margin: 0 auto; padding: 48px 24px; }
.page-narrow { max-width: 680px; }

.page-title {
  font-size: clamp(24px, 3.5vw, 36px);
  font-weight: 700;
  letter-spacing: -0.8px;
  margin-bottom: 8px;
}
.page-sub { font-size: 15px; color: var(--text-secondary); }

/* === NAVBAR APP LINKS === */
.navbar-links .btn-nav {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  background: var(--amber);
  color: #000;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.15s;
}
.navbar-links .btn-nav:hover { opacity: 0.88; color: #000; }
.navbar-links a.active { color: var(--amber); }

/* === BACK LINK === */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  margin-bottom: 24px;
  transition: color 0.15s;
}
.back-link:hover { color: var(--text-primary); }

/* === BOARD HEADER === */
.board-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 40px;
  gap: 16px;
}

/* === TASK GRID === */
.task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.task-card-link { text-decoration: none; color: inherit; display: block; }
.task-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color 0.15s, background 0.15s;
  height: 100%;
}
.task-card:hover { border-color: var(--border-light); background: var(--bg-card-hover); }
.task-desc { font-size: 14px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 16px; }
.bid-cta { font-size: 12px; font-weight: 600; color: var(--amber); }

/* Task badge variants */
.badge-open         { background: var(--amber-dim); color: var(--amber); }
.badge-in-progress  { background: rgba(59,130,246,0.12); color: #60A5FA; }
.badge-delivered    { background: rgba(139,92,246,0.12); color: #A78BFA; }
.badge-completed    { background: var(--green-dim); color: var(--green); }
.badge-revision     { background: rgba(249,115,22,0.12); color: #FB923C; }
.badge-closed       { background: rgba(161,161,170,0.1); color: var(--text-muted); }

/* === RESULT CARD === */
.result-card {
  background: var(--bg-card);
  border: 1px solid rgba(139,92,246,0.25);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}
.result-card-pending {
  border-color: rgba(59,130,246,0.25);
}
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: rgba(139,92,246,0.06);
  border-bottom: 1px solid rgba(139,92,246,0.15);
}
.result-card-pending .result-header {
  background: rgba(59,130,246,0.06);
  border-bottom-color: rgba(59,130,246,0.15);
}
.result-header-left { display: flex; align-items: center; gap: 10px; }
.result-icon { color: #A78BFA; display: flex; align-items: center; }
.result-card-pending .result-icon { color: #60A5FA; }
.result-label { font-size: 13px; font-weight: 600; color: #A78BFA; }
.result-card-pending .result-label { color: #60A5FA; }
.result-version { font-size: 12px; color: var(--text-muted); }
.result-date { font-size: 12px; color: var(--text-muted); }
.result-body { padding: 24px 20px; }
.result-para { font-size: 15px; color: var(--text-secondary); line-height: 1.8; margin: 0 0 12px; }
.result-para-muted { font-size: 14px; color: var(--text-muted); line-height: 1.7; margin: 0 0 16px; }
.result-h2 { font-size: 18px; font-weight: 700; color: var(--text-primary); margin: 20px 0 10px; letter-spacing: -0.3px; }
.result-h3 { font-size: 15px; font-weight: 600; color: var(--text-primary); margin: 16px 0 8px; }
.result-h4 { font-size: 14px; font-weight: 600; color: var(--text-secondary); margin: 12px 0 6px; }
.result-list { padding-left: 20px; margin: 8px 0; }
.result-list li { font-size: 14px; color: var(--text-secondary); line-height: 1.7; margin-bottom: 4px; }
.result-code { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; font-size: 13px; font-family: monospace; overflow-x: auto; margin: 12px 0; white-space: pre-wrap; color: var(--text-secondary); }

/* === PULSE ANIMATION (in-progress indicator) === */
.pulse-bar { height: 3px; background: var(--bg-secondary); border-radius: 2px; overflow: hidden; }
.pulse-inner { height: 100%; width: 40%; background: #60A5FA; border-radius: 2px; animation: pulse-slide 1.6s ease-in-out infinite; }
@keyframes pulse-slide { 0% { transform: translateX(-200%); } 100% { transform: translateX(400%); } }

.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: #60A5FA; animation: pulse-fade 1.4s ease-in-out infinite; flex-shrink: 0; }
@keyframes pulse-fade { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

.sidebar-working-indicator {
  display: flex; align-items: center; gap: 8px;
  margin-top: 16px; font-size: 13px; color: #60A5FA; font-weight: 500;
}

/* === BUYER ACTIONS === */
.buyer-actions {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.buyer-actions-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 14px; }
.buyer-actions-row { display: flex; gap: 10px; flex-wrap: wrap; }

.btn-approve {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  background: var(--green); color: #000;
  border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer;
  text-decoration: none; transition: opacity 0.15s;
  font-family: var(--font-body);
}
.btn-approve:hover { opacity: 0.88; }

.btn-revision {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  background: transparent; color: #FB923C;
  border: 1px solid rgba(249,115,22,0.35); border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: border-color 0.15s; font-family: var(--font-body);
}
.btn-revision:hover { border-color: #FB923C; }

.revision-panel { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.hidden { display: none !important; }

/* === REVISION FEEDBACK CARD === */
.revision-feedback-card {
  background: rgba(249,115,22,0.06);
  border: 1px solid rgba(249,115,22,0.2);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.revision-feedback-header {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px;
  color: #FB923C; margin-bottom: 12px;
}
.revision-feedback-text { font-size: 14px; color: var(--text-secondary); line-height: 1.7; margin: 0; }

/* === COMPLETED BANNER === */
.completed-banner {
  display: flex; align-items: center; gap: 10px;
  background: var(--green-dim);
  border: 1px solid rgba(34,197,94,0.2);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 16px;
  font-size: 14px; font-weight: 600; color: var(--green);
}

/* === BUTTONS === */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--amber);
  color: #000;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
  font-family: var(--font-body);
}
.btn-primary:hover { opacity: 0.88; }
.btn-primary.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-primary.btn-block { width: 100%; justify-content: center; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
  font-family: var(--font-body);
}
.btn-ghost:hover { border-color: var(--border-light); color: var(--text-primary); }

/* === EMPTY STATE === */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  max-width: 400px;
  margin: 0 auto;
}
.empty-icon {
  width: 64px;
  height: 64px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  color: var(--text-muted);
}
.empty-state h3 { font-size: 18px; font-weight: 600; margin-bottom: 10px; }
.empty-state p { font-size: 15px; color: var(--text-secondary); margin-bottom: 24px; }

/* === FORMS === */
.form-header { margin-bottom: 32px; }
.app-form { display: flex; flex-direction: column; gap: 0; }
.form-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 16px;
}
.form-section-title { font-size: 15px; font-weight: 600; margin-bottom: 20px; color: var(--text-primary); }
.form-group { margin-bottom: 20px; }
.form-group:last-child { margin-bottom: 0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-primary); margin-bottom: 8px; }
.required { color: var(--amber); }
.optional { color: var(--text-muted); font-weight: 400; }
.form-input, .form-textarea {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 10px 14px;
  transition: border-color 0.15s;
  outline: none;
  -webkit-appearance: none;
}
.form-input:focus, .form-textarea:focus { border-color: var(--amber); }
.form-textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; display: block; }

.input-prefix-wrap { position: relative; }
.input-prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--text-muted);
  pointer-events: none;
}
.form-input.has-prefix { padding-left: 28px; }

/* Radio cards */
.radio-group { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.radio-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.radio-card:hover { border-color: var(--border-light); }
.radio-card.checked { border-color: var(--amber); background: var(--amber-dim); }
.radio-card input[type=radio] { margin-top: 2px; accent-color: var(--amber); flex-shrink: 0; }
.radio-body { display: flex; flex-direction: column; gap: 4px; }
.radio-title { font-size: 14px; font-weight: 600; }
.radio-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }

.form-errors {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #EF4444;
  font-size: 13px;
}
.form-errors ul { margin: 0; padding-left: 16px; }
.form-errors li { margin-bottom: 4px; }
.form-errors li:last-child { margin-bottom: 0; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

/* === DETAIL VIEW === */
.detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: flex-start; }
.detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 16px;
}
.detail-title { font-size: clamp(20px, 2.5vw, 28px); font-weight: 700; letter-spacing: -0.5px; line-height: 1.25; }
.detail-section-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-muted); margin-bottom: 12px; }
.detail-description p { font-size: 15px; color: var(--text-secondary); line-height: 1.75; }

/* Bids section */
.bids-section { }
.bids-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.bids-title { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
.empty-bids {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 28px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 15px;
}
.bid-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
  transition: border-color 0.15s;
}
.bid-card:hover { border-color: var(--border-light); }
.bid-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.bid-agent { display: flex; align-items: center; gap: 12px; }
.agent-avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--amber-dim);
  border: 1px solid var(--amber-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--amber);
  flex-shrink: 0;
}
.bid-agent-name { font-size: 14px; font-weight: 600; }
.bid-time { font-size: 12px; color: var(--text-muted); }
.bid-price { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--amber); }
.bid-approach { }
.bid-approach-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); display: block; margin-bottom: 8px; }
.bid-approach p { font-size: 14px; color: var(--text-secondary); line-height: 1.7; }

/* Sidebar */
.sidebar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: sticky;
  top: 80px;
}
.sidebar-reward { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.sidebar-reward-label { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 4px; }
.sidebar-reward-value { font-family: var(--font-display); font-size: 28px; font-weight: 700; color: var(--amber); }
.sidebar-stat { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.sidebar-stat:last-of-type { margin-bottom: 0; }
.sidebar-stat-label { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.sidebar-stat-value { font-size: 14px; color: var(--text-primary); font-weight: 500; }

/* === BID FORM — task summary card === */
.task-summary-card {
  background: var(--bg-card);
  border: 1px solid var(--amber-border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}

/* === TOAST === */
.toast {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 200;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  transition: opacity 0.5s;
}
.toast-success { background: var(--green); color: #000; }

/* === ERROR PAGE === */
.error-page {
  text-align: center;
  padding: 80px 24px;
  max-width: 400px;
  margin: 0 auto;
}
.error-icon {
  width: 64px;
  height: 64px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  color: #EF4444;
}
.error-page h2 { font-size: 22px; font-weight: 700; margin-bottom: 10px; }
.error-page p { font-size: 15px; color: var(--text-secondary); margin-bottom: 24px; }

/* === RESPONSIVE === */
@media (max-width: 900px) {
  .detail-grid { grid-template-columns: 1fr; }
  .detail-sidebar { order: -1; }
  .sidebar-card { position: static; }
  .board-header { flex-direction: column; align-items: flex-start; }
  .form-row { grid-template-columns: 1fr; }
  .radio-group { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .page-container { padding: 32px 16px; }
  .task-grid { grid-template-columns: 1fr; }
}
