@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

/* ================= Brand ================= */
:root {
  --cl-cyan: #55D8EA;
  --cl-blue: #20B0F5;
  --cl-blue-deep: #17A8F8;
  --cl-link: #0B8FD4;
  --cl-black: #111111;
  --cl-grey: #6b7280;
  --cl-bg: #f4f8fb;
}

body, input, select, textarea, button, .button, a.button,
#container, #nav, #footer, h1, h2, h3, p {
  font-family: 'Poppins', 'Segoe UI', Arial, sans-serif !important;
}
body { background: var(--cl-bg); color: var(--cl-black); }
img { max-width: 100%; height: auto; }

#container {
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(17,17,17,.08);
  overflow: hidden;
}

/* ================= Header ================= */
#header { padding: 16px 20px; }
#header #logo img { max-height: 60px; width: auto; }

/* ================= Nav ================= */
#nav {
  background: var(--cl-black) !important;
  border: none;
  border-radius: 8px;
  box-shadow: none;
  height: auto !important;
  padding: 6px !important;
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}
#nav li { float: none !important; margin: 0 !important; display: block; }
#nav li a {
  background-image: none !important;
  background-color: transparent;
  color: #fff !important;
  font-weight: 500;
  display: inline-flex !important;
  align-items: center;
  gap: 7px;
  padding: 6px 12px !important;
  height: auto !important;
  line-height: 1.4 !important;
  border-radius: 6px;
}
#nav li a.active, #nav li a:hover {
  background-color: var(--cl-blue) !important;
  color: var(--cl-black) !important;
}

/* ================= Icons ================= */
#nav li a::before,
#landing_page a.button::before {
  content: "";
  width: 16px; height: 16px;
  flex-shrink: 0;
  background-color: currentColor;
  -webkit-mask: var(--icon) no-repeat center / contain;
          mask: var(--icon) no-repeat center / contain;
}
#nav li a.home {
  --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 10a2 2 0 0 1 .7-1.5l7-6a2 2 0 0 1 2.6 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/><path d='M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8'/></svg>");
}
#nav li a.new, #landing_page a.button.blue {
  --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z'/><path d='M9 12h6'/><path d='M12 9v6'/></svg>");
}
#nav li a.status, #landing_page a.button.green {
  --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/><path d='m8 11 2 2 4-4'/></svg>");
}

/* ================= Text & links ================= */
h1, h2, h3 { color: var(--cl-black); font-weight: 600; }
a { color: var(--cl-link); }
a:hover { color: var(--cl-black); }

/* ================= Buttons ================= */
input[type="submit"], input[type="button"], input[type="reset"], .button, button {
  background: linear-gradient(135deg, var(--cl-cyan), var(--cl-blue-deep)) !important;
  color: var(--cl-black) !important;
  font-weight: 600;
  border: none !important;
  border-radius: 8px;
  padding: 9px 18px;
  cursor: pointer;
  text-shadow: none !important;
}
input[type="submit"]:hover, input[type="button"]:hover, .button:hover, button:hover {
  background: var(--cl-black) !important;
  color: #fff !important;
}

/* Home page big buttons */
#landing_page a.button {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  font-size: 15px !important;
  padding: 11px 14px !important;
  box-sizing: border-box;
}
#landing_page a.button::before { width: 18px; height: 18px; }
#landing_page a.button.green { background: var(--cl-black) !important; color: #fff !important; }
#landing_page a.button.green:hover { background: var(--cl-blue) !important; color: var(--cl-black) !important; }

/* ================= Forms ================= */
input[type="text"], input[type="email"], input[type="tel"], input[type="password"], select, textarea {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 6px 8px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--cl-blue);
  box-shadow: 0 0 0 3px rgba(32,176,245,.2);
}

/* ================= Footer ================= */
#footer, #footer a { color: var(--cl-grey); }

/* ================= Mobile ================= */
@media (max-width: 860px) {
  #container {
    width: auto !important;
    max-width: 100% !important;
    margin: 0 !important;
    border-radius: 0;
  }

  /* Header: logo left, sign-in right */
  #header { padding: 12px 14px !important; height: auto !important; overflow: hidden; }
  #header #logo { float: left !important; height: auto !important; }
  #header #logo .valign-helper { display: none; }
  #header #logo img { max-height: 42px; }
  #header .pull-right.flush-right { float: right !important; font-size: 13px; }
  #header .pull-right.flush-right p { margin: 10px 0 0 0 !important; }
  #header .pull-right.flush-right p:empty { display: none; }

  /* Nav: app-style tab bar */
  #nav {
    display: grid !important;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    margin: 0 14px !important;
  }
  #nav li { width: 100%; }
  #nav li a {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
    gap: 4px;
    padding: 8px 4px !important;
    font-size: 12px !important;
    line-height: 1.25 !important;
    text-align: center;
  }
  #nav li a::before { width: 20px; height: 20px; }

  /* Content */
  #content { padding: 14px !important; }
  #landing_page .sidebar,
  #landing_page .front-page-button,
  #landing_page .front-page-button p,
  #landing_page .main-content,
  #landing_page .thread-body {
    float: none !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  #landing_page .front-page-button p { margin-bottom: 10px !important; }
  #landing_page a.button {
    width: 100% !important;
    max-width: none !important;
    padding: 14px !important;
    font-size: 16px !important;
  }
  #landing_page .thread-body h1 { font-size: 1.5em; margin: 18px 0 8px; }

  /* Forms */
  form table, form tbody, form tr, form td, form th {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box;
  }
  input[type="text"], input[type="email"], input[type="tel"], input[type="password"],
  select, textarea, .redactor-box {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }
}

/* Header row: logo left, sign-in right (header contains only these two) */
@media (max-width: 860px) {
  #header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }
  #header #logo { order: 1; float: none !important; margin: 0 !important; }
  #header .pull-right.flush-right { order: 2; float: none !important; margin: 0 !important; }
  #header .pull-right.flush-right p { margin: 0 !important; }
}

/* ===== Check Ticket Status / login card ===== */
#clientLogin {
  background: #fff !important;
  background-image: none !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(17,17,17,.06) !important;
  padding: 24px !important;
  width: auto !important;
  max-width: 100%;
  box-sizing: border-box;
}
#clientLogin > div {
  display: flex !important;
  gap: 28px;
  align-items: flex-start;
}
#clientLogin .login-box {
  flex: 1 1 0;
  width: auto !important;
  box-shadow: none !important;
  background: none !important;
  padding: 0 28px 0 0 !important;
  border-right: 1px solid #e5e7eb;
}
#clientLogin .login-box > div { margin-bottom: 14px; }
#clientLogin label { display: block; font-weight: 500; font-size: 14px; }
#clientLogin input[type="text"] {
  width: 100% !important;
  box-sizing: border-box;
  margin-top: 6px;
  padding: 10px 12px !important;
}
#clientLogin input.btn {
  width: 100%;
  padding: 12px !important;
  font-size: 15px;
}
#clientLogin .instructions {
  flex: 1 1 0;
  background: none !important;
  background-image: none !important;
  padding: 0 !important;
  width: auto !important;
  font-size: 14px;
  line-height: 1.6;
  color: var(--cl-grey);
}
/* Modern lock icon */
#clientLogin .instructions::before {
  content: "";
  display: block;
  width: 32px; height: 32px;
  margin-bottom: 10px;
  background-color: var(--cl-blue);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect width='18' height='11' x='3' y='11' rx='2' ry='2'/><path d='M7 11V7a5 5 0 0 1 10 0v4'/></svg>") no-repeat center / contain;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect width='18' height='11' x='3' y='11' rx='2' ry='2'/><path d='M7 11V7a5 5 0 0 1 10 0v4'/></svg>") no-repeat center / contain;
}

@media (max-width: 860px) {
  #clientLogin { padding: 18px !important; }
  #clientLogin > div { flex-direction: column; gap: 18px; }
  #clientLogin .login-box {
    padding: 0 0 18px 0 !important;
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
    width: 100% !important;
  }
  #clientLogin .instructions { width: 100% !important; }
}

/* ===== Mobile fixes: header width + nav fit ===== */
@media (max-width: 860px) {
  #header {
    width: auto !important;
    max-width: 100% !important;
    box-sizing: border-box;
    overflow: visible !important;
  }
  #header #logo { width: auto !important; min-width: 0; flex: 0 1 auto; }
  #header .pull-right.flush-right {
    width: auto !important;
    flex: 0 0 auto;
    text-align: right;
  }

  #nav {
    grid-auto-columns: minmax(0, 1fr) !important;
    margin: 0 12px !important;
    box-sizing: border-box;
  }
  #nav li { min-width: 0; }
  #nav li a {
    font-size: 11.5px !important;
    padding: 8px 2px !important;
    overflow-wrap: anywhere;
  }
}

/* ===== Open a New Ticket form ===== */
#ticketForm {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(17,17,17,.06);
  padding: 8px 24px 20px;
  box-sizing: border-box;
}
#ticketForm table { width: 100% !important; border-collapse: collapse; }
#ticketForm td { padding: 6px 0 !important; }
#ticketForm hr { border: none; border-top: 1px solid #e5e7eb; margin: 16px 0 10px; }

/* Section titles */
#ticketForm .form-header h3,
#ticketForm .form-header b {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: var(--cl-black);
  margin: 0;
}

/* Labels + fields */
#ticketForm label { display: block; font-weight: 500; font-size: 14px; }
#ticketForm label br { display: none; }
#ticketForm .error { color: #e11d48; }
#ticketForm input[type="text"],
#ticketForm input[type="email"],
#ticketForm input[type="tel"],
#ticketForm select,
#ticketForm textarea {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
  margin-top: 6px;
  padding: 10px 12px !important;
  font-size: 14px;
}
#ticketForm select#topicId { width: calc(100% - 20px) !important; }

/* Phone + Ext on one row */
#ticketForm input[type="tel"] { width: calc(100% - 130px) !important; display: inline-block; }
#ticketForm input[name$="-ext"] { width: 80px !important; display: inline-block; }

/* Rich text editor + attachments */
#ticketForm .redactor-box, #ticketForm .redactor-editor, #ticketForm .redactor-layer {
  border-radius: 8px;
  border-color: #d1d5db !important;
}
#ticketForm .filedrop, #ticketForm .dropzone {
  border: 2px dashed #cbd5e1 !important;
  border-radius: 8px;
  background: #f8fafc !important;
}

/* Buttons */
#ticketForm p.buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 16px 0 0;
}
#ticketForm p.buttons input { padding: 11px 22px !important; font-size: 15px; margin: 0 !important; }
#ticketForm p.buttons input[type="reset"],
#ticketForm p.buttons input[type="button"] {
  background: #fff !important;
  color: var(--cl-black) !important;
  border: 1px solid #d1d5db !important;
}
#ticketForm p.buttons input[type="reset"]:hover,
#ticketForm p.buttons input[type="button"]:hover {
  background: #f3f4f6 !important;
  color: var(--cl-black) !important;
}

@media (max-width: 860px) {
  #ticketForm { padding: 4px 16px 16px; }
  #ticketForm p.buttons { flex-direction: column; }
  #ticketForm p.buttons input { width: 100%; }
}

/* ===== Real-phone fixes ===== */
html { -webkit-text-size-adjust: 100%; }

@media (max-width: 860px) {
  /* Header: hide "Guest User |", keep only Sign In / account links */
  #header .pull-right.flush-right p { font-size: 0 !important; }
  #header .pull-right.flush-right p a {
    font-size: 14px !important;
    font-weight: 600;
  }

  /* Nav: short labels on mobile (icon stays from ::before) */
  #nav li a { font-size: 0 !important; white-space: normal !important; }
  #nav li a::after { font-size: 12px; line-height: 1.2; }
  #nav li a.home::after   { content: "Home"; }
  #nav li a.new::after    { content: "New Ticket"; }
  #nav li a.status::after { content: "Status"; }
  #nav li a.kb::after     { content: "Help"; }

  /* Phone number: label on top, phone + ext on one row */
  #ticketForm label > span { display: block; margin-bottom: 6px; }
  #ticketForm input[type="tel"] {
    width: calc(100% - 115px) !important;
    display: inline-block !important;
    margin-right: 6px;
  }
  #ticketForm input[name$="-ext"] {
    width: 70px !important;
    display: inline-block !important;
  }
}

/* Desktop: label on top too (keeps form consistent) */
#ticketForm label > span { display: block; margin-bottom: 4px; }

/* ===== Fit header + nav to screen width ===== */
@media (max-width: 860px) {
  #header {
    width: auto !important;
    margin: 0 !important;
    padding: 12px 16px !important;
    box-sizing: border-box !important;
  }
  #header #logo {
    flex: 1 1 auto;
    min-width: 0;
    width: auto !important;
    overflow: hidden;
  }
  #header #logo img { max-width: 100%; max-height: 40px; }
  #header .pull-right.flush-right {
    flex: 0 0 auto;
    width: auto !important;
    padding: 0 !important;
  }

  #nav {
    width: auto !important;
    max-width: none !important;
    margin: 0 12px !important;
    box-sizing: border-box !important;
  }
  #nav li a { box-sizing: border-box; }
}

/* Theme forces #header p to 400px - release it on mobile */
@media (max-width: 860px) {
  #header p { width: auto !important; padding: 0 !important; }
  #header { height: auto !important; }
  #header #logo { height: auto !important; }
}

/* Nav: remove theme margins so tabs stay inside the bar */
@media (max-width: 860px) {
  #nav { padding: 6px !important; }
  #nav li { margin: 0 !important; padding: 0 !important; min-width: 0; width: auto !important; }
  #nav li a {
    margin: 0 !important;
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box !important;
  }
}
