/* ============================================================================
   HCS Bahrain — osTicket Client Portal Theme
   Matches the HCS Design System v1.0
   ============================================================================ */

/* ---------------------------------------------------------------------------
   1. DESIGN TOKENS
   --------------------------------------------------------------------------- */
:root {
  /* Backgrounds */
  --hcs-bg-deep: #141F28;
  --hcs-bg-elevated: #1E3040;
  --hcs-bg-anchor: #253846;
  --hcs-bg-subtle: #2E4A5C;
  --hcs-bg-darker: #0E1920;

  /* Accents */
  --hcs-gold: #B8A06A;
  --hcs-gold-light: #D4BC82;
  --hcs-gold-muted: #8A7350;
  --hcs-gold-text: #B8A06A;

  /* Borders */
  --hcs-border-min: rgba(46, 74, 92, 0.35);
  --hcs-border-std: rgba(46, 74, 92, 0.6);
  --hcs-border-strong: rgba(46, 74, 92, 1);
  --hcs-border-gold-resting: rgba(184, 160, 106, 0.2);
  --hcs-border-gold-active: rgba(184, 160, 106, 0.55);
  --hcs-border-gold-focus: rgba(184, 160, 106, 0.8);

  /* Text */
  --hcs-text-primary: #EEE9E0;
  --hcs-text-secondary: #8FA0AE;
  --hcs-text-label: #C8D0D8;
  --hcs-text-muted: #4A6275;
  --hcs-text-dark: #1A2B38;

  /* Status */
  --hcs-error: #E07070;
  --hcs-success: #B8A06A;

  /* Motion */
  --hcs-transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --hcs-transition-premium: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------------------------------------------------------------------------
   2. GLOBAL RESET & BASE
   --------------------------------------------------------------------------- */
body,
html {
  background: var(--hcs-bg-deep) !important;
  color: var(--hcs-text-secondary) !important;
  font-family: "Inter", system-ui, -apple-system, sans-serif !important;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#container,
#wrap,
#layout,
.container,
#content {
  background: transparent !important;
  color: var(--hcs-text-secondary);
}

/* Global hero/page background gradient */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, var(--hcs-bg-darker) 0%, var(--hcs-bg-deep) 100%);
  z-index: -1;
  pointer-events: none;
}

/* ---------------------------------------------------------------------------
   3. TYPOGRAPHY
   --------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6,
.page-title,
.title {
  font-family: "Space Grotesk", "Inter", system-ui, sans-serif !important;
  font-weight: 700 !important;
  color: var(--hcs-text-primary) !important;
  letter-spacing: -0.03em !important;
  line-height: 1.15 !important;
}

h1, .page-title { font-size: 2.25rem !important; }
h2 { font-size: 1.875rem !important; }
h3 { font-size: 1.5rem !important; }
h4 { font-size: 1.125rem !important; }
h5 { font-size: 1rem !important; }

p, li, td, span, div {
  color: var(--hcs-text-secondary);
}

a {
  color: var(--hcs-gold);
  text-decoration: none;
  transition: color 0.2s var(--hcs-transition-smooth);
}

a:hover,
a:focus {
  color: var(--hcs-gold-light);
  text-decoration: none;
}

strong, b {
  color: var(--hcs-text-primary);
  font-weight: 600;
}

/* Selection */
::selection {
  background-color: var(--hcs-gold);
  color: var(--hcs-bg-deep);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--hcs-bg-deep); }
::-webkit-scrollbar-thumb {
  background: var(--hcs-text-muted);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--hcs-gold-muted); }

/* ---------------------------------------------------------------------------
   4. HEADER
   --------------------------------------------------------------------------- */
#header {
  background: rgba(14, 25, 32, 0.95) !important;
  border-bottom: 1px solid var(--hcs-border-std) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 1.25rem 2rem !important;
  box-shadow: none !important;
}

#header a,
#header h1 {
  color: var(--hcs-text-primary) !important;
  font-family: "Space Grotesk", sans-serif !important;
  font-weight: 700;
  letter-spacing: -0.02em;
}

#header img {
  max-height: 48px;
  width: auto;
}

/* ---------------------------------------------------------------------------
   5. NAVIGATION
   --------------------------------------------------------------------------- */
#nav,
.nav,
ul.nav,
#header ul {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

#nav ul, #nav li, .nav li {
  background: transparent !important;
  border: none !important;
}

#nav a, .nav a, #header ul a {
  color: var(--hcs-text-secondary) !important;
  font-family: "Inter", sans-serif !important;
  font-weight: 500;
  font-size: 0.875rem;
  text-transform: none;
  letter-spacing: 0;
  padding: 0.5rem 1rem !important;
  background: transparent !important;
  border-radius: 0.375rem;
  transition: all 0.22s var(--hcs-transition-premium);
}

#nav a:hover, .nav a:hover {
  color: var(--hcs-text-primary) !important;
  background: rgba(184, 160, 106, 0.05) !important;
}

#nav a.active, .nav a.active,
#nav li.active a {
  color: var(--hcs-gold) !important;
  background: transparent !important;
}

/* Top navigation tabs */
.tabs, ul.tabs {
  background: transparent !important;
  border-bottom: 1px solid var(--hcs-border-std) !important;
}

ul.tabs li a {
  color: var(--hcs-text-secondary) !important;
  background: transparent !important;
  border: none !important;
  font-weight: 500;
  padding: 0.75rem 1.25rem !important;
}

ul.tabs li.active a {
  color: var(--hcs-gold) !important;
  border-bottom: 2px solid var(--hcs-gold) !important;
  background: transparent !important;
}

/* ---------------------------------------------------------------------------
   6. CARDS, PANELS, CONTAINERS
   --------------------------------------------------------------------------- */
.content,
#content > div,
.panel,
.box,
#main-content,
.dialog,
.section {
  background: var(--hcs-bg-elevated) !important;
  border: 1px solid var(--hcs-border-std) !important;
  border-radius: 0.5rem !important;
  color: var(--hcs-text-secondary) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  transition: all 0.25s var(--hcs-transition-smooth);
}

.faded {
  background: var(--hcs-bg-anchor) !important;
  border-color: var(--hcs-border-min) !important;
}

/* Featured / accent cards */
.featured,
.highlight {
  border-color: var(--hcs-border-gold-resting) !important;
}

/* ---------------------------------------------------------------------------
   7. BUTTONS
   --------------------------------------------------------------------------- */
button,
.button,
input[type="submit"],
input[type="button"],
a.button,
a.action-button {
  background: linear-gradient(135deg, var(--hcs-gold) 0%, var(--hcs-gold-muted) 100%) !important;
  color: var(--hcs-bg-deep) !important;
  border: none !important;
  border-radius: 0.25rem !important;
  font-family: "Inter", sans-serif !important;
  font-weight: 600 !important;
  font-size: 0.875rem !important;
  padding: 0.75rem 1.5rem !important;
  cursor: pointer;
  letter-spacing: 0.01em;
  text-transform: none;
  transition: all 0.22s var(--hcs-transition-premium);
  box-shadow: none;
  text-shadow: none;
}

button:hover,
.button:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
a.button:hover,
a.action-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(184, 160, 106, 0.3);
  background: linear-gradient(135deg, var(--hcs-gold-light) 0%, var(--hcs-gold) 100%) !important;
  color: var(--hcs-bg-deep) !important;
}

button:active,
.button:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(184, 160, 106, 0.2);
}

button:disabled,
.button:disabled,
input[type="submit"]:disabled {
  opacity: 0.7 !important;
  cursor: not-allowed !important;
  transform: none !important;
  box-shadow: none !important;
}

/* Secondary / Ghost buttons */
.button.secondary,
a.button.secondary,
button.secondary,
.cancel,
a.cancel {
  background: transparent !important;
  border: 1px solid var(--hcs-border-gold-resting) !important;
  color: var(--hcs-text-secondary) !important;
}

.button.secondary:hover,
a.button.secondary:hover,
button.secondary:hover,
.cancel:hover,
a.cancel:hover {
  border-color: var(--hcs-border-gold-active) !important;
  color: var(--hcs-text-primary) !important;
  background: transparent !important;
  box-shadow: none;
}

/* ---------------------------------------------------------------------------
   8. FORMS — INPUTS, TEXTAREAS, SELECTS
   --------------------------------------------------------------------------- */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="date"],
input[type="datetime-local"],
textarea,
select,
.form-control {
  background: rgba(46, 74, 92, 0.3) !important;
  border: 1px solid rgba(46, 74, 92, 0.8) !important;
  border-radius: 0.375rem !important;
  color: var(--hcs-text-primary) !important;
  font-family: "Inter", sans-serif !important;
  font-size: 0.875rem !important;
  padding: 0.75rem 1rem !important;
  outline: none !important;
  box-shadow: none !important;
  transition: border-color 0.2s var(--hcs-transition-smooth);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
textarea:focus,
select:focus {
  border-color: var(--hcs-gold) !important;
  background: rgba(46, 74, 92, 0.45) !important;
  box-shadow: 0 0 0 3px rgba(184, 160, 106, 0.1) !important;
}

input[type="text"]:hover,
textarea:hover,
select:hover {
  border-color: rgba(46, 74, 92, 1) !important;
}

select option {
  background: var(--hcs-bg-elevated) !important;
  color: var(--hcs-text-primary) !important;
}

textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
}

/* Labels */
label,
.label,
form label {
  color: var(--hcs-text-secondary) !important;
  font-family: "Inter", sans-serif !important;
  font-weight: 600 !important;
  font-size: 0.75rem !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
  display: inline-block;
}

label.required em,
.required {
  color: var(--hcs-gold) !important;
  font-style: normal;
}

/* Checkboxes & radios */
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--hcs-gold);
  width: 1rem;
  height: 1rem;
  margin-right: 0.5rem;
  vertical-align: middle;
}

/* Captcha display */
.captcha {
  background: var(--hcs-bg-subtle) !important;
  border: 1px solid var(--hcs-border-std) !important;
  border-radius: 0.375rem !important;
  padding: 0.5rem !important;
}

/* ---------------------------------------------------------------------------
   9. TABLES
   --------------------------------------------------------------------------- */
table,
table.list,
table.ticket-table {
  background: var(--hcs-bg-elevated) !important;
  border: 1px solid var(--hcs-border-std) !important;
  border-radius: 0.5rem !important;
  border-collapse: separate !important;
  border-spacing: 0;
  overflow: hidden;
  width: 100%;
}

table thead,
table th {
  background: var(--hcs-bg-anchor) !important;
  color: var(--hcs-text-label) !important;
  font-family: "Inter", sans-serif !important;
  font-weight: 600 !important;
  font-size: 0.75rem !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.875rem 1rem !important;
  border-bottom: 1px solid var(--hcs-border-std) !important;
  text-align: left;
}

table td {
  background: transparent !important;
  color: var(--hcs-text-secondary) !important;
  padding: 0.875rem 1rem !important;
  border-bottom: 1px solid var(--hcs-border-min) !important;
}

table tr:hover td {
  background: rgba(184, 160, 106, 0.03) !important;
  color: var(--hcs-text-primary) !important;
}

table tr:last-child td {
  border-bottom: none !important;
}

table a {
  color: var(--hcs-gold) !important;
  font-weight: 500;
}

/* ---------------------------------------------------------------------------
   10. ALERTS, MESSAGES, NOTIFICATIONS
   --------------------------------------------------------------------------- */
.error,
.errors,
#msg_error,
.msg_error,
.alert-error {
  background: rgba(224, 112, 112, 0.08) !important;
  border: 1px solid rgba(224, 112, 112, 0.3) !important;
  color: var(--hcs-error) !important;
  border-radius: 0.375rem !important;
  padding: 0.875rem 1.25rem !important;
  border-left: 3px solid var(--hcs-error) !important;
}

.success,
#msg_notice,
.msg_notice,
.notice,
.alert-success,
.alert {
  background: rgba(184, 160, 106, 0.08) !important;
  border: 1px solid var(--hcs-border-gold-resting) !important;
  color: var(--hcs-gold) !important;
  border-radius: 0.375rem !important;
  padding: 0.875rem 1.25rem !important;
  border-left: 3px solid var(--hcs-gold) !important;
}

.warning,
#msg_warning,
.msg_warning {
  background: rgba(184, 160, 106, 0.05) !important;
  border: 1px solid var(--hcs-border-gold-resting) !important;
  color: var(--hcs-text-primary) !important;
  border-radius: 0.375rem !important;
  padding: 0.875rem 1.25rem !important;
}

/* ---------------------------------------------------------------------------
   11. TICKET-SPECIFIC ELEMENTS
   --------------------------------------------------------------------------- */
.thread-body,
.thread-entry,
.message {
  background: var(--hcs-bg-elevated) !important;
  border: 1px solid var(--hcs-border-std) !important;
  border-radius: 0.5rem !important;
  padding: 1.25rem !important;
  margin-bottom: 1rem;
  color: var(--hcs-text-secondary);
}

.thread-body.message {
  border-left: 3px solid var(--hcs-gold) !important;
}

.thread-body.response {
  background: var(--hcs-bg-anchor) !important;
  border-left: 3px solid var(--hcs-text-muted) !important;
}

.thread-body h3,
.thread-body h4 {
  color: var(--hcs-text-primary) !important;
  margin-top: 0;
}

/* Ticket status indicators */
.status,
.priority {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  border-radius: 0.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(184, 160, 106, 0.1);
  color: var(--hcs-gold);
  border: 1px solid var(--hcs-border-gold-resting);
}

/* ---------------------------------------------------------------------------
   12. SECTION HEADERS & DIVIDERS
   --------------------------------------------------------------------------- */
.section-header,
.subhead,
legend {
  font-family: "Space Grotesk", sans-serif !important;
  font-weight: 700 !important;
  color: var(--hcs-text-primary) !important;
  font-size: 1.25rem !important;
  letter-spacing: -0.02em;
  padding-bottom: 0.75rem;
  margin-bottom: 1.25rem;
  position: relative;
}

.section-header::after,
.subhead::after,
legend::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 48px;
  height: 2px;
  background: var(--hcs-gold);
}

hr {
  border: none;
  border-top: 1px solid var(--hcs-border-min);
  margin: 1.5rem 0;
}

/* ---------------------------------------------------------------------------
   13. FOOTER
   --------------------------------------------------------------------------- */
#footer,
.footer {
  background: var(--hcs-bg-darker) !important;
  border-top: 1px solid var(--hcs-border-std) !important;
  color: var(--hcs-text-muted) !important;
  padding: 2rem !important;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  margin-top: 4rem;
}

#footer a, .footer a {
  color: var(--hcs-text-secondary) !important;
}

#footer a:hover, .footer a:hover {
  color: var(--hcs-gold) !important;
}

/* osTicket attribution — kept subtle but legible per their license */
.poweredBy a {
  color: var(--hcs-text-muted) !important;
  font-size: 0.7rem;
}

/* ---------------------------------------------------------------------------
   14. FOCUS RING (Accessibility)
   --------------------------------------------------------------------------- */
*:focus-visible {
  outline: 2px solid var(--hcs-gold) !important;
  outline-offset: 2px !important;
  border-radius: 2px;
}

/* ---------------------------------------------------------------------------
   15. UTILITIES & MISC
   --------------------------------------------------------------------------- */
.faded, .muted, small {
  color: var(--hcs-text-muted) !important;
}

code, pre, kbd, samp {
  background: var(--hcs-bg-darker) !important;
  color: var(--hcs-gold-light) !important;
  border: 1px solid var(--hcs-border-std) !important;
  border-radius: 0.25rem;
  padding: 0.125rem 0.375rem;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85em;
}

blockquote {
  border-left: 3px solid var(--hcs-gold) !important;
  background: var(--hcs-bg-anchor) !important;
  padding: 1rem 1.25rem !important;
  margin: 1rem 0;
  border-radius: 0 0.375rem 0.375rem 0;
  color: var(--hcs-text-primary);
}

/* Knowledge base / FAQ items */
.faq-item,
.kb-item {
  background: var(--hcs-bg-elevated) !important;
  border: 1px solid var(--hcs-border-std) !important;
  border-radius: 0.5rem;
  padding: 1.25rem;
  margin-bottom: 0.75rem;
  transition: all 0.25s var(--hcs-transition-smooth);
}

.faq-item:hover,
.kb-item:hover {
  border-color: var(--hcs-border-strong) !important;
  background: var(--hcs-bg-anchor) !important;
  transform: translateY(-2px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
}

/* Pagination */
.pagination a, .pagination span {
  background: var(--hcs-bg-elevated) !important;
  border: 1px solid var(--hcs-border-std) !important;
  color: var(--hcs-text-secondary) !important;
  padding: 0.5rem 0.875rem !important;
  margin: 0 0.125rem;
  border-radius: 0.25rem;
}

.pagination a:hover,
.pagination .active {
  background: var(--hcs-gold) !important;
  border-color: var(--hcs-gold) !important;
  color: var(--hcs-bg-deep) !important;
}

/* Breadcrumbs */
.breadcrumb {
  background: transparent !important;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--hcs-text-muted) !important;
  margin-bottom: 1.5rem;
}

.breadcrumb a {
  color: var(--hcs-gold) !important;
}

/* Search box */
input[type="search"],
.searchbar input {
  background: rgba(46, 74, 92, 0.5) !important;
  padding-left: 2.5rem !important;
}

/* ---------------------------------------------------------------------------
   16. RESPONSIVE
   --------------------------------------------------------------------------- */
@media (max-width: 768px) {
  body { font-size: 14px; }
  h1, .page-title { font-size: 1.75rem !important; }
  h2 { font-size: 1.5rem !important; }
  h3 { font-size: 1.25rem !important; }

  #header { padding: 1rem !important; }

  .content,
  .panel,
  .box {
    padding: 1rem !important;
  }
}

/* ---------------------------------------------------------------------------
   17. DARK MODE PROTECTION — ensure light-on-dark legibility everywhere
   --------------------------------------------------------------------------- */
* {
  -webkit-text-fill-color: initial;
}

/* osTicket sometimes uses inline background colors; force override on common offenders */
[style*="background-color: #fff"],
[style*="background-color: #ffffff"],
[style*="background-color: white"],
[style*="background: #fff"],
[style*="background: #ffffff"],
[style*="background: white"] {
  background-color: var(--hcs-bg-elevated) !important;
}

/* Force readable text on any element with inline dark text */
[style*="color: #000"],
[style*="color: black"],
[style*="color: #333"],
[style*="color: #222"] {
  color: var(--hcs-text-primary) !important;
}
