/* MotiveLab Portal Styles — extends the main site style.css */
:root {
  --primary: #00B4D8;
  --primary-dark: #0096c7;
  --primary-light: #e0f7fa;
  --accent: #ff6b35;
  --text: #333;
  --text-light: #666;
  --bg: #f5f7fa;
  --white: #fff;
  --border: #e0e0e0;
  --success: #2ecc71;
  --warning: #f39c12;
  --danger: #e74c3c;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ── Layout ── */
.portal-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.portal-header .logo {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}
.portal-header .logo span { color: var(--primary); }

.portal-header .nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-badge {
  font-size: 0.85rem;
  color: var(--text-light);
}
.user-badge strong { color: var(--text); }

.btn-logout {
  background: none;
  border: 1px solid var(--border);
  padding: 6px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-light);
  transition: all 0.2s;
}
.btn-logout:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.portal-main {
  max-width: 1100px;
  margin: 32px auto;
  padding: 0 24px;
}

/* ── Auth Pages (full-screen centered) ── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e0f7fa 0%, #f5f7fa 100%);
}

.auth-card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

.auth-card h1 {
  font-size: 1.5rem;
  margin-bottom: 4px;
}
.auth-card .subtitle {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 28px;
}

/* ── Forms ── */
.form-group {
  margin-bottom: 20px;
}
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: var(--font);
  transition: border-color 0.2s;
  background: var(--white);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,180,216,0.15);
}
.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

.form-error {
  color: var(--danger);
  font-size: 0.8rem;
  margin-top: 4px;
  display: none;
}
.form-error.show { display: block; }

.form-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.9rem;
  color: var(--text-light);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
  width: 100%;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
}
.btn-outline:hover {
  background: var(--primary-light);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.85rem;
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
}
.btn-danger:hover { background: #c0392b; }

/* ── Flash Messages ── */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 0.9rem;
  display: none;
}
.flash.show { display: block; }
.flash-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.flash-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.flash-info    { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ── Cards ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.card-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
}
.card-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

/* ── Dashboard Grid ── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

/* ── Stats Row ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  text-align: center;
}
.stat-card .stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
}
.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 4px;
}

/* ── Task List ── */
.task-list { list-style: none; }
.task-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.task-item:last-child { border-bottom: none; }
.task-item:hover { background: var(--bg); margin: 0 -24px; padding: 14px 24px; border-radius: 4px; }

.task-status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-pending          { background: #fff3cd; color: #856404; }
.badge-downloading      { background: #cce5ff; color: #004085; }
.badge-pending_analysis { background: #f8d7da; color: #721c24; }
.badge-analyzing         { background: #d1ecf1; color: #0c5460; }
.badge-solved            { background: #d4edda; color: #155724; }
.badge-need_more_info   { background: #fff3cd; color: #856404; }

.severity-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
}
.severity-P0 { background: #e74c3c; color: white; }
.severity-P1 { background: #f39c12; color: white; }
.severity-P2 { background: #3498db; color: white; }
.severity-P3 { background: #95a5a6; color: white; }

.task-title {
  flex: 1;
  font-weight: 500;
  font-size: 0.95rem;
}
.task-meta {
  font-size: 0.8rem;
  color: var(--text-light);
  white-space: nowrap;
}

/* ── Task Detail ── */
.task-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.task-detail-title {
  margin-bottom: 24px;
}
.task-detail-title h2 { font-size: 1.3rem; }
.task-detail-title .task-id {
  font-size: 0.8rem;
  color: var(--text-light);
  font-family: monospace;
}

.timeline {
  list-style: none;
  position: relative;
  padding-left: 28px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-item {
  position: relative;
  padding-bottom: 20px;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -22px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--white);
}
.timeline-item .action {
  font-weight: 600;
  font-size: 0.9rem;
}
.timeline-item .time {
  font-size: 0.8rem;
  color: var(--text-light);
}

/* ── File List ── */
.file-list {
  list-style: none;
}
.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.file-item:last-child { border-bottom: none; }
.file-item .file-icon { font-size: 1.2rem; }
.file-item .file-name { flex: 1; }
.file-item .file-size { color: var(--text-light); font-size: 0.8rem; }

/* ── File Upload Area ── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #fafafa;
}
.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.drop-zone .icon { font-size: 2rem; margin-bottom: 8px; }
.drop-zone p { color: var(--text-light); font-size: 0.9rem; }
.drop-zone input[type="file"] { display: none; }

.file-preview {
  margin-top: 12px;
}
.file-preview-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 4px;
  margin-bottom: 6px;
  font-size: 0.85rem;
}
.file-preview-item .remove-file {
  cursor: pointer;
  color: var(--danger);
  font-weight: bold;
  margin-left: auto;
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-light);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state h3 { color: var(--text); margin-bottom: 8px; }

/* ── Loading ── */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-light);
}
.spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 768px) {
  .portal-main { padding: 0 16px; margin: 20px auto; }
  .auth-card { padding: 24px; margin: 16px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .task-item { flex-wrap: wrap; }
  .task-detail-header { flex-direction: column; }
}
