/* =====================================================================
   RCM Tickets - modern customer portal theme
   (overrides css/osticket.css + assets/default/css/theme.css)
   Loaded last from include/client/header.inc.php.
   ===================================================================== */
:root {
  --rcm-primary: #2563eb;
  --rcm-primary-600: #1d4ed8;
  --rcm-primary-50: #eff6ff;
  --rcm-primary-100: #dbeafe;
  --rcm-ink: #0f172a;
  --rcm-text: #1e293b;
  --rcm-muted: #64748b;
  --rcm-line: #e2e8f0;
  --rcm-line-strong: #cbd5e1;
  --rcm-bg: #f1f5f9;
  --rcm-surface: #ffffff;
  --rcm-surface-2: #f8fafc;
  --rcm-success: #16a34a;
  --rcm-warning: #d97706;
  --rcm-danger: #dc2626;
  --rcm-radius: 12px;
  --rcm-radius-sm: 8px;
  --rcm-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
  --rcm-shadow-lg: 0 12px 28px -8px rgba(15, 23, 42, .16), 0 4px 10px -6px rgba(15, 23, 42, .10);
  --rcm-font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Base ---------- */
html, body { background: var(--rcm-bg); }
body {
  font-family: var(--rcm-font);
  color: var(--rcm-text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a, .link { color: var(--rcm-primary); }
a:hover, .link:hover { color: var(--rcm-primary-600); }
h1, h2, h3, h2.subject { color: var(--rcm-ink); font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 26px; }
hr { border: none; border-top: 1px solid var(--rcm-line); }
.faded { color: var(--rcm-muted); }

/* ---------- Layout ---------- */
#container {
  width: auto;
  max-width: 1120px;
  margin: 24px auto;
  background: transparent;
  box-shadow: none;
  padding: 0 16px;
  box-sizing: border-box;
}
#header {
  height: auto;
  min-height: 72px;
  padding: 10px 22px;
  background: var(--rcm-surface);
  border: 1px solid var(--rcm-line);
  border-radius: var(--rcm-radius) var(--rcm-radius) 0 0;
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-sizing: border-box;
}
#header .pull-right { float: none; }
#header #logo { height: auto; display: flex; align-items: center; }
#header #logo img { max-height: 52px; }
#header p { width: auto; padding: 0; color: var(--rcm-muted); font-size: 14px; }
#header p a { font-weight: 500; }
#header p:empty { display: none; }

#nav {
  margin: 0;
  height: auto;
  padding: 8px 14px;
  background: var(--rcm-surface);
  border: 1px solid var(--rcm-line);
  border-top: none;
  box-shadow: none;
  white-space: normal;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
#nav li a {
  height: auto;
  line-height: 20px;
  margin: 0;
  padding: 8px 14px 8px 36px;
  border-radius: 999px;
  color: var(--rcm-text);
  font-weight: 500;
  font-size: 14px;
  background-position: 12px 50%;
}
#nav li a:hover { background-color: var(--rcm-surface-2); color: var(--rcm-primary); text-decoration: none; }
#nav li a.active { background-color: var(--rcm-primary-50); color: var(--rcm-primary); }
.rtl #nav li a { padding: 8px 36px 8px 14px; }

#content {
  margin: 0;
  padding: 26px 26px 30px;
  min-height: 320px;
  background: var(--rcm-surface);
  border: 1px solid var(--rcm-line);
  border-top: 1px solid var(--rcm-line);
  border-radius: 0 0 var(--rcm-radius) var(--rcm-radius);
  box-shadow: var(--rcm-shadow);
}
#footer { color: var(--rcm-muted); font-size: 12px; padding: 18px 0 6px; }
#footer a { color: var(--rcm-muted); }
#footer #poweredBy { opacity: .55; }

/* ---------- Buttons ---------- */
.button, .button:visited,
.green.button, .green.button:visited,
.blue.button, .blue.button:visited {
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 11px 20px;
  max-width: none;
  border: none;
  border-radius: var(--rcm-radius-sm);
  text-shadow: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .12);
  background-color: var(--rcm-primary);
  color: #fff;
  transition: background-color .15s ease, box-shadow .15s ease, transform .05s ease;
}
.button:hover, .blue.button:hover { background-color: var(--rcm-primary-600); color: #fff; text-decoration: none; }
.button:active { top: 0; transform: translateY(1px); }
.green.button, .green.button:visited { background-color: var(--rcm-surface); color: var(--rcm-primary); box-shadow: 0 0 0 1px var(--rcm-line-strong) inset; }
.green.button:hover { background-color: var(--rcm-primary-50); color: var(--rcm-primary-600); box-shadow: 0 0 0 1px var(--rcm-primary) inset; }

input[type="submit"], input[type="reset"], input[type="button"], button {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--rcm-radius-sm);
  border: 1px solid var(--rcm-line-strong);
  background: var(--rcm-surface);
  color: var(--rcm-text);
  cursor: pointer;
}
input[type="submit"], button[type="submit"] {
  background: var(--rcm-primary);
  border-color: var(--rcm-primary);
  color: #fff;
}
input[type="submit"]:hover, button[type="submit"]:hover { background: var(--rcm-primary-600); border-color: var(--rcm-primary-600); }
/* stock "#clientLogin div input" / "#ticketForm div input" (ID specificity) force a white background */
#clientLogin div input[type="submit"], #ticketForm div input[type="submit"], #clientLogin input.btn {
  background: var(--rcm-primary);
  border: 1px solid var(--rcm-primary);
  color: #fff;
  padding: 9px 22px;
  border-radius: var(--rcm-radius-sm);
}
#clientLogin div input[type="submit"]:hover, #ticketForm div input[type="submit"]:hover { background: var(--rcm-primary-600); }
#clientLogin div input[type="text"], #clientLogin div input[type="password"], #clientLogin div input[type="email"] {
  border: 1px solid var(--rcm-line-strong);
  border-radius: var(--rcm-radius-sm);
  padding: 9px 11px;
  width: 100%;
  box-sizing: border-box;
}
.login-box { box-shadow: none; border-right: 1px solid var(--rcm-line); padding-right: 22px; }
input[type="reset"]:hover, input[type="button"]:hover { border-color: var(--rcm-primary); color: var(--rcm-primary); }
.action-button {
  border-radius: var(--rcm-radius-sm);
  border: 1px solid var(--rcm-line-strong);
  background: var(--rcm-surface);
  box-shadow: none;
  padding: 4px 12px;
}
.action-button:hover { border-color: var(--rcm-primary); }

/* ---------- Forms ---------- */
input[type=text], input[type=password], input[type=email], input[type=tel],
input[type=number], input[type=search], input:not([type]), select, textarea {
  font-family: inherit;
  font-size: 14px;
  border: 1px solid var(--rcm-line-strong);
  border-radius: var(--rcm-radius-sm);
  background: var(--rcm-surface);
  color: var(--rcm-text);
  padding: 8px 10px;
  box-sizing: border-box;
  max-width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--rcm-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .18);
}
label.required, span.required, .required { color: var(--rcm-ink); }
.error, font.error, span.error { color: var(--rcm-danger); }
#ticketForm > table, #clientLogin { max-width: 100%; }
#ticketForm hr, #ticketTable hr { margin: 14px 0; }
div.form-header h3, .form-header h3 { margin-bottom: 4px; }
.redactor-box { border-radius: var(--rcm-radius-sm); overflow: hidden; border-color: var(--rcm-line-strong) !important; }
.redactor-toolbar { background: var(--rcm-surface-2) !important; box-shadow: none !important; }
.filedrop .dropzone { border-radius: var(--rcm-radius-sm); border-color: var(--rcm-line-strong); background: var(--rcm-surface-2); }

/* login / check status boxes */
#clientLogin {
  border: 1px solid var(--rcm-line);
  border-radius: var(--rcm-radius);
  background: var(--rcm-surface-2);
  box-shadow: none;
  padding: 22px;
  width: auto;
}
#clientLogin .instructions { border-color: var(--rcm-line); }
.login-box { width: auto; max-width: 340px; }

/* ---------- Banners ---------- */
#msg_notice, #msg_warning, .warning-banner, #msg_error, #msg_info,
.notice_bar, .warning_bar, .error_bar {
  border-radius: var(--rcm-radius-sm);
  border-left-width: 4px;
  padding-top: 10px;
  padding-bottom: 10px;
  height: auto;
  line-height: 1.4;
}
#msg_notice, .notice_bar { border-color: #86efac; border-left-color: var(--rcm-success); background-color: #f0fdf4; }
#msg_warning, .warning-banner, .warning_bar { border-color: #fcd34d; border-left-color: var(--rcm-warning); background-color: #fffbeb; }
#msg_error, .error_bar { border-color: #fca5a5; border-left-color: var(--rcm-danger); background-color: #fef2f2; }
#msg_info { border-color: var(--rcm-primary-100); border-left-color: var(--rcm-primary); background-color: var(--rcm-primary-50); color: #1e40af; }

/* ---------- Landing page ---------- */
#landing_page { display: flex; gap: 28px; align-items: flex-start; }
#landing_page .main-content { width: auto; flex: 1 1 auto; min-width: 0; order: 1; }
#landing_page .sidebar { width: 280px; flex: 0 0 280px; float: none; order: 2; margin: 0; }
#landing_page > .clear { display: none; }
.sidebar .front-page-button p { margin: 0 0 10px; }
.sidebar .front-page-button .button { text-align: center; }
.sidebar .content section {
  background: var(--rcm-surface-2);
  border: 1px solid var(--rcm-line);
  border-radius: var(--rcm-radius);
  padding: 14px 16px;
}
.sidebar section .header { color: var(--rcm-muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
#landing_page .thread-body { color: var(--rcm-text); }
#landing_page .thread-body h1, #landing_page .thread-body h2 { color: var(--rcm-ink); }
.search-form .search { border-radius: var(--rcm-radius-sm); }

/* PCC call-to-action (was inline-styled in index.php) */
.rcm-cta {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  margin: 0 0 24px;
  border-radius: var(--rcm-radius);
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: #fff !important;
  text-decoration: none !important;
  box-shadow: var(--rcm-shadow-lg);
  transition: transform .12s ease, box-shadow .12s ease;
}
.rcm-cta:hover { transform: translateY(-1px); box-shadow: 0 16px 32px -10px rgba(37, 99, 235, .45); }
.rcm-cta .rcm-cta-icon {
  flex: 0 0 44px; height: 44px; border-radius: 10px;
  background: rgba(255, 255, 255, .16);
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.rcm-cta .rcm-cta-text { flex: 1; }
.rcm-cta strong { display: block; font-size: 17px; font-weight: 700; }
.rcm-cta small { display: block; opacity: .85; font-size: 13px; margin-top: 2px; }
.rcm-cta .rcm-cta-arrow { font-size: 22px; opacity: .85; }

/* ---------- Ticket list ---------- */
#ticketTable {
  width: 100%;
  border: 1px solid var(--rcm-line);
  border-radius: var(--rcm-radius);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}
#ticketTable caption { color: var(--rcm-ink); font-weight: 600; font-size: 16px; text-align: left; padding: 6px 0 10px; background: none; border: none; }
#ticketTable th {
  background: var(--rcm-surface-2);
  color: var(--rcm-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  border: none;
  border-bottom: 1px solid var(--rcm-line);
  padding: 10px;
  height: auto;
}
#ticketTable th a { color: var(--rcm-muted); }
#ticketTable td { border: none; border-bottom: 1px solid var(--rcm-line); padding: 10px; background: var(--rcm-surface); }
#ticketTable tr.alt td { background: var(--rcm-surface); }
#ticketTable tbody tr:hover td { background: var(--rcm-primary-50); }
#ticketTable tbody tr:last-child td { border-bottom: none; }
.search.well { background: var(--rcm-surface-2); border: 1px solid var(--rcm-line); border-radius: var(--rcm-radius); padding: 12px; }
.states small { color: var(--rcm-muted); }
.active.state { color: var(--rcm-primary); font-weight: 600; }
#pagination li a, #pagination .active { border-radius: 6px; }
#pagination .active { background: var(--rcm-primary); border-color: var(--rcm-primary); }

/* ---------- Ticket view ---------- */
#ticketInfo, #ticketInfo table, #content table[width="800"] { width: 100%; }
#ticketInfo h1 { color: var(--rcm-ink); }
table.infoTable, table.custom-data {
  background: var(--rcm-surface-2);
  border: 1px solid var(--rcm-line);
  border-radius: var(--rcm-radius);
  padding: 8px 12px;
}
.infoTable th, table.custom-data th { color: var(--rcm-muted); font-weight: 600; }
table.custom-data .headline { border-color: var(--rcm-line); color: var(--rcm-ink); }

.thread-entry .header {
  border: 1px solid var(--rcm-line);
  border-radius: var(--rcm-radius) var(--rcm-radius) 0 0;
  padding: 10px 14px;
}
.thread-entry .thread-body {
  border: 1px solid var(--rcm-line);
  border-top: none;
  border-radius: 0 0 var(--rcm-radius) var(--rcm-radius);
  background: var(--rcm-surface);
  box-shadow: var(--rcm-shadow);
}
.thread-entry.message .header { background: #e0ecff; border-color: #c7dbff; }
.thread-entry.response .header { background: #f1f5f9; border-color: var(--rcm-line); }
.thread-entry.avatar.message .header:before { border-right-color: #c7dbff; border-left-color: #c7dbff; }
.thread-entry.avatar.message .header:after { border-right-color: #e0ecff; border-left-color: #e0ecff; }
.thread-entry.avatar.response .header:after { border-left-color: #f1f5f9; }
.avatar, img.avatar { border-radius: 50%; }
.thread-body .attachments { background: var(--rcm-surface-2); border-top: 1px solid var(--rcm-line); }
#reply { border-radius: var(--rcm-radius); }
#reply h2 { font-size: 18px; }

/* ---------- Closed-ticket widgets (reopen + survey) ---------- */
.rcm-closed-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 18px 0 22px;
}
.rcm-panel {
  border: 1px solid var(--rcm-line);
  border-radius: var(--rcm-radius);
  background: var(--rcm-surface);
  box-shadow: var(--rcm-shadow);
  padding: 18px 20px;
}
.rcm-panel h4 { margin: 0 0 4px; font-size: 15px; color: var(--rcm-ink); }
.rcm-panel p { margin: 0 0 14px; color: var(--rcm-muted); font-size: 14px; }
.rcm-panel form { margin: 0; }
.rcm-panel.reopen { border-left: 4px solid var(--rcm-warning); }
.rcm-panel.survey { border-left: 4px solid var(--rcm-primary); }
.rcm-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px !important;
  border-radius: var(--rcm-radius-sm) !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  cursor: pointer;
  border: 1px solid var(--rcm-line-strong) !important;
  background: var(--rcm-surface) !important;
  color: var(--rcm-text) !important;
}
.rcm-btn:hover { border-color: var(--rcm-primary) !important; color: var(--rcm-primary) !important; }
.rcm-btn.warn { background: var(--rcm-warning) !important; border-color: var(--rcm-warning) !important; color: #fff !important; }
.rcm-btn.warn:hover { background: #b45309 !important; border-color: #b45309 !important; color: #fff !important; }
.rcm-btn.good:hover { border-color: var(--rcm-success) !important; color: var(--rcm-success) !important; background: #f0fdf4 !important; }
.rcm-btn.bad:hover { border-color: var(--rcm-danger) !important; color: var(--rcm-danger) !important; background: #fef2f2 !important; }
.rcm-btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.rcm-thanks { display: inline-flex; align-items: center; gap: 8px; color: var(--rcm-success); font-weight: 600; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  #container { margin: 0 auto; padding: 0; }
  #header, #nav, #content { border-radius: 0; border-left: none; border-right: none; }
  #header { flex-direction: column-reverse; align-items: flex-start; }
  #content { padding: 18px 16px 24px; }
  #landing_page { flex-direction: column; }
  #landing_page .sidebar { width: 100%; flex-basis: auto; order: 0; }
  .sidebar .front-page-button { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .sidebar .front-page-button p { margin: 0; }
  .rcm-closed-panel { grid-template-columns: 1fr; }
  #ticketTable { display: block; overflow-x: auto; }
  #ticketForm > table, #ticketForm > table tbody, #ticketForm > table tr, #ticketForm > table td { display: block; width: auto !important; }
  table.infoTable, table.custom-data { width: 100% !important; }
  #ticketInfo > tbody > tr > td { display: block; width: auto !important; }
  table.custom-data td, table.infoTable td { word-break: break-word; }
  #ticketInfo h1 { font-size: 22px; }
  .main-content { width: auto; }
  input[type=text], input[type=email], input[type=password], select, textarea { width: 100%; }
  .thread-entry.avatar, .thread-entry.response.avatar, .thread-entry.message.avatar { margin-left: 0; margin-right: 0; }
  .thread-entry > .avatar { display: none; }
  .thread-entry.avatar .header:before, .thread-entry.avatar .header:after { display: none; }
}
