/* SOS Devoirs — page styles */

:root {
  --bg: #f8f6ff;
  --primary: #6c3aff;
  --primary-light: #ede8ff;
  --accent: #ff6b35;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --white: #ffffff;
  --border: #e5e0ff;
  --success: #22c55e;
  --error: #ef4444;
  --shadow: 0 4px 20px rgba(108, 58, 255, 0.10);
}

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

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Header */
.sos-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.sos-header-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.sos-back {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  transition: opacity 0.15s;
}
.sos-back:hover { opacity: 0.75; }
.sos-brand {
  font-weight: 800;
  font-size: 1rem;
  color: var(--primary);
}

/* Main */
.sos-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

/* Intro */
.sos-intro {
  text-align: center;
  margin-bottom: 28px;
}
.sos-icon { font-size: 2.4rem; margin-bottom: 12px; }
.sos-intro h1 {
  font-family: 'Fraunces', serif;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
  color: var(--text);
}
.sos-intro p {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.55;
  max-width: 440px;
  margin: 0 auto;
}

/* Form */
.sos-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Upload zone */
.upload-zone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 16px;
  background: var(--white);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  overflow: hidden;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}
.upload-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  gap: 8px;
}
.upload-icon { color: var(--primary); opacity: 0.5; }
.upload-text { font-weight: 700; font-size: 1rem; color: var(--text); }
.upload-sub { font-size: 0.82rem; color: var(--text-muted); }

/* Preview */
.upload-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 16px;
}
.upload-preview img {
  max-height: 220px;
  max-width: 100%;
  border-radius: 10px;
  object-fit: contain;
}
.preview-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.preview-remove:hover { background: rgba(0,0,0,0.8); }

/* Text area */
.sos-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.sos-textarea {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  resize: vertical;
  min-height: 88px;
  transition: border-color 0.2s;
  background: var(--white);
  color: var(--text);
}
.sos-textarea:focus {
  outline: none;
  border-color: var(--primary);
}

/* Error */
.sos-error {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--error);
  font-size: 0.88rem;
  font-weight: 600;
}

/* Submit button */
.sos-submit-btn {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 16px 24px;
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}
.sos-submit-btn:hover:not(:disabled) { background: #5a2de0; transform: translateY(-1px); }
.sos-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Loader */
.btn-loader {
  width: 20px; height: 20px;
  border: 2.5px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Results */
.sos-results {
  margin-top: 40px;
  animation: fadeUp 0.4s ease-out;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.results-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.subject-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.subject-maths     { background: #dcfce7; color: #16a34a; }
.subject-francais  { background: #fce7f3; color: #db2777; }
.subject-sciences  { background: #dbeafe; color: #2563eb; }
.subject-histoire  { background: #fef9c3; color: #a16207; }
.subject-geo       { background: #d1fae5; color: #059669; }
.subject-anglais   { background: #ede8ff; color: #7c3aed; }
.subject-autre     { background: var(--primary-light); color: var(--primary); }

.preview-thumb-wrap {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  max-width: 80px;
}
.preview-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  display: block;
}

.steps-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.step-card {
  display: flex;
  gap: 16px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 20px;
  animation: fadeUp 0.35s ease-out both;
  transition: box-shadow 0.2s;
}
.step-card:hover { box-shadow: var(--shadow); }

.step-num {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
}

.step-body { flex: 1; min-width: 0; }

.step-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 6px;
}

.step-explanation {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 10px;
}

.step-action {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  border-radius: 8px;
  padding: 10px 12px;
  line-height: 1.4;
}
.step-action svg { flex-shrink: 0; margin-top: 1px; }

.results-footer {
  margin-top: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.results-tip {
  font-size: 0.82rem;
  color: var(--text-muted);
  max-width: 360px;
}
.btn-reset {
  background: transparent;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 10px 20px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-reset:hover { border-color: var(--primary); color: var(--primary); }

/* Responsive */
@media (max-width: 640px) {
  .sos-main { padding: 20px 16px 60px; }
  .step-card { padding: 16px; gap: 12px; }
  .step-num { width: 36px; height: 36px; font-size: 0.95rem; }
  .results-footer { flex-direction: column; align-items: flex-start; }
}