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

/* Import Manrope font from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&display=swap');

/* Reset and Base Styles */
.field-status-widget {
  border-radius: 16px;
  box-sizing: border-box;
  font-family:
    'Manrope',
    -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:
    'Manrope',
    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: #70d5b3; /* Green (60% opacity equivalent on white) */
  border-bottom-color: #059669; /* Darker green border */
  color: #064e3b; /* Dark green text */
}

/* Warning - Some fields closed or warning message */
.fs-warning {
  background-color: #fdd97c; /* Yellow/amber (60% opacity equivalent on white) */
  border-bottom-color: #d97706; /* Darker amber border */
  color: #78350f; /* Dark amber text */
}

/* Error - All fields closed or error message */
.fs-error {
  background-color: #f58f8f; /* Red (60% opacity equivalent on white) */
  border-bottom-color: #dc2626; /* Darker red border */
  color: #7f1d1d; /* Dark red text */
}

/* 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: 16px;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.1),
    0 1px 4px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.fs-table-header {
  padding: 14px 20px 12px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

.fs-table-eyebrow-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.fs-table-eyebrow {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0;
}

.fs-table-title {
  font-size: 22px;
  font-weight: 700;
  color: #111827;
  margin: 0;
  line-height: 1.2;
}

/* Summary text */
.fs-table-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

.fs-summary-open {
  color: #059669;
}

.fs-summary-sep {
  color: #d1d5db;
}

.fs-summary-closed {
  color: #dc2626;
}

.fs-table-timestamp {
  font-size: 11px;
  color: #9ca3af;
  margin: 0;
}

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


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

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

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

.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: 6px;
  font-size: 13px;
  font-weight: 500;
}

.fs-status-badge-open {
  background-color: #dcfce7;
  color: #166534;
}

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

.fs-table-footer {
  display: flex;
  justify-content: flex-end;
  padding: 12px 20px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
}

.fs-powered-by {
  font-size: 11px;
  color: #9ca3af;
  text-decoration: none;
  transition: color 0.2s ease;
}

.fs-powered-by:hover {
  color: #4b5563;
  text-decoration: underline;
}

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

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

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

/* 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;
  }
}
