/*
  Custom styles for Hyper Clean TX
  These styles complement Tailwind CSS utility classes to give the site a unique look and feel reminiscent of the current hypercleantx.com design.  
  We use CSS variables for colors so they can be easily adjusted if the brand palette changes.
*/

:root {
  /* Color palette: dark primary background and warm golden accent */
  --primary: #0B0C26;
  --secondary: #13173D;
  --accent: #E1B668;
  --muted: #A0A8C0;
  --line: rgba(255, 255, 255, 0.1);
}

body {
  background-color: var(--primary);
  color: #ffffff;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  line-height: 1.5;
}

/* Skip links become visible when focused */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  white-space: nowrap;
  border: 0;
  padding: 0;
  background: var(--accent);
  color: var(--primary);
  z-index: 100;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
  width: auto;
  height: auto;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  text-decoration: none;
}

/* Navigation styling */
.nav-container {
  background: var(--primary);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  width: 100%;
  z-index: 40;
}
.nav-container .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
}
.nav-link {
  color: #ffffff;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  transition: background-color 0.2s ease;
}
.nav-link:hover,
.nav-link:focus {
  background-color: rgba(255, 255, 255, 0.1);
  text-decoration: none;
}
.nav-link.active {
  color: var(--accent);
}

/* Hamburger button */
.hamburger {
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
  width: 24px;
  height: 18px;
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 0;
}
.hamburger span {
  display: block;
  height: 3px;
  width: 100%;
  background: #ffffff;
  border-radius: 1px;
}

/* Mobile nav */
.mobile-nav {
  display: none;
  flex-direction: column;
  background: var(--primary);
  border-top: 1px solid var(--line);
  padding: 1rem;
}
.mobile-nav a {
  padding: 0.5rem 0;
}
.mobile-nav.active {
  display: flex;
}

/* Button styles */
.yellow-btn {
  background-color: var(--accent);
  color: var(--primary);
  padding: 0.5rem 1.25rem;
  border-radius: 0.375rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, transform 0.1s ease;
}
.yellow-btn:hover,
.yellow-btn:focus {
  background-color: #cf9c3d;
  transform: translateY(-2px);
}
.yellow-btn:active {
  transform: translateY(0);
}

.outline-btn {
  border: 2px solid var(--accent);
  color: var(--accent);
  padding: 0.5rem 1.25rem;
  border-radius: 0.375rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.outline-btn:hover,
.outline-btn:focus {
  background-color: var(--accent);
  color: var(--primary);
}

/* Primary button (used in apply.html, forms) */
.btn-primary {
  background-color: var(--accent);
  color: var(--primary);
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background-color 0.2s ease, transform 0.1s ease;
  width: 100%;
}
.btn-primary:hover,
.btn-primary:focus {
  background-color: #cf9c3d;
  transform: translateY(-2px);
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Hidden utility class */
.hidden {
  display: none !important;
}

/* Trust badges */
.trust-badge {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.5rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  gap: 0.5rem;
  white-space: nowrap;
}
.trust-badge i {
  color: var(--accent);
}

/* Pricing and panels */
.pricing-table {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}
.pricing-table h2,
.pricing-table h3 {
  color: var(--accent);
}

/* Table styling */
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  padding: 0.5rem 0.75rem;
}
thead {
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
  text-transform: uppercase;
}
tbody tr {
  border-bottom: 1px solid var(--line);
}
tbody tr:last-child {
  border-bottom: none;
}
tbody td.text-right {
  text-align: right;
}
tbody td.text-center {
  text-align: center;
}

/* Form inputs */
.form-input,
.form-select,
textarea {
  width: 100%;
  background: var(--secondary);
  color: #ffffff;
  border: 1px solid var(--line);
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  appearance: none;
}
.form-input:focus,
.form-select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(225, 182, 104, 0.3);
}

.form-select {
  background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%23E1B668" viewBox="0 0 16 16"><path d="M3.204 5h9.592L8 10.481 3.204 5z"/></svg>');
  background-position: right 0.75rem center;
  background-repeat: no-repeat;
  background-size: 1rem;
  padding-right: 2rem;
}

/* Addon checkbox styling */
.addon-checkbox-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.addon-checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}
.addon-checkbox-item input[type="checkbox"] {
  accent-color: var(--accent);
  width: 1rem;
  height: 1rem;
}

/* Price breakdown */
.price-breakdown {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}
.price-breakdown .flex {
  display: flex;
  justify-content: space-between;
}
.price-breakdown .font-bold {
  color: var(--accent);
}

/* Chat widget */
.chat-modal {
  position: fixed;
  right: 1rem;
  bottom: 5rem;
  width: 20rem;
  max-height: 26rem;
  background: var(--secondary);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-modal[hidden] {
  display: none;
}
.chat-header {
  background: var(--accent);
  color: var(--primary);
  padding: 0.5rem 0.75rem;
  font-weight: 600;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.chat-messages .message {
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  max-width: 85%;
  line-height: 1.4;
}
.chat-messages .message.user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--primary);
}
.chat-messages .message.bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}
.chat-input-container {
  border-top: 1px solid var(--line);
  padding: 0.5rem;
}
.chat-input-container .flex {
  display: flex;
  gap: 0.5rem;
}

/* Success and error messages */
.success-message {
  color: #34D399; /* green-400 */
  font-weight: 500;
}
.error-message {
  color: #F87171; /* red-400 */
  font-weight: 500;
}

/* Utility classes */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Required asterisk styling */
label.required::after { content: " *"; color: #E57373; margin-left: 0.25rem; }

/* Date input styling to match select */
input[type="date"].form-input {
  background: var(--secondary);
  color: #ffffff;
  border: 1px solid var(--line);
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
}

/* Footer fine print */
.text-muted { color: var(--muted); }

/* Enterprise v2: form control visual parity (selects, date inputs) */
select.form-select, input[type="date"].form-input, input[type="time"].form-input {
  background: var(--secondary);
  color: #ffffff;
  border: 1px solid var(--line);
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
}
a.skip-link:focus {
  position: static !important;
  width: auto; height: auto;
  padding: .5rem .75rem;
  background: #111827;
  color: #fff;
  z-index: 9999;
}

/* Surgical fixes: responsive tables & chat button on mobile */
@media (max-width: 640px) {
  .pricing-table table, table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .pricing-table td, .pricing-table th {
    min-width: 120px;
  }
}
@media (max-width: 768px) {
  #chat-button {
    bottom: 70px;
    right: 10px;
    transform: scale(0.9);
  }
}

/* ════════════════════════════════════════════════════════════════════
   CHAT WIDGET ENHANCEMENTS
   ════════════════════════════════════════════════════════════════════ */

/* Typing indicator animation */
.typing-indicator span {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin: 0 2px;
  background: var(--muted);
  border-radius: 50%;
  animation: typing-bounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
.typing-indicator span:nth-child(3) { animation-delay: 0s; }

@keyframes typing-bounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.typing-indicator.fade-out {
  opacity: 0;
  transition: opacity 0.2s ease-out;
}

/* Notification badge on chat button */
.chat-notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ef4444;
  color: white;
  font-size: 12px;
  font-weight: bold;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: badge-pop 0.3s ease-out;
}

@keyframes badge-pop {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Pulse animation for chat button */
.chat-button-pulse {
  animation: pulse-ring 2s cubic-bezier(0.455, 0.03, 0.515, 0.955) infinite;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(225, 182, 104, 0.4); }
  70% { box-shadow: 0 0 0 15px rgba(225, 182, 104, 0); }
  100% { box-shadow: 0 0 0 0 rgba(225, 182, 104, 0); }
}

/* Quick reply buttons */
.quick-reply-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  margin: 4px;
  background: var(--secondary);
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 13px;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.quick-reply-btn:hover {
  background: var(--accent);
  color: var(--primary);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.quick-reply-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#quick-replies {
  display: flex;
  flex-wrap: wrap;
  padding: 8px 12px;
  gap: 4px;
  border-top: 1px solid var(--line);
  background: var(--primary);
}

/* Message entrance animation */
.chat-messages .message {
  animation: message-slide-in 0.3s ease-out;
}

@keyframes message-slide-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Chat input disabled state */
#chat-input:disabled {
  background: var(--primary);
  cursor: not-allowed;
  opacity: 0.6;
}

/* Chat button fixed positioning */
#chat-button {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 50;
}