/**
 * Field Status Widget Styles
 * @version 1.0.0
 */

/* Reset and Base Styles */
.field-status-widget {
  box-sizing: border-box;
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  box-shadow:
    0 4px 10px -1px rgba(0, 0, 0, 0.2),
    0 2px 10px -1px rgba(0, 0, 0, 0.06);
}

.field-status-widget *,
.field-status-widget *::before,
.field-status-widget *::after {
  box-sizing: inherit;
}

/* Banner Layout - Fixed positioning */
.field-status-banner-fixed-top,
.field-status-banner-fixed-bottom {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 9999;
  width: 100%;
}

.field-status-banner-fixed-top {
  top: 0;
  animation: slideDown 0.3s ease-out;
}

.field-status-banner-fixed-bottom {
  bottom: 0;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Base banner */
.fs-banner {
  width: 100%;
  box-sizing: border-box;
  font-family:
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    sans-serif;
  border-bottom: 1px solid transparent;
}

.fs-banner-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

/* Icon */
.fs-banner-icon {
  font-size: 20px;
  line-height: 1.2;
  flex-shrink: 0;
}

/* Content */
.fs-banner-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
}

.fs-banner-close {
  cursor: pointer;
  align-self: center;
  background: transparent;
  border: none;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  opacity: 0.7;

  &:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.1);
    transform: scale(1.1);
  }

  &:active {
    transform: scale(0.95);
  }
}

.fs-banner-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

.fs-banner-meta {
  font-size: 13px;
  line-height: 1.3;
  opacity: 0.85;
}

/* ---------- States ---------- */

/* Success - All fields open or positive message */
.fs-success {
  background-color: #d4e7ca; /* lighter forest green tint */
  border-bottom-color: #a8c99a; /* medium forest green */
  color: #2d5a1e; /* dark forest green */
}

/* Warning - Some fields closed or warning message */
.fs-warning {
  background-color: #ffe2bf; /* darker amber */
  border-bottom-color: #f5c38a;
  color: #8a4b00;
}

/* Error - All fields closed or error message */
.fs-error {
  background-color: #f6cfcf; /* darker red */
  border-bottom-color: #e8a3a3;
  color: #8b1e1e;
}

/* Legacy support - map old classes to new ones */
.fs-open {
  background-color: #d4e7ca;
  border-bottom-color: #a8c99a;
  color: #2d5a1e;
}

.fs-closed {
  background-color: #f6cfcf;
  border-bottom-color: #e8a3a3;
  color: #8b1e1e;
}

/* ---------- Responsive ---------- */

@media (max-width: 480px) {
  .fs-banner-inner {
    padding: 10px 12px;
  }

  .fs-banner-title {
    font-size: 15px;
  }

  .fs-banner-meta {
    font-size: 12px;
  }
}

/* Responsive */
@media (max-width: 640px) {
  .fs-banner {
    padding: 8px 16px;
  }

  .fs-banner-message {
    font-size: 16px;
    font-weight: bold;
  }

  .fs-banner-timestamp {
    font-size: 13px;
    bottom: 3px;
    right: 8px;
  }
}

/* Error State */
.field-status-error .fs-error {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: white;
  padding: 12px 20px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.fs-error-icon {
  font-size: 20px;
  margin-bottom: 4px;
}

.fs-error-message {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.fs-error-detail {
  font-size: 12px;
  opacity: 0.9;
}

/* Disabled State */
.field-status-disabled .fs-disabled {
  background: #6b7280;
  color: white;
  padding: 12px 20px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.fs-disabled-message {
  font-size: 14px;
  font-weight: 500;
}

/* ---------- Table Layout ---------- */

.fs-table-container {
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.fs-table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

.fs-table-header-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fs-table-title {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.fs-table-summary {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 14px;
}

.fs-table-summary-open {
  color: #059669;
  font-weight: 500;
}

.fs-table-summary-closed {
  color: #dc2626;
  font-weight: 500;
}

.fs-table-summary-separator {
  color: #9ca3af;
}

.fs-table-timestamp {
  font-size: 13px;
  color: #6b7280;
}

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

.fs-table-header-row {
  background: #f9fafb;
}

.fs-table-header-cell {
  text-align: left;
  padding: 12px 20px;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #e5e7eb;
}

.fs-table-row {
  transition: background-color 0.15s ease;
  border-left: 3px solid transparent;
}

.fs-table-row-open {
  border-left-color: #059669;
  background-color: #e6faf0;
}

.fs-table-row-closed {
  border-left-color: #e5e7eb;
}

.fs-table-row:hover {
  filter: brightness(0.97);
}

.fs-table-row:not(:last-child) {
  border-bottom: 1px solid #d1d5db;
}

.fs-table-cell {
  padding: 14px 20px;
  font-size: 14px;
}

.fs-table-cell-name {
  color: #111827;
  font-weight: 500;
}


.fs-field-name-text {
  color: #111827;
  font-weight: 500;
  line-height: 1.3;
}

.fs-field-type {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: #6b7280;
  font-weight: 400;
}

.fs-field-type svg {
  flex-shrink: 0;
  color: #9ca3af;
}

.fs-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
}

.fs-status-badge-open {
  background-color: #059669;
  color: #ffffff;
}

.fs-status-badge-closed {
  background-color: #fee2e2;
  color: #991b1b;
}

/* Table Responsive */
@media (max-width: 640px) {
  .fs-table-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .fs-table-header-cell,
  .fs-table-cell {
    padding: 12px 16px;
  }

  .fs-table-title {
    font-size: 16px;
  }
}

/* Light Theme */
.field-status-theme-light .fs-banner {
  /* Color set dynamically via inline style */
}

/* Dark Theme */
.field-status-theme-dark .fs-banner {
  filter: brightness(0.85);
}

/* Auto Theme - matches system preference */
@media (prefers-color-scheme: dark) {
  .field-status-theme-auto .fs-banner {
    filter: brightness(0.85);
  }
}

/* Print styles - hide widget when printing */
@media print {
  .field-status-widget {
    display: none !important;
  }
}
