/*
Modern UI/UX Styling for SWC Claims Form
Incorporates brand colors, typography variables, inline validation, and dynamic UI elements.
*/

/* STREAMING_CHUNK: Base typography and container styles... */
/* --- GLOBAL CONTAINER & TYPOGRAPHY --- */
#swc-claim-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
  font-family: var(--snk-font-body, system-ui, -apple-system, sans-serif);
  color: var(--snk-text-color, #454545);
  font-size: var(--snk-fs-body, 16px);
  line-height: var(--snk-lh-body, 1.5);
}

.swc-dynamic-title {
  margin-bottom: 25px;
  font-size: 1.8rem;
  font-weight: 700;
  color: #1a1a1a;
}

#swc-claim-form fieldset {
  border: 1px solid #e5e7eb;
  padding: 24px;
  margin-bottom: 24px;
  border-radius: 12px;
  background-color: rgba(255, 255, 255, 0.95); /* Frosted transparency */
  backdrop-filter: blur(4px);
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

#swc-claim-form legend {
  font-weight: 700;
  font-size: 1.1em;
  padding: 0 12px;
  color: #1a1a1a;
}

/* STREAMING_CHUNK: Styling form tabs and groups... */
/* --- TABS --- */
.swc-form-tabs {
  display: flex;
  margin-bottom: 30px;
  border-radius: 50px;
  background-color: #f0f4f5;
  padding: 4px;
}

.swc-tab-btn {
  flex: 1;
  padding: 12px 20px;
  background: transparent;
  color: #6b7280;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.3s ease;
  font-family: inherit;
}

.swc-tab-btn:hover:not(.active) {
  color: #1a1a1a;
}

.swc-tab-btn.active {
  background: #c00;
  color: #fff;
  box-shadow: 0 4px 6px -1px rgba(204, 0, 0, 0.2);
}

/* --- FORM GROUPS & LABELS --- */
.swc-flex-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.swc-form-group {
  flex: 1;
  min-width: 250px;
  margin-bottom: 20px;
  position: relative; /* Anchor for inline errors */
}

#swc-claim-form label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--snk-text-color, #454545);
  font-size: var(--snk-fs-body, 15px);
}

.req {
  color: #c00;
  margin-left: 2px;
}

/* STREAMING_CHUNK: Configuring inputs and dynamic inline errors... */
/* --- INPUTS & TEXTAREAS --- */
#swc-claim-form input[type="text"],
#swc-claim-form input[type="email"],
#swc-claim-form input[type="number"],
#swc-claim-form select,
#swc-claim-form textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  box-sizing: border-box;
  transition: all 0.3s ease;
  background-color: #ffffff;
  font-family: inherit;
  font-size: 15px;
  color: #1a1a1a;
}

#swc-claim-form input::placeholder,
#swc-claim-form textarea::placeholder {
  color: #9ca3af;
  opacity: 0.8;
  font-weight: 400;
}

#swc-claim-form select {
  appearance: none;
  -webkit-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='%23454545' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 16px;
  padding-right: 40px;
}

#swc-claim-form textarea {
  min-height: 100px;
  resize: vertical;
}

#swc-claim-form input:focus:not(.swc-input-error),
#swc-claim-form select:focus:not(.swc-input-error),
#swc-claim-form textarea:focus:not(.swc-input-error) {
  outline: none;
  border-color: #374151;
  background-color: #ffffff;
  box-shadow: 0 0 0 4px rgba(55, 65, 81, 0.1);
}

/* --- DYNAMIC INLINE ERRORS --- */
.swc-input-error {
  border: 2px solid #c00 !important;
  background-color: #fffafb !important;
}

#swc-aspects-group.swc-input-error {
  padding: 12px;
  border-radius: 8px;
  border: 2px dashed #c00 !important;
}

.swc-field-error-msg {
  color: #c00;
  font-size: 13px;
  margin-top: 6px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
  animation: swcFadeIn 0.2s ease-out;
}

.swc-field-error-msg::before {
  content: "⚠️";
  font-size: 12px;
}

@keyframes swcFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* STREAMING_CHUNK: Styling AWB pills and checkbox layouts... */
/* --- HOUSE AWB PILL UI --- */
.swc-awb-input-wrapper {
  position: relative;
}

.swc-pill-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.swc-pill-container:empty {
  display: none; /* Fixes spacing issue when 0 pills */
}

.swc-pill {
  background-color: #f0f4f5;
  border: 1px solid #d1d5db;
  color: #374151;
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
}

.swc-pill-remove {
  margin-left: 8px;
  color: #9ca3af;
  cursor: pointer;
  font-weight: bold;
  font-size: 16px;
  transition: color 0.2s;
}

.swc-pill-remove:hover {
  color: #c00;
}

/* --- CHECKBOXES --- */
.swc-checkbox-group {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  padding-top: 4px;
}

#swc-claim-form .swc-checkbox-group label,
#swc-claim-form .swc-privacy-group label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
  cursor: pointer;
  font-size: 15px;
  margin-bottom: 0;
}

#swc-claim-form input[type="checkbox"],
#swc-claim-form .swc-privacy-group input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin: 0;
  border: 2px solid #d1d5db;
  border-radius: 4px;
  background-color: #ffffff;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

#swc-claim-form .swc-privacy-group input[type="checkbox"] {
  margin-right: 5px;
}

#swc-claim-form input[type="checkbox"]:checked {
  background-color: #ffffff;
  border-color: #0f5132;
}

#swc-claim-form input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 6px;
  height: 11px;
  border: solid #0f5132;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* STREAMING_CHUNK: Updating file upload and dynamic types UI... */
/* --- FILE UPLOAD & DYNAMIC TYPES UI --- */
/* --- CUSTOM FILE UPLOAD (BYPASS OS LANGUAGE) --- */
.swc-custom-file-wrapper {
  padding: 16px;
  background: #ffffff;
  border: 2px dashed #d1d5db;
  border-radius: 12px;
  width: 100%;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 15px;
  box-sizing: border-box;
}

.swc-custom-file-wrapper:hover {
  border-color: #c00;
  background-color: #f0f4f5;
}

.swc-custom-file-btn {
  background-color: var(--snk-btn-primary-color, #0f5132);
  color: white !important;
  padding: 8px 18px;
  border-radius: 50px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s ease;
  display: inline-block;
  margin-bottom: 0 !important; /* Overrides global label margin */
}

.swc-custom-file-btn:hover {
  background-color: #c00;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(204, 0, 0, 0.2);
}

.swc-custom-file-wrapper .description {
  margin-top: 0;
}

.swc-file-types-list {
  margin-top: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* PERCENTAGE WIDTH FIX FOR FILE ROWS */
.swc-file-type-row {
  display: flex;
  align-items: center;
  justify-content: space-between; /* Spreads out the 55%, 40% and the remove button */
  gap: 10px;
  padding: 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-sizing: border-box; /* Crucial so padding doesn't inflate width */
}

.swc-file-name {
  font-weight: 600;
  font-size: 14px;
  color: #454545;
  flex: 0 1 55%; /* Basis of 55%, allowed to gracefully shrink if necessary */
  width: 55%; 
  display: block; 
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.swc-file-type-select {
  flex: 0 1 40%; /* Basis of 40%, allowed to gracefully shrink */
  width: 40%; 
  padding: 8px 12px !important;
  box-sizing: border-box;
}

/* Ensure the pill remove within the file row has guaranteed breathing room */
.swc-file-type-row .swc-pill-remove {
  flex: 0 0 auto; /* Takes only the space it needs */
  margin-left: 0; /* Let flex justify-content space it perfectly */
}

.description {
  font-size: 13px;
  color: #6b7280;
  margin-top: 8px;
}

/* STREAMING_CHUNK: Styling buttons and feedback messages... */
/* --- BUTTONS --- */
.swc-form-actions {
  display: flex;
  gap: 15px;
  margin-top: 30px;
  align-items: center;
}

/* Reset native button styles so theme class .snk-btn-primary works perfectly */
button.snk-btn-primary {
  border: none;
  cursor: pointer;
  font-family: inherit;
  outline: none;
}

button.snk-btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.button-secondary {
  background-color: #ffffff;
  color: #454545;
  border: 1px solid #d1d5db;
  padding: 0.5rem 1rem;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
}

.button-secondary:hover {
  border-color: #c00;
  color: #c00;
}

/* --- ERROR & SUCCESS FEEDBACK BLOCK --- */
.swc-error {
  color: #c00;
  background: #fef2f2;
  padding: 16px;
  border-radius: 8px;
  border-left: 4px solid #c00;
  margin-top: 20px;
  font-weight: 500;
}

.swc-success {
  color: #d1e7dd;
  background: var(--snk-btn-primary-color, #0f5132);
  padding: 20px;
  border-radius: 8px;
  border-left: 4px solid #d1e7dd;
  margin-top: 20px;
  font-weight: 400;
  font-size: 16px;
}

.swc-success a {
  color: #d1e7dd !important;
  text-decoration: underline;
}

.swc-success a:hover {
  color: #f0f4f5 !important;
}