:root {
  --eg-gap: 1rem;
  --eg-gap-lg: 1.25rem;
  --eg-field-gap: .375rem;
  --eg-br: 6px;
  --eg-success-bg: var(--global--color-notice-success-bg, #d1fae5);
  --eg-success-border: var(--global--color-notice-success-border, #15803d);
  --eg-success-accent: var(--global--color-notice-success-accent, #16a34a);
  --eg-success-text: var(--global--color-notice-success-text, #14532d);
}

.eg-app { max-width: 960px; margin-inline: auto; padding: 1rem; }
.eg-h2 { font-size: 1.25rem; margin: 1.25rem 0 .75rem; }
.eg-h3 { font-size: 1.125rem; margin: 0; }
.eg-section { margin-block: 1.25rem; }

.eg-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--eg-gap-lg) var(--eg-gap);
}

.eg-field { display: flex; flex-direction: column; gap: var(--eg-field-gap); min-width: 0; }
.eg-span-2 { grid-column: 1 / -1; }
.eg-subfield { display: flex; flex-direction: column; gap: var(--eg-field-gap); margin-top: var(--eg-field-gap); }

.eg-input, .eg-textarea, select, input[type="file"] {
  width: 100%;
  padding: .625rem .75rem;
  border: 1px solid #d3d6da;
  border-radius: var(--eg-br);
  background: #fff;
  font: inherit;
}

.eg-textarea { min-height: 6.5rem; resize: vertical; }

.eg-choices { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.eg-choice { display: inline-flex; align-items: center; gap: .5rem; line-height: 1.2; }
.eg-choice input { margin: 0; inline-size: 1rem; block-size: 1rem; }
.eg-hidden { display: none; }

.eg-availability {
  border: 1px solid #d3d6da;
  border-radius: var(--eg-br);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: var(--eg-gap);
  background: #f8fafb;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.eg-availability-note {
  font-size: .875rem;
  color: #555;
}

/* Availability time selectors */
.eg-choices-time { flex-wrap: nowrap; gap: .5rem; }
.eg-choices-time input[type="time"] { flex: 1 1 auto; min-width: 0; }

.eg-req { color: #b91c1c; margin-left: .25rem; }

.eg-static {
  padding: .625rem .75rem;
  border: 1px solid #d3d6da;
  border-radius: var(--eg-br);
  background: #f8fafb;
}

.eg-note {
  font-size: .875rem;
  font-weight: 400;
  color: #555;
  display: block;
  margin-top: .25rem;
}

.egja-application-notes {
  margin: 0 0 1.25rem;
  padding: 1rem 1.25rem;
  border: 1px solid #d3d6da;
  border-radius: var(--eg-br);
  background: #f8fafb;
}

.egja-application-notes p {
  margin: 0 0 .75rem;
}

.egja-application-notes p:last-child {
  margin-bottom: 0;
}

/* Submit button matches site style */
/* Status messages */
.egja-status {
    padding: 0.75rem 1rem;
    border-radius: var(--eg-br);
    margin-bottom: 1rem;
    font-weight: 500;
    display: none;
}

.egja-status:not(:empty) {
    display: block;
}

.egja-status.eg-success {
    background-color: #d1fae5;
    border: 1px solid #10b981;
    color: #065f46;
}

.egja-status.eg-error {
    background-color: #fee2e2;
    border: 1px solid #ef4444;
    color: #991b1b;
}

/* WooCommerce-style success notice */
.egja-success-notice {
    background: var(--eg-success-bg);
    border: 1px solid var(--eg-success-border);
    border-left: 4px solid var(--eg-success-accent);
    color: var(--eg-success-text);
    padding: 1rem 1.5rem;
    margin: 0 0 2rem 0;
    border-radius: 4px;
    font-size: 1rem;
    line-height: 1.5;
    display: none;
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    font-weight: 600;
}

.egja-success-notice.show {
    display: block;
    animation: egja-slide-down 0.3s ease-out;
}

.egja-success-notice .notice-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 0.5rem;
    vertical-align: middle;
    background: var(--eg-success-accent);
    border-radius: 50%;
    position: relative;
}

.egja-success-notice .notice-icon::after {
    content: "✓";
    color: white;
    font-size: 14px;
    font-weight: bold;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.egja-success-notice strong {
    font-weight: 700;
}

@keyframes egja-slide-down {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Form submitted state */
.egja-form-submitted {
    opacity: 0.7;
    pointer-events: none;
}

.egja-form-submitted .eg-btn {
    background: #6c757d !important;
    border-color: #6c757d !important;
    cursor: not-allowed !important;
}

.eg-actions { margin-top: 1.25rem; }
.eg-btn,
.eg-app input[type="submit"] {
    flex-shrink: 0;
    margin-left: 0;
    min-width: 60px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    background: linear-gradient(135deg, #e0f7f9 0%, #ddedeb 100%);
    color: #101326;
    border: 2px solid #101326;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}
.eg-btn:hover,
.eg-app input[type="submit"]:hover {
    background: linear-gradient(135deg, #ddedeb 0%, #e0f7f9 100%);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.eg-btn:disabled,
.eg-app input[type="submit"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f3f4f6;
    color: #6b7280;
}

/* Field error styling */
.eg-field-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
    animation: eg-shake 0.5s ease-in-out;
}

@keyframes eg-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Small screens */
@media (max-width: 640px) {
  .eg-grid { grid-template-columns: 1fr; }
  .eg-section { margin-block: 1rem; }
  .eg-h2 { font-size: 1.125rem; margin: 1rem 0 .5rem; }
  .eg-h3 { font-size: 1rem; }
  .eg-btn, .eg-app input[type="submit"] { width: 100%; }
}

/* Guardrails to avoid theme grid classes from interfering inside the form */
.eg-app .columns,
.eg-app .column,
.eg-app [class*="col-"] { all: unset; }

/* Repeater item styling */
.egja-repeater-item {
  position: relative;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 2px solid #ccc;
}

.egja-remove {
  position: absolute;
  top: -14px;
  left: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  background: #fff;
  /* border-top: 1px black; */
  border: 4px solid #CCC;
  color: #666;
  font-size: 16px;
  line-height: 1;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.egja-remove:hover {
  color: #b91c1c;
}

/* Availability layout */
.eg-help { margin: .25rem 0 1rem; color: #333; font-size: .95rem; }

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

.eg-availability-table th,
.eg-availability-table td {
  padding: .5rem;
  border-bottom: 1px solid #d3d6da;
  text-align: left;
}

.eg-availability-table input[type="time"] {
  width: 100%;
}

.eg-note-input {
  width: 100%;
}

.eg-day-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .25rem;
}

.eg-day-name {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.eg-availability-table th .eg-hours-note {
  margin-left: 1.5rem;
}

.eg-hours-note {
  font-size: .875rem;
  font-style: italic;
  color: #555;
}

.eg-day-closed td {
  text-align: center;
  font-style: italic;
}

/* Enhanced mobile responsiveness for availability table */
@media (max-width: 768px) {
  .eg-availability-table {
    font-size: 0.875rem;
  }
  
  .eg-availability-table th,
  .eg-availability-table td {
    padding: 0.375rem 0.25rem;
    vertical-align: top;
  }
  
  .eg-availability-table input[type="time"] {
    font-size: 0.875rem;
    padding: 0.375rem;
  }
  
  .eg-note-input {
    font-size: 0.875rem;
    padding: 0.375rem;
  }
  
  .eg-day-name {
    font-size: 0.875rem;
  }
  
  .eg-hours-note {
    font-size: 0.75rem;
  }
}

@media (max-width: 640px) {
  .eg-availability {
    padding: 0.75rem;
  }
  
  .eg-availability-table {
    font-size: 0.8125rem;
  }
  
  .eg-availability-table th,
  .eg-availability-table td {
    padding: 0.25rem 0.125rem;
  }
  
  .eg-availability-table input[type="time"],
  .eg-note-input {
    font-size: 0.8125rem;
    padding: 0.25rem;
  }
  
  /* Stack time inputs vertically on very small screens */
  .eg-availability-table td:nth-child(2),
  .eg-availability-table td:nth-child(3) {
    display: block;
    width: 100%;
  }
  
  .eg-availability-table td:nth-child(2) input,
  .eg-availability-table td:nth-child(3) input {
    margin-bottom: 0.25rem;
  }
}
