/* ============================================================
   Nexit Support — Stile frontend pubblico (tema chiaro)
   ============================================================ */

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

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --blue:    #00aeef;
  --green:   #00a651;
  --magenta: #e8127d;
  --yellow:  #ffd600;
  --black:   #1a1a1a;
  --gray-50: #f8f9fa;
  --gray-100:#f1f3f5;
  --gray-200:#e9ecef;
  --gray-400:#adb5bd;
  --gray-600:#6c757d;
  --gray-800:#343a40;
  --white:   #ffffff;
  --shadow:  0 2px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --radius:  12px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--gray-50);
  background-image:
    radial-gradient(ellipse at 10% 0%, rgba(0,174,239,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 90% 100%, rgba(0,166,81,0.06) 0%, transparent 50%);
  color: var(--black);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

/* ---- Wrapper ---- */
.page-wrapper {
  width: 100%;
  max-width: 640px;
}

/* ---- Header / Logo ---- */
.site-header {
  text-align: center;
  margin-bottom: 28px;
}

.site-logo {
  height: 60px;
  width: auto;
  margin-bottom: 14px;
}

.site-subtitle {
  font-size: 0.95rem;
  color: var(--gray-600);
  margin-top: 4px;
}

/* ---- Accent bar ---- */
.accent-bar {
  height: 4px;
  width: 100%;
  background: linear-gradient(90deg, var(--magenta), var(--blue), var(--green));
  border-radius: 4px 4px 0 0;
}

/* ---- Card ---- */
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 36px 36px 40px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

/* ---- Alert / Flash ---- */
.alert {
  border-radius: 8px;
  padding: 13px 16px;
  margin-bottom: 22px;
  font-size: 0.88rem;
  line-height: 1.55;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-error {
  background: #fff5f5;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.alert-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
}

.alert ul {
  margin: 6px 0 0 18px;
}

.alert li { margin-bottom: 3px; }

/* ---- Form ---- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group.full { grid-column: 1 / -1; }

label {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--gray-800);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

label .required { color: var(--magenta); margin-left: 2px; }

input[type="text"],
input[type="email"],
input[type="url"],
input[type="number"],
select,
textarea {
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  color: var(--black);
  font-family: inherit;
  font-size: 0.93rem;
  padding: 10px 13px;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  width: 100%;
}

input::placeholder, textarea::placeholder { color: var(--gray-400); }

input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,174,239,0.12);
}

input.error, select.error, textarea.error {
  border-color: var(--magenta);
  box-shadow: 0 0 0 3px rgba(232,18,125,0.08);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236c757d' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  padding-right: 40px;
}

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

.field-hint { font-size: 0.77rem; color: var(--gray-400); margin-top: 2px; }

/* ---- File upload ---- */
.file-upload-wrapper {
  position: relative;
}

.file-upload-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.file-upload-label {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  padding: 10px 13px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
  font-size: 0.93rem;
  color: var(--gray-400);
  user-select: none;
}

.file-upload-label:hover {
  border-color: var(--blue);
}

.file-upload-label.has-file {
  color: var(--black);
  border-color: var(--blue);
}

.file-upload-label.error {
  border-color: var(--magenta);
  box-shadow: 0 0 0 3px rgba(232,18,125,0.08);
}

.file-upload-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  opacity: 0.45;
}

.file-upload-label.has-file .file-upload-icon {
  opacity: 1;
  color: var(--blue);
}

/* ---- Submit button ---- */
.btn-submit {
  display: block;
  width: 100%;
  padding: 13px 24px;
  margin-top: 26px;
  border: none;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-family: inherit;
  font-size: 0.97rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 3px 12px rgba(0,174,239,0.3);
}

.btn-submit:hover {
  background: #0099d4;
  transform: translateY(-1px);
  box-shadow: 0 5px 18px rgba(0,174,239,0.35);
}

.btn-submit:active { transform: translateY(0); }

/* ---- Thank-you page ---- */
.thank-you { text-align: center; padding: 8px 0; }

.check-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--green);
  margin-bottom: 22px;
  box-shadow: 0 4px 20px rgba(0,166,81,0.3);
}

.check-icon svg {
  width: 34px;
  height: 34px;
  stroke: #fff;
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.thank-you h2 { font-size: 1.5rem; font-weight: 700; color: var(--black); margin-bottom: 10px; }
.thank-you p  { color: var(--gray-600); font-size: 0.95rem; line-height: 1.65; margin-bottom: 8px; }

.ticket-id-box {
  display: inline-block;
  background: rgba(0,174,239,0.07);
  border: 1.5px solid rgba(0,174,239,0.25);
  border-radius: 10px;
  padding: 12px 32px;
  margin: 16px 0;
}

.ticket-id-box .label {
  font-size: 0.75rem;
  color: var(--gray-600);
  display: block;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.ticket-id-box .id {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--blue);
}

.btn-link {
  display: inline-block;
  margin-top: 22px;
  padding: 11px 28px;
  background: var(--blue);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.93rem;
  font-weight: 700;
  transition: background 0.2s, transform 0.15s;
  box-shadow: 0 3px 12px rgba(0,174,239,0.25);
}

.btn-link:hover { background: #0099d4; transform: translateY(-1px); }

/* ---- Check ticket button ---- */
.btn-check-ticket {
  display: block;
  width: 100%;
  padding: 13px 24px;
  margin-top: 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
  color: var(--gray-800);
  font-family: inherit;
  font-size: 0.93rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background 0.2s, border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.btn-check-ticket:hover {
  background: var(--gray-50);
  border-color: var(--blue);
  color: var(--blue);
  transform: translateY(-1px);
  box-shadow: 0 3px 12px rgba(0,174,239,0.12);
  text-decoration: none;
}

/* ---- Check ticket result ---- */
.result-card {
  margin-top: 24px;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--gray-200);
}

.result-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--black);
}

.result-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.result-badge.badge-red    { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.result-badge.badge-orange { background: #fff7ed; color: #ea580c; border: 1px solid #fed7aa; }
.result-badge.badge-blue   { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.result-badge.badge-green  { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.result-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.result-field.full { grid-column: 1 / -1; }

.result-field .result-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-400);
}

.result-field .result-value {
  font-size: 0.92rem;
  color: var(--black);
  line-height: 1.5;
}

.result-field .result-value.description {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 12px 14px;
  line-height: 1.65;
}

.status-timeline {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 24px 0 8px;
  padding: 16px 0;
  border-top: 1px solid var(--gray-200);
}

.timeline-step {
  flex: 1;
  text-align: center;
  position: relative;
}

.timeline-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gray-200);
  color: var(--gray-400);
  font-size: 0.7rem;
  font-weight: 700;
  margin-bottom: 6px;
  transition: background 0.3s, color 0.3s;
}

.timeline-step.active .timeline-dot {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,174,239,0.3);
}

.timeline-step.done .timeline-dot {
  background: var(--green);
  color: #fff;
}

.timeline-step-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.timeline-step.active .timeline-step-label,
.timeline-step.done .timeline-step-label {
  color: var(--black);
}

.timeline-connector {
  flex: 0.5;
  height: 2px;
  background: var(--gray-200);
  margin-bottom: 20px;
}

.timeline-connector.done {
  background: var(--green);
}

/* ---- Chat / Replies ---- */
.chat-section {
  margin-top: 36px;
  border-top: 1px solid var(--gray-200);
  padding-top: 24px;
}

.chat-history {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.chat-bubble {
  max-width: 85%;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 0.93rem;
  line-height: 1.5;
  position: relative;
}

.chat-bubble-header {
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.chat-bubble-date {
  font-weight: 500;
  opacity: 0.7;
  font-size: 0.68rem;
  margin-left: 12px;
}

.chat-bubble.customer {
  align-self: flex-end;
  background: var(--blue);
  color: #fff;
  border-bottom-left-radius: 4px;
}

.chat-bubble.customer .chat-bubble-header {
  color: rgba(255,255,255,0.9);
}

.chat-bubble.admin {
  align-self: flex-start;
  background: var(--gray-100);
  color: var(--black);
  border: 1px solid var(--gray-200);
  border-bottom-right-radius: 4px;
}

.chat-bubble.admin .chat-bubble-header {
  color: var(--gray-600);
}

.chat-reply-form textarea {
  min-height: 100px;
  margin-bottom: 12px;
}

/* ---- Footer ---- */
.site-footer {
  text-align: center;
  color: var(--gray-400);
  font-size: 0.78rem;
  margin-top: 24px;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 520px) {
  .card { padding: 24px 18px 28px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.full { grid-column: 1; }
  .result-grid { grid-template-columns: 1fr; }
  .result-field.full { grid-column: 1; }
  .timeline-step-label { font-size: 0.6rem; }
}
