/* =============================================
   PakLaw.online — Bare Act Simplifier
   style.css — Main Stylesheet
   Brand Colors:
     --primary-blue : #0842a0
     --action-blue  : #0b57d0
     --accent-gold  : #c5a059
     --bg-surface   : #f8fafc
============================================= */

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

:root {
  --primary-blue : #0842a0;
  --action-blue  : #0b57d0;
  --accent-gold  : #c5a059;
  --bg-surface   : #f8fafc;
  --bg-white     : #ffffff;
  --text-dark    : #1a2540;
  --text-muted   : #5a6a8a;
  --border-color : #d6e0f0;
  --blue-light   : #e8f0fe;
  --gold-light   : #fdf4e7;
  --case-bg      : #f0f4ff;
  --case-border  : #c7d7f8;
  --radius-sm    : 8px;
  --radius-md    : 12px;
  --radius-lg    : 16px;
  --shadow-card  : 0 2px 16px rgba(8, 66, 160, 0.07);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg-surface);
  color: var(--text-dark);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── LAYOUT ──────────────────────────────── */

.wrap {
  max-width: 740px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

/* ── HEADER ──────────────────────────────── */

.site-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1.5px solid var(--border-color);
}

.logo-mark {
  width: 42px;
  height: 42px;
  background: var(--primary-blue);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-mark svg {
  width: 22px;
  height: 22px;
}

.site-name {
  font-family: 'Crimson Pro', serif;
  font-size: 21px;
  font-weight: 600;
  color: var(--primary-blue);
  letter-spacing: -0.3px;
}

.site-tag {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* ── INPUT CARD ──────────────────────────── */

.input-card {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-card);
}

.input-card h2 {
  font-family: 'Crimson Pro', serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--primary-blue);
  margin-bottom: 4px;
}

.tool-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* ── GRID ────────────────────────────────── */

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

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

/* ── FORM ELEMENTS ───────────────────────── */

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

label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 5px;
}

select,
input[type="text"],
textarea {
  width: 100%;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text-dark);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

select,
input[type="text"] {
  height: 42px;
  padding: 0 12px;
}

textarea {
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.6;
}

select:focus,
input[type="text"]:focus,
textarea:focus {
  border-color: var(--action-blue);
  box-shadow: 0 0 0 3px rgba(11, 87, 208, 0.1);
}

.hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 5px;
}

/* ── MODE BUTTONS ────────────────────────── */

.mode-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.mode-btn {
  padding: 7px 16px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  background: var(--bg-white);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.mode-btn:hover {
  border-color: var(--action-blue);
  color: var(--action-blue);
}

.mode-btn.active {
  background: var(--primary-blue);
  color: #fff;
  border-color: var(--primary-blue);
}

/* ── SUBMIT BUTTON ───────────────────────── */

.submit-btn {
  width: 100%;
  height: 46px;
  background: var(--accent-gold);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0.2px;
  transition: background 0.15s, transform 0.1s;
  margin-top: 6px;
}

.submit-btn:hover {
  background: #b8903e;
}

.submit-btn:active {
  transform: scale(0.99);
}

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── RESULT CARD ─────────────────────────── */

#resultWrap {
  animation: fadeUp 0.35s ease;
}

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

.result-card {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
}

/* Result Header */
.r-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.r-title {
  font-family: 'Crimson Pro', serif;
  font-size: 24px;
  font-weight: 600;
  color: var(--primary-blue);
  margin-bottom: 8px;
}

.r-badge-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.r-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 11px;
  border-radius: 20px;
  background: var(--blue-light);
  color: var(--primary-blue);
  letter-spacing: 0.3px;
}

.r-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

/* Sections */
.section {
  margin-bottom: 1.5rem;
}

.sec-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--accent-gold);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sec-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.sec-body {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-dark);
}

/* Urdu RTL */
.urdu-text {
  font-size: 16px;
  line-height: 2.2;
  direction: rtl;
  text-align: right;
  font-family: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', 'Noto Naskh Arabic', serif;
  color: var(--text-dark);
}

/* Example Box */
.example-box {
  background: var(--gold-light);
  border-left: 3px solid var(--accent-gold);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-dark);
}

/* Case Law Box */
.case-box {
  background: var(--case-bg);
  border: 1px solid var(--case-border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.case-name {
  font-weight: 500;
  color: var(--primary-blue);
  font-size: 14px;
  margin-bottom: 5px;
}

.case-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.65;
}

/* Related Terms */
.related-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rel-tag {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--blue-light);
  color: var(--primary-blue);
  border: 1px solid var(--case-border);
}

/* ── SKELETON LOADER ─────────────────────── */

.skel {
  height: 14px;
  background: linear-gradient(
    90deg,
    #e8eef8 25%,
    #f2f6ff 50%,
    #e8eef8 75%
  );
  background-size: 200% 100%;
  border-radius: 4px;
  margin-bottom: 9px;
  animation: shimmer 1.3s infinite;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── EXPORT BUTTONS ──────────────────────── */

.export-row {
  display: flex;
  gap: 10px;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
}

.exp-btn {
  flex: 1;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  background: var(--bg-white);
  color: var(--primary-blue);
  transition: all 0.15s;
}

.exp-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.exp-btn:hover {
  background: var(--primary-blue);
  color: #fff;
  border-color: var(--primary-blue);
}

/* ── CHAT SECTION ────────────────────────── */

.chat-section {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.chat-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--primary-blue);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-badge {
  background: var(--blue-light);
  color: var(--primary-blue);
  font-size: 10px;
  padding: 2px 9px;
  border-radius: 10px;
  font-weight: 500;
}

/* Quick question pills */
.quick-q-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 14px;
}

.quick-q {
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-white);
  color: var(--text-muted);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.15s;
}

.quick-q:hover {
  border-color: var(--action-blue);
  color: var(--action-blue);
  background: var(--blue-light);
}

/* Chat messages area */
.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 4px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
  background: var(--bg-surface);
  border-radius: 2px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

/* Message bubbles */
.chat-msg {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  line-height: 1.75;
  max-width: 90%;
  word-wrap: break-word;
}

.chat-msg.user {
  background: var(--blue-light);
  color: var(--primary-blue);
  align-self: flex-end;
  border: 1px solid var(--case-border);
  border-bottom-right-radius: 3px;
}

.chat-msg.ai {
  background: var(--bg-surface);
  color: var(--text-dark);
  align-self: flex-start;
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 3px;
}

.chat-msg.ai.thinking {
  color: var(--text-muted);
  font-style: italic;
  opacity: 0.75;
}

/* Chat input row */
.chat-input-row {
  display: flex;
  gap: 10px;
}

.chat-input-row input[type="text"] {
  flex: 1;
  height: 42px;
  font-size: 13.5px;
}

.chat-send-btn {
  height: 42px;
  padding: 0 20px;
  background: var(--primary-blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}

.chat-send-btn:hover {
  background: var(--action-blue);
}

.chat-send-btn:active {
  transform: scale(0.98);
}

.chat-send-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ── FOOTER ──────────────────────────────── */

.site-footer {
  text-align: center;
  margin-top: 2.5rem;
  font-size: 12px;
  color: var(--text-muted);
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

/* ── PRINT STYLES ────────────────────────── */

@media print {
  body { background: #fff; }
  .input-card,
  .site-header,
  .export-row,
  .chat-section,
  .site-footer { display: none !important; }
  .result-card {
    box-shadow: none;
    border: 1px solid #ccc;
    page-break-inside: avoid;
  }
  .wrap { padding: 0; max-width: 100%; }
}
