/* ============================================================
   TVK Makkal Connect — Base styles (shared across all pages)
   ============================================================ */

/* ── Variables ──────────────────────────────────────────────── */
:root {
  --primary:          #610000;
  --primary-dark:     #7A0000;
  --primary-red:      #B31312;
  --primary-container:#8b0000;
  --on-primary:       #ffffff;
  --secondary:        #765a00;
  --secondary-container:#fdc826;
  --on-secondary-container:#6e5400;
  --surface:          #fcf9f8;
  --surface-dim:      #dcd9d9;
  --surface-low:      #f6f3f2;
  --surface-container:#f0edec;
  --surface-high:     #ebe7e7;
  --surface-highest:  #e5e2e1;
  --on-surface:       #1c1b1b;
  --on-surface-var:     #5a403c;
  --on-surface-variant: #5a403c;
  --inverse-surface:  #313030;
  --inverse-on-surface:#f3f0ef;
  --outline:          #8e706b;
  --outline-var:      #e3beb8;
  --outline-variant:  #e3beb8;
  --error:            #ba1a1a;
  --error-container:  #ffdad6;
  --cream:            #FFF7D6;
  --light-red-bg:     #FFF1F1;

  --font-sans:  'Inter', 'Noto Sans', 'Manrope', sans-serif;
  --font-inter: 'Inter', sans-serif;
  --font-manrope:'Manrope', sans-serif;
  --font-noto:  'Noto Sans', sans-serif;

  --r-sm:  4px;
  --r-md:  8px;
  --r-lg:  12px;
  --r-xl:  20px;
  --r-2xl: 28px;
  --r-full:9999px;

  --shadow-sm: 0 2px 8px rgba(0,0,0,.04);
  --shadow-md: 0 4px 20px rgba(0,0,0,.06);
  --shadow-lg: 0 12px 32px rgba(139,0,0,.08);
  --shadow-xl: 0 24px 48px rgba(0,0,0,.12);
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-manrope); background: var(--surface); color: var(--on-surface); line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; border: none; outline: none; }
input, textarea, select { font-family: inherit; outline: none; }
img { max-width: 100%; height: auto; display: block; }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-highest); border-radius: 4px; }

/* ── Toast ──────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 80px; left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--inverse-surface); color: var(--inverse-on-surface);
  padding: 10px 22px; border-radius: var(--r-full);
  font-family: var(--font-inter); font-size: 13px; font-weight: 500;
  z-index: 9999; opacity: 0; transition: opacity .25s, transform .25s;
  white-space: nowrap; max-width: 90vw; pointer-events: none;
}
.toast--show   { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast--error  { background: var(--error); }
.toast--success{ background: #2e7d32; }

/* ── Modal overlay ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0,0,0,.5); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-overlay.modal--open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface); border-radius: var(--r-2xl);
  padding: 28px; width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: translateY(20px); transition: transform .2s;
}
.modal-overlay.modal--open .modal { transform: translateY(0); }
.modal__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal__title { font-family: var(--font-noto); font-size: 20px; font-weight: 700; color: var(--primary); }
.modal__close-btn {
  width: 34px; height: 34px; border-radius: var(--r-full);
  background: var(--surface-container); color: var(--on-surface-var);
  display: flex; align-items: center; justify-content: center; transition: background .15s;
}
.modal__close-btn:hover { background: var(--surface-high); }

/* ── Form controls ──────────────────────────────────────────── */
.form-group   { margin-bottom: 16px; }
.form-label   { display: block; margin-bottom: 6px; font-family: var(--font-inter); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--on-surface-var); }
.form-input, .form-textarea {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--outline-var);
  border-radius: var(--r-md); background: var(--surface-low);
  color: var(--on-surface); font-family: var(--font-manrope); font-size: 15px;
  transition: border-color .15s, box-shadow .15s;
}
.form-input:focus, .form-textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(97,0,0,.08);
}
.form-textarea { resize: vertical; min-height: 80px; }

/* ── Toggle ─────────────────────────────────────────────────── */
.toggle-wrapper { display: flex; align-items: center; gap: 10px; }
.toggle { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute; inset: 0; background: var(--surface-highest);
  border-radius: 24px; cursor: pointer; transition: .2s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 18px; height: 18px; border-radius: 50%; background: white;
  left: 3px; bottom: 3px; transition: .2s; box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── Warning box ────────────────────────────────────────────── */
.warning-box {
  background: #fff8e1; border: 1px solid #ffcc02;
  border-radius: var(--r-md); padding: 10px 14px;
  font-family: var(--font-inter); font-size: 12px; line-height: 1.5; color: #7a4100;
  display: flex; gap: 8px; align-items: flex-start;
}
.warning-box .material-symbols-outlined { font-size: 16px; flex-shrink: 0; color: #e65100; margin-top: 1px; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px; border-radius: var(--r-lg);
  font-family: var(--font-inter); font-size: 14px; font-weight: 600;
  transition: all .15s; cursor: pointer; border: none;
}
.btn--primary   { background: var(--primary); color: white; }
.btn--primary:hover { background: var(--primary-dark); }
.btn--primary:disabled { opacity: .55; cursor: not-allowed; }
.btn--outline   { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn--outline:hover { background: rgba(97,0,0,.05); }
.btn--ghost     { background: transparent; border: 1.5px solid var(--outline-var); color: var(--on-surface-var); }
.btn--ghost:hover { background: var(--surface-container); }
.btn--yellow    { background: var(--secondary-container); color: var(--on-secondary-container); }
.btn--yellow:hover { background: #f4bf1b; }
.btn--full      { width: 100%; justify-content: center; }
.btn--sm        { padding: 7px 14px; font-size: 13px; }
.btn--lg        { padding: 14px 28px; font-size: 16px; }
.btn--pill      { border-radius: var(--r-full); }

/* ── Badges ─────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--r-full); font-family: var(--font-inter); font-size: 11px; font-weight: 600; }
.badge--yellow { background: var(--secondary-container); color: var(--on-secondary-container); }
.badge--outline { background: transparent; border: 1px solid var(--outline-var); color: var(--on-surface-var); }

/* ── Ticket card ────────────────────────────────────────────── */
.ticket-card {
  background: var(--surface-low); border: 1px solid var(--outline-var);
  border-radius: var(--r-2xl); display: flex; overflow: hidden;
  box-shadow: var(--shadow-md); margin: 4px 0;
}
.ticket-card__stripe { width: 6px; flex-shrink: 0; }
.ticket-card__body   { flex: 1; padding: 14px; }
.ticket-card__header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; gap: 8px; }
.ticket-card__sys-label {
  display: block; background: var(--surface-highest); color: var(--on-surface-var);
  font-family: var(--font-inter); font-size: 9px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; padding: 2px 7px; border-radius: 4px; margin-bottom: 3px;
}
.ticket-card__title  { font-family: var(--font-noto); font-size: 15px; font-weight: 600; color: var(--on-surface); }
.ticket-card__badge  {
  display: flex; align-items: center; gap: 4px; padding: 3px 9px;
  border-radius: var(--r-full); font-family: var(--font-inter); font-size: 11px; font-weight: 600; white-space: nowrap; flex-shrink: 0;
}
.ticket-card__dot    { width: 6px; height: 6px; border-radius: 50%; }
.ticket-card__id-box {
  background: var(--surface-container); border: 1px solid var(--outline-var);
  border-radius: var(--r-lg); padding: 10px; margin-bottom: 10px;
}
.ticket-card__id     { font-family: var(--font-noto); font-size: 17px; font-weight: 700; color: var(--primary); margin-bottom: 6px; }
.ticket-card__grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tc-meta-lbl { font-family: var(--font-inter); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--on-surface-var); margin-bottom: 1px; }
.tc-meta-val { font-family: var(--font-manrope); font-size: 13px; color: var(--on-surface); }
.ticket-card__view-btn {
  width: 100%; padding: 8px; background: transparent;
  border: 1px solid rgba(97,0,0,.2); border-radius: var(--r-md);
  color: var(--primary); font-family: var(--font-inter); font-size: 12px; font-weight: 600;
  transition: background .15s;
}
.ticket-card__view-btn:hover { background: rgba(97,0,0,.05); }

/* ── Ticket timeline ─────────────────────────────────────────── */
.ticket-timeline { position: relative; padding-left: 22px; }
.ticket-timeline::before { content:''; position: absolute; left: 8px; top: 4px; bottom: 4px; width: 2px; background: var(--outline-var); }
.tl-item   { position: relative; margin-bottom: 14px; }
.tl-dot    { position: absolute; left: -18px; top: 4px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--surface); }
.tl-status { font-family: var(--font-inter); font-size: 13px; font-weight: 600; color: var(--on-surface); }
.tl-note   { font-family: var(--font-manrope); font-size: 12px; color: var(--on-surface-var); }
.tl-time   { font-family: var(--font-inter); font-size: 11px; color: var(--outline); }

/* ── Typing indicator ───────────────────────────────────────── */
.typing-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--on-surface-var); margin: 0 2px;
  animation: typingBounce 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: .2s; }
.typing-dot:nth-child(3) { animation-delay: .4s; }
@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .5; }
  40%            { transform: translateY(-6px); opacity: 1; }
}
