/* ═══ Reset & Base ═══ */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; background: #f0f2f5; color: #1a1a2e; min-height: 100vh; }

/* ═══ Pages ═══ */
.page { display: none; }
.page.active { display: block; }
.hidden { display: none !important; }

/* ═══ Login ═══ */
#login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.login-box { background: #fff; padding: 40px; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.15); width: 380px; max-width: 90vw; text-align: center; }
.login-box h1 { font-size: 28px; color: #1a1a2e; margin-bottom: 4px; }
.login-box .subtitle { color: #888; font-size: 14px; margin-bottom: 28px; }
.login-box input { width: 100%; padding: 12px 14px; border: 1px solid #ddd; border-radius: 8px; font-size: 15px; margin-bottom: 12px; transition: border-color .2s; }
.login-box input:focus { outline: none; border-color: #667eea; }
.error-msg { color: #e53e3e; font-size: 13px; margin-top: 10px; }

/* ═══ Buttons ═══ */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 10px 20px; border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all .2s; }
.btn:hover { opacity: 0.9; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: #667eea; color: #fff; }
.btn-danger { background: #e53e3e; color: #fff; }
.btn-success { background: #38a169; color: #fff; }
.btn-warning { background: #dd6b20; color: #fff; }
.btn-ghost { background: transparent; color: #667eea; border: 1px solid #667eea; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-xs { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ═══ Header ═══ */
.app-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; background: #fff; border-bottom: 1px solid #e2e8f0; }
.app-header h2 { font-size: 20px; color: #1a1a2e; }
.header-right { display: flex; align-items: center; gap: 12px; }
#user-display { font-size: 14px; color: #666; }

/* ═══ Tabs ═══ */
.tabs { display: flex; background: #fff; border-bottom: 2px solid #e2e8f0; padding: 0 24px; }
.tab { padding: 12px 20px; border: none; background: transparent; font-size: 14px; font-weight: 600; color: #888; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .2s; }
.tab:hover { color: #667eea; }
.tab.active { color: #667eea; border-bottom-color: #667eea; }

/* ═══ Panels ═══ */
.panel { display: none; }
.panel.active { display: block; }
.panel-content { max-width: 900px; margin: 0 auto; padding: 24px; }
.panel-content h3 { font-size: 18px; margin-bottom: 20px; color: #1a1a2e; }

/* ═══ Forms ═══ */
label { display: block; font-size: 13px; font-weight: 600; color: #555; margin-bottom: 6px; margin-top: 14px; }
input[type="url"], input[type="text"], input[type="password"], select, textarea {
  width: 100%; padding: 10px 14px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; transition: border-color .2s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #667eea; }
.star-checks { display: flex; gap: 16px; margin-top: 4px; }
.star-checks label { display: flex; align-items: center; gap: 4px; font-weight: 400; cursor: pointer; margin-top: 0; }

/* ═══ Progress ═══ */
.progress-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.progress-bar { height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; margin-bottom: 8px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #667eea, #764ba2); border-radius: 4px; transition: width .3s; width: 0%; }
.progress-info { font-size: 14px; color: #555; margin-bottom: 12px; }
.progress-log { max-height: 200px; overflow-y: auto; background: #1a1a2e; color: #a0aec0; padding: 12px; border-radius: 8px; font-family: 'Consolas', 'Fira Code', monospace; font-size: 12px; line-height: 1.6; }
.progress-log .log-line { white-space: pre-wrap; word-break: break-all; }

/* ═══ Scans List ═══ */
.scans-list { display: flex; flex-direction: column; gap: 12px; }
.scan-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 16px 20px; transition: box-shadow .2s; }
.scan-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.06); }
.scan-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.scan-card-title { font-size: 16px; font-weight: 600; color: #1a1a2e; }
.scan-card-meta { font-size: 13px; color: #888; margin-bottom: 10px; }
.scan-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Status badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.badge-running { background: #ebf8ff; color: #2b6cb0; }
.badge-completed { background: #f0fff4; color: #276749; }
.badge-failed { background: #fff5f5; color: #c53030; }
.badge-cancelled { background: #fefcbf; color: #975a16; }
.badge-queued { background: #f7fafc; color: #718096; }

/* ═══ Modal ═══ */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-content { background: #fff; border-radius: 12px; width: 500px; max-width: 90vw; max-height: 90vh; overflow-y: auto; }
.modal-large { width: 900px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid #e2e8f0; }
.modal-header h3 { font-size: 16px; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: #888; padding: 0 4px; }
.modal-close:hover { color: #333; }
.modal-body { padding: 20px; }

/* ═══ Review Table (in modal) ═══ */
.review-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.review-table th { background: #f7fafc; padding: 10px; text-align: left; font-weight: 600; border-bottom: 2px solid #e2e8f0; }
.review-table td { padding: 8px 10px; border-bottom: 1px solid #f0f0f0; vertical-align: top; }
.review-table tr:hover td { background: #f8f9fa; }
.stars-col { color: #f59e0b; white-space: nowrap; }

/* ═══ Users Table ═══ */
.users-table { width: 100%; border-collapse: collapse; }
.users-table th { background: #f7fafc; padding: 10px 12px; text-align: left; font-weight: 600; border-bottom: 2px solid #e2e8f0; font-size: 13px; }
.users-table td { padding: 10px 12px; border-bottom: 1px solid #f0f0f0; font-size: 14px; }

/* ═══ Utility ═══ */
.muted { color: #a0aec0; font-size: 14px; }
.text-center { text-align: center; }
.mt-12 { margin-top: 12px; }
.gap-8 { gap: 8px; }

/* ═══ Responsive ═══ */
@media (max-width: 640px) {
  .panel-content { padding: 16px; }
  .tabs { overflow-x: auto; }
  .summary { grid-template-columns: 1fr; }
  .scan-card-actions { flex-direction: column; }
}
