/**
 * support-widget.css — Floating help button + slide-out support panel
 * Brand colors: #002868 (navy), #BF0A30 (red), #F5F7FA (background)
 */

/* ── Floating help button ──────────────────────────────────────────── */
.sw-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #002868;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  box-shadow: 0 4px 16px rgba(0, 40, 104, 0.35);
  z-index: 9998;
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
  line-height: 1;
}

.sw-fab:hover {
  background: #001d4f;
  transform: scale(1.07);
  box-shadow: 0 6px 24px rgba(0, 40, 104, 0.45);
}

.sw-fab.sw-fab--open {
  background: #BF0A30;
}

.sw-fab-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #BF0A30;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  font-family: 'DM Sans', sans-serif;
}

/* ── Slide-out panel ───────────────────────────────────────────────── */
.sw-panel {
  position: fixed;
  top: 0;
  right: -420px;
  width: 420px;
  height: 100vh;
  background: #fff;
  box-shadow: -4px 0 32px rgba(0, 0, 0, 0.12);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transition: right 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'DM Sans', sans-serif;
}

.sw-panel--open {
  right: 0;
}

@media (max-width: 480px) {
  .sw-panel {
    width: 100vw;
    right: -100vw;
  }
}

/* ── Panel header ──────────────────────────────────────────────────── */
.sw-header {
  background: #002868;
  color: #fff;
  padding: 20px 20px 0;
  flex-shrink: 0;
}

.sw-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.sw-header-title {
  font-family: 'Space Grotesk', 'DM Sans', sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.sw-header-subtitle {
  font-size: 12px;
  opacity: 0.65;
  margin-top: 2px;
}

.sw-close-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background 0.15s;
  flex-shrink: 0;
}

.sw-close-btn:hover {
  background: rgba(255,255,255,0.25);
}

/* ── Tabs ──────────────────────────────────────────────────────────── */
.sw-tabs {
  display: flex;
  gap: 0;
  margin-top: 4px;
}

.sw-tab {
  flex: 1;
  padding: 10px 8px;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.sw-tab--active {
  color: #fff;
  border-bottom-color: #fff;
}

.sw-tab:hover:not(.sw-tab--active) {
  color: rgba(255,255,255,0.85);
}

/* ── Panel body ────────────────────────────────────────────────────── */
.sw-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #F5F7FA;
}

/* ── New Ticket form ───────────────────────────────────────────────── */
.sw-form-group {
  margin-bottom: 14px;
}

.sw-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #2C3E50;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sw-label .sw-required {
  color: #BF0A30;
  margin-left: 2px;
}

.sw-input,
.sw-select,
.sw-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid #E2E8F0;
  border-radius: 8px;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  color: #2C3E50;
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}

.sw-input:focus,
.sw-select:focus,
.sw-textarea:focus {
  border-color: #002868;
  box-shadow: 0 0 0 3px rgba(0, 40, 104, 0.1);
}

.sw-textarea {
  resize: vertical;
  min-height: 96px;
  line-height: 1.5;
}

/* ── Screenshot upload ─────────────────────────────────────────────── */
.sw-screenshot-area {
  border: 1.5px dashed #CBD5E1;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: #fff;
  font-size: 13px;
  color: #64748B;
}

.sw-screenshot-area:hover {
  border-color: #002868;
  background: #F0F4FF;
}

.sw-screenshot-area input[type="file"] {
  display: none;
}

.sw-screenshot-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.sw-screenshot-thumb {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 6px;
  overflow: hidden;
  border: 1.5px solid #E2E8F0;
}

.sw-screenshot-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sw-screenshot-thumb-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  background: rgba(191,10,48,0.9);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ── Submit button ─────────────────────────────────────────────────── */
.sw-submit-btn {
  width: 100%;
  padding: 11px;
  background: #002868;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  margin-top: 4px;
}

.sw-submit-btn:hover:not(:disabled) {
  background: #001d4f;
}

.sw-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── Success state ─────────────────────────────────────────────────── */
.sw-success {
  text-align: center;
  padding: 32px 16px;
}

.sw-success-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.sw-success-title {
  font-family: 'Space Grotesk', 'DM Sans', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #2C3E50;
  margin-bottom: 6px;
}

.sw-success-sub {
  font-size: 13px;
  color: #64748B;
  line-height: 1.5;
  margin-bottom: 16px;
}

.sw-success-number {
  display: inline-block;
  background: #002868;
  color: #fff;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 20px;
}

.sw-new-ticket-btn {
  padding: 9px 20px;
  background: transparent;
  border: 1.5px solid #002868;
  border-radius: 8px;
  color: #002868;
  font-size: 13px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.sw-new-ticket-btn:hover {
  background: #002868;
  color: #fff;
}

/* ── My Tickets list ───────────────────────────────────────────────── */
.sw-ticket-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sw-ticket-card {
  background: #fff;
  border: 1.5px solid #E2E8F0;
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.sw-ticket-card:hover {
  border-color: #002868;
  box-shadow: 0 2px 12px rgba(0, 40, 104, 0.08);
}

.sw-ticket-card--unread {
  border-left: 3px solid #002868;
}

.sw-ticket-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.sw-ticket-subject {
  font-size: 13px;
  font-weight: 600;
  color: #2C3E50;
  line-height: 1.3;
  flex: 1;
}

.sw-ticket-number {
  font-size: 11px;
  color: #94A3B8;
  white-space: nowrap;
}

.sw-ticket-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sw-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sw-badge--open { background: #DBEAFE; color: #1D4ED8; }
.sw-badge--in_progress { background: #FEF3C7; color: #B45309; }
.sw-badge--waiting { background: #F3E8FF; color: #7E22CE; }
.sw-badge--resolved { background: #DCFCE7; color: #166534; }
.sw-badge--closed { background: #F1F5F9; color: #64748B; }

.sw-ticket-date {
  font-size: 11px;
  color: #94A3B8;
  margin-left: auto;
}

/* ── Ticket detail inside panel ────────────────────────────────────── */
.sw-detail-back {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: #002868;
  font-size: 13px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  padding: 0;
  margin-bottom: 14px;
}

.sw-detail-back:hover {
  text-decoration: underline;
}

.sw-detail-header {
  background: #fff;
  border: 1.5px solid #E2E8F0;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.sw-detail-subject {
  font-size: 15px;
  font-weight: 700;
  color: #2C3E50;
  margin-bottom: 6px;
  line-height: 1.3;
}

.sw-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: #64748B;
}

/* ── Message thread ────────────────────────────────────────────────── */
.sw-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.sw-message {
  display: flex;
  flex-direction: column;
  max-width: 88%;
}

.sw-message--admin {
  align-self: flex-start;
}

.sw-message--customer {
  align-self: flex-end;
}

.sw-message-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  color: #2C3E50;
  word-break: break-word;
}

.sw-message--admin .sw-message-bubble {
  background: #fff;
  border: 1.5px solid #E2E8F0;
  border-bottom-left-radius: 4px;
}

.sw-message--customer .sw-message-bubble {
  background: #002868;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.sw-message-meta {
  font-size: 10px;
  color: #94A3B8;
  margin-top: 4px;
  padding: 0 2px;
}

.sw-message--customer .sw-message-meta {
  text-align: right;
}

/* ── Reply form ────────────────────────────────────────────────────── */
.sw-reply-form {
  background: #fff;
  border: 1.5px solid #E2E8F0;
  border-radius: 10px;
  padding: 12px;
}

.sw-reply-textarea {
  width: 100%;
  border: none;
  outline: none;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  color: #2C3E50;
  resize: none;
  min-height: 72px;
  line-height: 1.5;
  background: transparent;
}

.sw-reply-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: 8px;
  border-top: 1px solid #F1F5F9;
  padding-top: 8px;
}

.sw-reply-send-btn {
  padding: 7px 16px;
  background: #002868;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.sw-reply-send-btn:hover:not(:disabled) {
  background: #001d4f;
}

.sw-reply-send-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── Empty states ──────────────────────────────────────────────────── */
.sw-empty {
  text-align: center;
  padding: 40px 16px;
  color: #94A3B8;
}

.sw-empty-icon {
  font-size: 36px;
  margin-bottom: 10px;
}

.sw-empty-text {
  font-size: 13px;
  line-height: 1.5;
}

/* ── Loading spinner ───────────────────────────────────────────────── */
.sw-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: sw-spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes sw-spin {
  to { transform: rotate(360deg); }
}

/* ── Error banner ──────────────────────────────────────────────────── */
.sw-error {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: #991B1B;
  margin-bottom: 12px;
}
