/* Adelie IT Client Portal - styles.css
 * All styling lives here (CSP forbids inline styles). */

:root {
  --adelie: #0b4aa2;
  --adelie-dark: #083a82;
  --adelie-light: #1b67d0;
  --navy: #0a1628;
  --navy-mid: #101d33;
  --ink: #0f172a;
  --muted: #64748b;
  --light: #f1f5f9;
  --card-bg: #fff;
  --border: rgba(11, 74, 162, .10);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .06);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, .08);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--light);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--adelie); }

.link {
  color: var(--adelie);
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  font-family: inherit;
}
.link:hover { text-decoration: underline; color: var(--adelie-dark); }

/* ---- focus visibility ---- */
:focus-visible {
  outline: 3px solid var(--adelie-light);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---- buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  font-family: inherit;
  font-size: .95rem;
  font-weight: 600;
  line-height: 1;
  padding: .7rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--adelie); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--adelie-dark); }
.btn-secondary { background: #fff; color: var(--adelie); border-color: var(--adelie); }
.btn-secondary:hover:not(:disabled) { background: var(--light); }
.btn-ghost { background: transparent; color: inherit; border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, .08); }
.btn-danger { background: #fff; color: #b91c1c; border-color: #b91c1c; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; color: #fff; }
.btn-sm { padding: .5rem .8rem; font-size: .85rem; }
.btn-block { width: 100%; }

/* ---- cards ---- */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

/* ---- forms ---- */
.field { display: block; margin-bottom: 1rem; }
.field-inline { display: inline-flex; flex-direction: column; margin-bottom: 0; }
.field-label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: .35rem;
}
.input {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .65rem .8rem;
}
.input:focus { border-color: var(--adelie-light); outline: none; box-shadow: 0 0 0 3px rgba(27, 103, 208, .18); }
.input-otp {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: .5em;
  padding-left: 1.3rem;
}
.textarea { resize: vertical; min-height: 6rem; }
.file-input { padding: .5rem; }
.form-actions { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin-top: .5rem; }
.fineprint { font-size: .8rem; color: var(--muted); margin: .5rem 0 0; }

/* ---- auth pages ---- */
.page-auth {
  min-height: 100vh;
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-mid) 55%, var(--adelie-dark) 140%);
}
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.auth-card { width: 100%; max-width: 420px; margin: 0; }
.auth-brand { display: flex; justify-content: center; margin-bottom: 1rem; }
.brand-logo { height: 36px; width: auto; }
.auth-title { font-size: 1.5rem; font-weight: 800; text-align: center; margin: .25rem 0 .25rem; }
.auth-sub { text-align: center; color: var(--muted); margin: 0 0 1.25rem; }
.auth-links { text-align: center; margin-top: 1rem; }
.auth-links-sep { color: var(--muted); margin: 0 .4rem; }
.link-disabled { color: var(--muted); cursor: default; pointer-events: none; text-decoration: none; }
.link-disabled:hover { text-decoration: none; color: var(--muted); }

/* ---- app header ---- */
.site-header { background: var(--navy); color: #fff; box-shadow: var(--shadow-sm); }
.header-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: .75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.header-brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; color: #fff; }
.header-logo { height: 36px; width: auto; display: block; }
.header-portal {
  font-weight: 600;
  font-size: .85rem;
  color: #cfe0fa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
.header-nav { display: flex; align-items: center; gap: 1rem; }
.header-user { font-weight: 500; font-size: .9rem; }
.header-nav .btn-ghost { color: #fff; border-color: rgba(255, 255, 255, .25); }

/* ---- layout ---- */
.container { max-width: 1040px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.container-narrow { max-width: 680px; }
.breadcrumb { margin-bottom: 1rem; }
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.page-title { font-size: 1.5rem; font-weight: 800; margin: 0; }
.toolbar { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }

/* ---- table / list ---- */
.table-card { padding: 0; overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
  text-align: left;
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table th {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--muted);
  background: var(--light);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.row-clickable { cursor: pointer; }
.row-clickable:hover { background: rgba(11, 74, 162, .04); }
.cell-subject { display: flex; flex-direction: column; gap: .15rem; }
.subject-text { font-weight: 600; }
.cell-sub { font-size: .8rem; color: var(--muted); }
.cell-date { color: var(--muted); font-size: .85rem; white-space: nowrap; }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}
.pager-info { color: var(--muted); font-size: .9rem; }

/* ---- badges (status) ---- */
.badge {
  display: inline-block;
  font-size: .78rem;
  font-weight: 600;
  padding: .25rem .6rem;
  border-radius: 999px;
  white-space: nowrap;
  background: var(--light);
  color: var(--ink);
}
.status-open { background: #dbeafe; color: #1e40af; }
.status-progress { background: #fef3c7; color: #92400e; }
.status-waiting { background: #ede9fe; color: #6d28d9; }
.status-resolved { background: #dcfce7; color: #166534; }
.status-closed { background: #e2e8f0; color: #475569; }

/* ---- chips (priority) ---- */
.chip {
  display: inline-block;
  font-size: .78rem;
  font-weight: 600;
  padding: .2rem .55rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  background: var(--light);
  color: var(--ink);
}
.prio-critical { background: #fee2e2; color: #b91c1c; }
.prio-high { background: #ffedd5; color: #c2410c; }
.prio-normal { background: #e2e8f0; color: #475569; }
.prio-low { background: #f1f5f9; color: var(--muted); }

/* ---- banners ---- */
.banner {
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  margin-bottom: 1rem;
  font-size: .92rem;
  font-weight: 500;
}
.banner-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.banner-notice { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ---- empty / loading states ---- */
.empty-state { text-align: center; padding: 2.5rem 1.5rem; }
.empty-msg { color: var(--muted); margin: 0 0 1rem; }
.loading { color: var(--muted); padding: 1.25rem; margin: 0; }
.muted-note { color: var(--muted); margin: .25rem 0; }

/* ---- ticket detail ---- */
.ticket-head .ticket-subject { font-size: 1.4rem; font-weight: 800; margin: 0 0 .75rem; }
.ticket-meta { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin-bottom: .75rem; }
.meta-item { display: inline-flex; align-items: center; }
.meta-text { color: var(--muted); font-size: .85rem; }
.ticket-openedby { margin: 0 0 1rem; }
.meta-email { color: var(--muted); }
.section-label {
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--muted);
  font-weight: 700;
  margin: 1.25rem 0 .5rem;
}
.ticket-description {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--light);
  border-radius: var(--radius-sm);
  padding: 1rem;
}

.actions-card .action-row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.actions-card .action-row-danger {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ---- comments ---- */
.comment {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .85rem 1rem;
  margin-bottom: .75rem;
  background: #fff;
}
.comment-staff {
  border-left: 4px solid var(--adelie);
  background: rgba(11, 74, 162, .04);
}
.comment-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin-bottom: .35rem; flex-wrap: wrap; }
.comment-author { font-weight: 700; }
.comment-staff .comment-author { color: var(--adelie); }
.comment-title { font-weight: 400; color: var(--muted); }
.comment-badge {
  display: inline-block;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #fff;
  background: var(--adelie);
  border-radius: 999px;
  padding: .1rem .55rem;
  margin-right: .1rem;
}
.comment-body { white-space: pre-wrap; word-break: break-word; }
.comment-form { margin-top: 1rem; }

/* ---- attachments ---- */
.attach-list { list-style: none; margin: 0 0 1rem; padding: 0; }
.attach-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--border);
}
.attach-item:last-child { border-bottom: none; }
.attach-link { text-align: left; word-break: break-all; }
.attach-time { white-space: nowrap; }
.upload-control { display: flex; flex-direction: column; gap: .6rem; align-items: flex-start; }
.upload-status { width: 100%; }

/* ---- responsive: tables collapse to cards at small widths ---- */
@media (max-width: 640px) {
  .header-portal { display: none; }

  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr {
    border-bottom: 1px solid var(--border);
    padding: .5rem .25rem;
  }
  .data-table td {
    border-bottom: none;
    padding: .3rem 1rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
  }
  .data-table td.cell-subject { flex-direction: column; align-items: flex-start; }
  .cell-date { white-space: normal; }

  .toolbar { flex-direction: column; }
  .field-inline { width: 100%; }
}

@media (max-width: 360px) {
  .container { padding: 1rem .75rem 2rem; }
  .card { padding: 1.1rem; }
}
