/* ================================================
   SMART LEGAL ASSIGNMENT ASSISTANT — style.css
   PakLaw.online — Academic Tool
   ================================================ */

:root {
  --primary-blue: #0842a0;
  --action-blue: #0b57d0;
  --accent-gold: #c5a059;
  --bg-surface: #f8fafc;
  --bg-white: #ffffff;
  --border: #d6e0ef;
  --border-light: #e8eef7;
  --text-primary: #0d1f3c;
  --text-secondary: #4a5d7a;
  --text-muted: #7a90b0;
  --shadow-sm: 0 1px 4px rgba(8, 66, 160, 0.07);
  --shadow-md: 0 4px 20px rgba(8, 66, 160, 0.10);
  --shadow-lg: 0 12px 40px rgba(8, 66, 160, 0.14);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Source Serif 4', Georgia, serif;
  --font-mono: 'JetBrains Mono', monospace;
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.sla-wrapper {
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-surface);
  min-height: 60vh;
}

/* ─── HERO ─────────────────────────────────────── */

.sla-hero {
  background: linear-gradient(135deg, #05287a 0%, var(--primary-blue) 55%, #0d4db8 100%);
  position: relative;
  overflow: hidden;
  padding: 72px 5% 60px;
  display: flex;
  align-items: center;
  min-height: 300px;
}

.sla-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(ellipse 60% 80% at 80% 50%, rgba(197,160,89,0.10) 0%, transparent 70%),
    repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(255,255,255,0.03) 40px),
    repeating-linear-gradient(90deg, transparent, transparent 39px, rgba(255,255,255,0.03) 40px);
  pointer-events: none;
}

.sla-hero-glyph {
  position: absolute;
  right: 6%;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-display);
  font-size: clamp(120px, 18vw, 220px);
  color: rgba(197,160,89,0.12);
  line-height: 1;
  pointer-events: none;
  user-select: none;
  letter-spacing: -0.02em;
}

.sla-hero-inner {
  position: relative;
  z-index: 2;
  max-width: 680px;
}

.sla-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(197,160,89,0.2);
  border: 1px solid rgba(197,160,89,0.4);
  color: #e8cb8c;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 100px;
  margin-bottom: 20px;
}

.badge-dot {
  width: 7px; height: 7px;
  background: var(--accent-gold);
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.75); }
}

.sla-hero-title {
  font-family: var(--font-display);
  font-size: clamp(30px, 5vw, 52px);
  font-weight: 700;
  color: #ffffff;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.sla-hero-title em {
  font-style: italic;
  color: #e8cb8c;
}

.sla-hero-sub {
  font-size: 16px;
  color: rgba(255,255,255,0.75);
  line-height: 1.65;
  margin-bottom: 28px;
  max-width: 540px;
}

.sla-hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.stat-pill {
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.90);
  font-size: 13px;
  padding: 6px 16px;
  border-radius: 100px;
}

.stat-pill strong {
  color: #e8cb8c;
}

/* ─── TOOL SECTION ──────────────────────────────── */

.sla-tool-section {
  padding: 40px 5% 48px;
  max-width: 1320px;
  margin: 0 auto;
}

.sla-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}

/* ─── PANELS ────────────────────────────────────── */

.sla-panel {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 32px;
  position: relative;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
}

.panel-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--primary-blue) 0%, var(--action-blue) 100%);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(8,66,160,0.25);
}

.panel-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-blue);
  line-height: 1.2;
}

.panel-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ─── FORM FIELDS ───────────────────────────────── */

.field-group {
  margin-bottom: 20px;
}

.field-group--grow {
  flex: 1;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
  margin-bottom: 7px;
}

.field-required {
  color: var(--accent-gold);
  margin-left: 2px;
}

.field-hint {
  color: var(--text-muted);
  font-weight: 400;
}

.field-input,
.field-select,
.field-textarea {
  width: 100%;
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-primary);
  padding: 10px 14px;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  outline: none;
  appearance: none;
}

.field-input--sm { max-width: 200px; }

.field-input:focus,
.field-select:focus,
.field-textarea:focus {
  border-color: var(--action-blue);
  background: var(--bg-white);
  box-shadow: 0 0 0 3px rgba(11,87,208,0.12);
}

.field-input::placeholder,
.field-textarea::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.field-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%234a5d7a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.field-textarea {
  resize: vertical;
  min-height: 200px;
  line-height: 1.7;
  font-size: 14px;
}

.textarea-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
}

.textarea-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.word-count {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  padding: 2px 8px;
  border-radius: 4px;
}

.autosave-badge {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  margin-top: 5px;
  opacity: 0;
  transition: opacity 0.4s;
}

.autosave-badge.visible {
  opacity: 1;
}

/* ─── BUTTONS (Ghost) ───────────────────────────── */

.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-ghost:hover {
  border-color: var(--action-blue);
  color: var(--action-blue);
  background: rgba(11,87,208,0.05);
}

.btn-ghost--sm { font-size: 11px; padding: 4px 10px; }

/* ─── ACTION BUTTONS ────────────────────────────── */

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 24px;
}

.btn-action {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-gold);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  padding: 12px 16px;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
  letter-spacing: 0.01em;
  box-shadow: 0 2px 8px rgba(197,160,89,0.30);
  position: relative;
  overflow: hidden;
}

.btn-action::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--transition);
}

.btn-action:hover {
  background: var(--action-blue);
  box-shadow: 0 4px 16px rgba(11,87,208,0.30);
  transform: translateY(-1px);
}

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

.btn-action:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-action--full {
  grid-column: 1 / -1;
  justify-content: center;
  background: linear-gradient(90deg, var(--primary-blue) 0%, var(--action-blue) 100%);
  box-shadow: 0 4px 16px rgba(8,66,160,0.30);
}

.btn-action--full:hover {
  background: linear-gradient(90deg, #062d7a 0%, var(--primary-blue) 100%);
  box-shadow: 0 6px 20px rgba(8,66,160,0.40);
}

.btn-icon {
  font-size: 16px;
  flex-shrink: 0;
  line-height: 1;
}

.btn-label { line-height: 1.3; }

/* Spinner */
.btn-action.loading .btn-label::after {
  content: '';
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}

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

/* ─── RESULTS PANEL ─────────────────────────────── */

.sla-panel--results {
  min-height: 500px;
  display: flex;
  flex-direction: column;
}

/* Empty State */
.results-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  gap: 14px;
}

.empty-glyph {
  font-size: 56px;
  color: var(--border);
  font-family: var(--font-display);
  line-height: 1;
  margin-bottom: 8px;
}

.empty-title {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--primary-blue);
  font-weight: 700;
}

.empty-desc {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 300px;
  line-height: 1.65;
}

.empty-features {
  list-style: none;
  margin-top: 8px;
  text-align: left;
}

.empty-features li {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 4px 0;
}

/* Loading State */
.results-loading {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 60px 20px;
}

.loading-scales {
  display: flex;
  align-items: flex-end;
  gap: 0;
  height: 60px;
  margin-bottom: 8px;
}

.scale-pivot {
  width: 4px; height: 40px;
  background: var(--primary-blue);
  border-radius: 2px;
  position: relative;
}

.scale-pivot::after {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 60px; height: 3px;
  background: var(--primary-blue);
  border-radius: 2px;
  transform-origin: center;
  animation: tilt-scale 1.4s ease-in-out infinite alternate;
}

@keyframes tilt-scale {
  from { transform: translateX(-50%) rotate(-18deg); }
  to   { transform: translateX(-50%) rotate(18deg); }
}

.scale-bar {
  width: 28px; height: 28px;
  border: 2px solid var(--accent-gold);
  border-radius: 4px;
  background: rgba(197,160,89,0.15);
}

.scale-bar--l { margin-right: 4px; }
.scale-bar--r { margin-left: 4px; }

.loading-text {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  color: var(--primary-blue);
}

.loading-sub {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  max-width: 280px;
  line-height: 1.6;
}

/* ─── SCORE CARD ────────────────────────────────── */

.score-section {
  margin-bottom: 24px;
}

.score-card {
  display: flex;
  align-items: center;
  gap: 24px;
  background: linear-gradient(135deg, var(--primary-blue) 0%, #0d4db8 100%);
  border-radius: var(--radius);
  padding: 24px;
  color: white;
}

.score-ring {
  position: relative;
  width: 100px; height: 100px;
  flex-shrink: 0;
}

.score-svg {
  width: 100%; height: 100%;
  transform: rotate(-90deg);
}

.score-track {
  fill: none;
  stroke: rgba(255,255,255,0.15);
  stroke-width: 8;
}

.score-fill {
  fill: none;
  stroke: var(--accent-gold);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 314;
  stroke-dashoffset: 314;
  transition: stroke-dashoffset 1.2s cubic-bezier(0.4,0,0.2,1);
}

.score-number {
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: white;
}

.score-details { flex: 1; }

.score-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  color: rgba(255,255,255,0.95);
}

.score-bars { display: flex; flex-direction: column; gap: 7px; }

.score-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.score-bar-label {
  font-size: 11px;
  color: rgba(255,255,255,0.75);
  width: 70px;
  flex-shrink: 0;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.score-bar-track {
  flex: 1;
  height: 5px;
  background: rgba(255,255,255,0.15);
  border-radius: 3px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  background: var(--accent-gold);
  border-radius: 3px;
  width: 0;
  transition: width 1s ease;
}

.score-bar-val {
  font-size: 11px;
  font-family: var(--font-mono);
  color: rgba(255,255,255,0.80);
  width: 28px;
  text-align: right;
}

/* ─── SUGGESTIONS ───────────────────────────────── */

.section-heading {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-blue);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.section-icon {
  color: var(--accent-gold);
  font-size: 14px;
}

.suggestions-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-light);
}

.suggestions-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.suggestion-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #f0f5ff;
  border: 1px solid #d0deff;
  border-left: 3px solid var(--action-blue);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.55;
  animation: fade-in-up 0.3s ease both;
}

.suggestion-icon {
  color: var(--action-blue);
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── FORMATTED TEXT ─────────────────────────────── */

.formatted-section {}

.formatted-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.formatted-actions {
  display: flex;
  gap: 8px;
}

.formatted-text {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-primary);
  white-space: pre-wrap;
  max-height: 480px;
  overflow-y: auto;
  font-family: var(--font-body);
}

.formatted-text::-webkit-scrollbar { width: 5px; }
.formatted-text::-webkit-scrollbar-track { background: transparent; }
.formatted-text::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* ─── ERROR ──────────────────────────────────────── */

.results-error {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  gap: 12px;
}

.error-icon {
  font-size: 40px;
  color: #b85c00;
}

.error-title {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--primary-blue);
  font-weight: 700;
}

.error-desc {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 300px;
  line-height: 1.65;
}

/* ─── FEATURES SECTION ───────────────────────────── */

.sla-features-section {
  background: var(--bg-white);
  border-top: 1px solid var(--border-light);
  padding: 56px 5%;
}

.features-title {
  font-family: var(--font-display);
  font-size: clamp(22px, 3.5vw, 32px);
  font-weight: 700;
  color: var(--primary-blue);
  text-align: center;
  margin-bottom: 36px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.feature-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  position: relative;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--action-blue);
}

.feature-num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.feature-icon {
  font-size: 28px;
  color: var(--accent-gold);
  margin-bottom: 10px;
  line-height: 1;
}

.feature-card h3 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--primary-blue);
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* ─── DISCLAIMER ─────────────────────────────────── */

.sla-disclaimer {
  text-align: center;
  font-size: 12.5px;
  color: var(--text-muted);
  padding: 20px 5% 32px;
  max-width: 700px;
  margin: 0 auto;
  line-height: 1.65;
}

.sla-disclaimer strong {
  color: var(--text-secondary);
}

/* ─── COPY FEEDBACK ──────────────────────────────── */

.copy-toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--primary-blue);
  color: white;
  font-size: 13px;
  font-family: var(--font-body);
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  animation: toast-in 0.3s ease;
}

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

/* ─── RESPONSIVE ──────────────────────────────────── */

@media (max-width: 960px) {
  .sla-columns {
    grid-template-columns: 1fr;
  }

  .sla-hero { padding: 48px 5% 40px; }

  .sla-hero-glyph { opacity: 0.5; }

  .sla-tool-section { padding: 28px 4% 36px; }
}

@media (max-width: 640px) {
  .field-row { grid-template-columns: 1fr; }

  .action-grid { grid-template-columns: 1fr; }

  .btn-action--full { grid-column: auto; }

  .sla-panel { padding: 22px 18px; }

  .score-card { flex-direction: column; text-align: center; }

  .score-bar-label { width: 54px; }

  .features-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 420px) {
  .features-grid { grid-template-columns: 1fr; }

  .sla-hero-title { font-size: 26px; }
}