/* ============================================
   KWT Labs — Support Ticket Portal
   ============================================ */

.tk-hero {
  padding-top: calc(var(--header-h) + 48px);
  padding-bottom: 40px;
  background:
    radial-gradient(ellipse 70% 60% at 85% 10%, rgba(15, 111, 255, 0.14) 0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 5% 90%, rgba(6, 182, 212, 0.1) 0%, transparent 50%),
    linear-gradient(180deg, #eef4ff 0%, var(--white) 100%);
}

.tk-hero h1 .text-gradient {
  background: linear-gradient(90deg, #0F6FFF 0%, #06b6d4 55%, #16C784 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tk-hero h1 {
  font-size: clamp(2rem, 4vw, 2.5rem);
  margin-bottom: 12px;
}

.tk-hero__lead {
  font-size: 1.0625rem;
  color: var(--gray-500);
  line-height: 1.75;
  max-width: 600px;
  margin-bottom: 8px;
}

.tk-hero__meta {
  font-size: 0.875rem;
  color: var(--gray-400);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tk-hero__meta .icon {
  width: 16px;
  height: 16px;
}

.tk-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--gray-400);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tk-breadcrumb a {
  color: var(--gray-500);
  text-decoration: none;
}

.tk-breadcrumb a:hover {
  color: var(--primary);
}

.tk-breadcrumb .icon {
  width: 14px;
  height: 14px;
  opacity: 0.5;
}

/* Sections */
.tk-section {
  padding: 48px 0;
}

.tk-section--gray {
  background: var(--gray-50);
}

.tk-section h2 {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.tk-section__desc {
  color: var(--gray-500);
  margin-bottom: 28px;
  max-width: 640px;
}

/* Before You Submit cards */
.tk-before-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.tk-before-card {
  display: flex;
  gap: 14px;
  padding: 20px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.tk-before-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.tk-before-card__icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 111, 255, 0.08);
  border-radius: var(--radius);
  color: var(--primary);
}

.tk-before-card__icon .icon {
  width: 22px;
  height: 22px;
}

.tk-before-card h3 {
  font-size: 0.9375rem;
  margin-bottom: 4px;
}

.tk-before-card p {
  font-size: 0.8125rem;
  color: var(--gray-500);
  margin: 0;
  line-height: 1.5;
}

.tk-before-note {
  margin-top: 20px;
  padding: 16px 20px;
  background: rgba(15, 111, 255, 0.06);
  border-radius: var(--radius-lg);
  font-size: 0.9375rem;
  color: var(--gray-600);
  border-left: 3px solid var(--primary);
}

/* Login CTA */
.tk-login-cta {
  background: linear-gradient(135deg, #0F6FFF 0%, #0052cc 100%);
  border-radius: var(--radius-xl);
  padding: 40px;
  color: var(--white);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: center;
}

.tk-login-cta h2 {
  color: var(--white);
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.tk-login-cta p {
  opacity: 0.9;
  margin-bottom: 16px;
  line-height: 1.6;
}

.tk-login-cta__benefits {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tk-login-cta__benefits li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9375rem;
}

.tk-login-cta__benefits .icon {
  width: 18px;
  height: 18px;
  opacity: 0.9;
}

.tk-login-cta__actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 200px;
}

.tk-login-cta .btn--white {
  text-align: center;
}

.tk-login-cta .btn--outline {
  border-color: rgba(255, 255, 255, 0.5);
  color: var(--white);
}

.tk-login-cta .btn--outline:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--white);
}

.tk-email-fallback {
  text-align: center;
  padding: 24px;
  font-size: 0.9375rem;
  color: var(--gray-500);
}

.tk-email-fallback a {
  color: var(--primary);
  font-weight: 600;
}

/* Ticket type cards */
.tk-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}

.tk-type-card {
  position: relative;
  cursor: pointer;
}

.tk-type-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tk-type-card__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 16px;
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition), box-shadow var(--transition);
  height: 100%;
}

.tk-type-card input:checked + .tk-type-card__inner,
.tk-type-card__inner.is-selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 111, 255, 0.12);
}

.tk-type-card:hover .tk-type-card__inner {
  border-color: var(--primary);
}

.tk-type-card__icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 111, 255, 0.08);
  border-radius: var(--radius);
  color: var(--primary);
  margin-bottom: 10px;
}

.tk-type-card__icon .icon {
  width: 20px;
  height: 20px;
}

.tk-type-card h3 {
  font-size: 0.875rem;
  margin-bottom: 4px;
}

.tk-type-card p {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin: 0;
  line-height: 1.4;
}

/* Form layout */
.tk-form-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 32px;
  align-items: start;
}

.tk-form {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  padding: 32px;
}

.tk-form__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.tk-form__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tk-form__field--full {
  grid-column: 1 / -1;
}

.tk-form__field label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-700);
}

.tk-form__field label .required {
  color: #e11d48;
}

.tk-form__field input,
.tk-form__field select,
.tk-form__field textarea {
  padding: 12px 14px;
  font-size: 0.9375rem;
  font-family: var(--font);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--dark);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.tk-form__field input:focus,
.tk-form__field select:focus,
.tk-form__field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 111, 255, 0.1);
}

.tk-form__field input[readonly] {
  background: var(--gray-50);
  color: var(--gray-600);
}

.tk-form__field textarea {
  min-height: 160px;
  resize: vertical;
  line-height: 1.6;
}

.tk-form__hints {
  font-size: 0.8125rem;
  color: var(--gray-400);
  margin-top: 4px;
}

.tk-form__prompts {
  font-size: 0.8125rem;
  color: var(--gray-500);
  background: var(--gray-50);
  padding: 12px;
  border-radius: var(--radius);
  margin-top: 8px;
  line-height: 1.6;
}

.tk-form__prompts strong {
  color: var(--gray-700);
}

/* Attachments */
.tk-dropzone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  background: var(--gray-50);
}

.tk-dropzone:hover,
.tk-dropzone.is-dragover {
  border-color: var(--primary);
  background: rgba(15, 111, 255, 0.04);
}

.tk-dropzone__icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 111, 255, 0.1);
  border-radius: 50%;
  color: var(--primary);
}

.tk-dropzone__icon .icon {
  width: 24px;
  height: 24px;
}

.tk-dropzone p {
  margin: 0 0 4px;
  font-size: 0.9375rem;
  color: var(--gray-700);
}

.tk-dropzone__hint {
  font-size: 0.8125rem;
  color: var(--gray-400);
}

.tk-dropzone input[type="file"] {
  display: none;
}

.tk-file-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tk-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 0.875rem;
}

.tk-file-item__name {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tk-file-item__remove {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 4px;
  font-size: 1.125rem;
  line-height: 1;
}

.tk-file-item__remove:hover {
  color: #e11d48;
}

/* Checkboxes */
.tk-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tk-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.875rem;
  color: var(--gray-600);
  cursor: pointer;
}

.tk-checkbox input {
  margin-top: 3px;
  flex-shrink: 0;
}

.tk-checkbox a {
  color: var(--primary);
}

.tk-form__submit {
  margin-top: 8px;
}

.tk-form__submit .btn {
  width: 100%;
  padding: 16px 24px;
  font-size: 1.0625rem;
}

/* Sidebar */
.tk-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.tk-sidebar-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.tk-sidebar-card h3 {
  font-size: 1rem;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tk-sidebar-card h3 .icon {
  width: 18px;
  height: 18px;
  color: var(--primary);
}

.tk-sidebar-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tk-sidebar-card li {
  font-size: 0.875rem;
  color: var(--gray-600);
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.5;
}

.tk-sidebar-card li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.tk-sidebar-card li::before {
  content: '•';
  color: var(--primary);
  font-weight: bold;
}

/* Suggested articles */
.tk-suggestions {
  margin-top: 16px;
  padding: 16px;
  background: rgba(15, 111, 255, 0.06);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(15, 111, 255, 0.15);
}

.tk-suggestions[hidden] {
  display: none;
}

.tk-suggestions h4 {
  font-size: 0.875rem;
  margin-bottom: 10px;
  color: var(--primary);
}

.tk-suggestions ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tk-suggestions li {
  margin-bottom: 6px;
}

.tk-suggestions a {
  font-size: 0.875rem;
  color: var(--gray-700);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tk-suggestions a:hover {
  color: var(--primary);
}

/* Timeline */
.tk-timeline {
  display: flex;
  justify-content: space-between;
  position: relative;
  padding: 24px 0;
  margin: 32px 0;
}

.tk-timeline::before {
  content: '';
  position: absolute;
  top: 36px;
  left: 10%;
  right: 10%;
  height: 2px;
  background: var(--gray-200);
}

.tk-timeline__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  z-index: 1;
  flex: 1;
  max-width: 140px;
}

.tk-timeline__dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--white);
  border: 2px solid var(--gray-300);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-400);
}

.tk-timeline__step.is-active .tk-timeline__dot,
.tk-timeline__step.is-done .tk-timeline__dot {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--white);
}

.tk-timeline__step.is-done .tk-timeline__dot {
  background: #16C784;
  border-color: #16C784;
}

.tk-timeline__label {
  font-size: 0.75rem;
  color: var(--gray-500);
  line-height: 1.3;
}

.tk-timeline__step.is-active .tk-timeline__label {
  color: var(--primary);
  font-weight: 600;
}

/* FAQ accordion */
.tk-faq {
  max-width: 800px;
}

.tk-faq-item {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  margin-bottom: 8px;
  overflow: hidden;
  background: var(--white);
}

.tk-faq-item summary {
  padding: 16px 20px;
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tk-faq-item summary::-webkit-details-marker {
  display: none;
}

.tk-faq-item summary::after {
  content: '+';
  font-size: 1.25rem;
  color: var(--gray-400);
  font-weight: 400;
}

.tk-faq-item[open] summary::after {
  content: '−';
}

.tk-faq-item p {
  padding: 0 20px 16px;
  margin: 0;
  font-size: 0.9375rem;
  color: var(--gray-600);
  line-height: 1.7;
}

/* My Tickets */
.tk-mytickets-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.tk-search-bar {
  position: relative;
  max-width: 360px;
  flex: 1;
  min-width: 200px;
}

.tk-search-bar input {
  width: 100%;
  padding: 12px 16px 12px 42px;
  font-size: 0.9375rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  font-family: var(--font);
}

.tk-search-bar input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 111, 255, 0.1);
}

.tk-search-bar .icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--gray-400);
}

.tk-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--gray-200);
  padding-bottom: 0;
}

.tk-tab {
  padding: 12px 20px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-500);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  margin-bottom: -1px;
  font-family: var(--font);
  transition: color var(--transition), border-color var(--transition);
}

.tk-tab:hover {
  color: var(--gray-700);
}

.tk-tab.is-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tk-table-wrap {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.tk-table {
  width: 100%;
  border-collapse: collapse;
}

.tk-table th,
.tk-table td {
  padding: 14px 20px;
  text-align: left;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--gray-100);
}

.tk-table th {
  background: var(--gray-50);
  font-weight: 600;
  color: var(--gray-600);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tk-table tr:last-child td {
  border-bottom: none;
}

.tk-table tr:hover td {
  background: rgba(15, 111, 255, 0.02);
}

.tk-table a {
  color: var(--primary);
  font-weight: 500;
  text-decoration: none;
}

.tk-table a:hover {
  text-decoration: underline;
}

.tk-table__empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--gray-500);
}

/* Status badges */
.tk-badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  text-transform: capitalize;
}

.tk-badge--progress {
  background: rgba(15, 111, 255, 0.12);
  color: #0F6FFF;
}

.tk-badge--waiting {
  background: rgba(234, 179, 8, 0.15);
  color: #a16207;
}

.tk-badge--resolved {
  background: rgba(22, 199, 132, 0.15);
  color: #059669;
}

.tk-badge--closed {
  background: var(--gray-100);
  color: var(--gray-600);
}

/* Success page */
.tk-success {
  text-align: center;
  max-width: 560px;
  margin: 0 auto;
  padding: 64px 24px;
}

.tk-success__icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(22, 199, 132, 0.12);
  border-radius: 50%;
  color: #16C784;
  font-size: 2.5rem;
}

.tk-success h1 {
  font-size: 1.75rem;
  margin-bottom: 12px;
}

.tk-success__ticket {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  margin: 20px 0;
  padding: 16px 24px;
  background: rgba(15, 111, 255, 0.08);
  border-radius: var(--radius-lg);
  display: inline-block;
}

.tk-success p {
  color: var(--gray-500);
  line-height: 1.7;
  margin-bottom: 8px;
}

.tk-success__actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 32px;
}

/* Ticket detail view */
.tk-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--gray-200);
}

.tk-detail-header h1 {
  font-size: 1.375rem;
  margin-bottom: 8px;
}

.tk-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.875rem;
  color: var(--gray-500);
}

.tk-detail-meta span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tk-detail-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 32px;
  align-items: start;
}

.tk-thread {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tk-message {
  padding: 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
}

.tk-message--customer {
  background: var(--white);
  margin-right: 48px;
}

.tk-message--support {
  background: rgba(15, 111, 255, 0.04);
  border-color: rgba(15, 111, 255, 0.15);
  margin-left: 48px;
}

.tk-message__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 0.8125rem;
}

.tk-message__author {
  font-weight: 600;
  color: var(--gray-700);
}

.tk-message__author--support {
  color: var(--primary);
}

.tk-message__time {
  color: var(--gray-400);
}

.tk-message__body {
  font-size: 0.9375rem;
  color: var(--gray-600);
  line-height: 1.7;
  white-space: pre-wrap;
}

.tk-detail-sidebar .tk-sidebar-card {
  margin-bottom: 16px;
}

.tk-attachments-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tk-attachments-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  font-size: 0.875rem;
  color: var(--gray-600);
  border-bottom: 1px solid var(--gray-100);
}

.tk-attachments-list li:last-child {
  border-bottom: none;
}

.tk-status-timeline {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tk-status-timeline li {
  position: relative;
  padding-left: 20px;
  padding-bottom: 16px;
  font-size: 0.8125rem;
  color: var(--gray-600);
}

.tk-status-timeline li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}

.tk-status-timeline li::after {
  content: '';
  position: absolute;
  left: 7px;
  top: 18px;
  bottom: 0;
  width: 2px;
  background: var(--gray-200);
}

.tk-status-timeline li:last-child {
  padding-bottom: 0;
}

.tk-status-timeline li:last-child::after {
  display: none;
}

.tk-coming-soon {
  font-size: 0.75rem;
  color: var(--gray-400);
  font-style: italic;
  margin-top: 12px;
}

.tk-my-tickets-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
  margin-top: 16px;
}

.tk-my-tickets-link:hover {
  text-decoration: underline;
}

.tk-guest-only[hidden],
.tk-logged-only[hidden] {
  display: none !important;
}

.tk-form-message {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 16px;
}

.tk-form-message--error {
  background: rgba(225, 29, 72, 0.08);
  color: #be123c;
  border: 1px solid rgba(225, 29, 72, 0.2);
}

/* Responsive */
@media (max-width: 960px) {
  .tk-form-layout,
  .tk-detail-layout {
    grid-template-columns: 1fr;
  }

  .tk-login-cta {
    grid-template-columns: 1fr;
  }

  .tk-message--customer,
  .tk-message--support {
    margin-left: 0;
    margin-right: 0;
  }

  .tk-timeline {
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
  }

  .tk-timeline::before {
    display: none;
  }
}

@media (max-width: 640px) {
  .tk-form__grid {
    grid-template-columns: 1fr;
  }

  .tk-form {
    padding: 20px;
  }

  .tk-table-wrap {
    overflow-x: auto;
  }

  .tk-mytickets-header {
    flex-direction: column;
  }

  .tk-search-bar {
    max-width: 100%;
  }
}
