/* CFFWU Organizing - Main CSS */

/* CSS Custom Properties */
:root {
  /* Colors */
  --color-primary: #e74c3c;
  --color-primary-dark: #c0392b;
  --color-primary-light: #ec7063;
  --color-success: #27ae60;
  --color-success-alt: #28a745;
  --color-success-bright: #4caf50;
  --color-secondary: #95a5a6;
  --color-danger: #e74c3c;
  --color-danger-dark: #c0392b;
  --color-warning: #f39c12;
  --color-info: #2196f3;
  --color-info-light: #e3f2fd;
  --color-info-dark: #0d47a1;

  /* Text Colors */
  --color-text: #333;
  --color-text-muted: #666;
  --color-text-light: #999;
  --color-text-subtle: #555;

  /* Background Colors */
  --color-bg: #f8f9fa;
  --color-bg-white: white;
  --color-bg-gray-light: #f0f0f0;
  --color-bg-gray: #f8f9fa;

  /* Border Colors */
  --color-border: #ddd;
  --color-border-light: #f0f0f0;
  --color-border-gray: #dee2e6;
  --color-border-subtle: #eee;

  /* Status Colors */
  --color-error: #d32f2f;
  --color-error-bg: #f8d7da;
  --color-error-border: #f5c6cb;
  --color-error-text: #721c24;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 10%);
  --shadow-md: 0 2px 4px rgb(0 0 0 / 10%);
  --shadow-lg: 0 4px 6px rgb(0 0 0 / 10%);
  --shadow-xl: 0 4px 8px rgb(0 0 0 / 15%);

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 16px;

  /* Spacing */
  --space-xs: 0.125rem;
  --space-sm: 0.25rem;
  --space-md: 0.5rem;
  --space-lg: 0.75rem;
  --space-xl: 1rem;
  --space-2xl: 1.25rem;
  --space-3xl: 1.5rem;
  --space-4xl: 2rem;

  /* Typography */
  --text-xs: 0.8rem;
  --text-sm: 0.85rem;
  --text-base: 0.9rem;
  --text-md: 1rem;
  --text-lg: 1.1rem;
  --text-xl: 1.3rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2rem;

  /* Font Weights */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* Transitions */
  --transition-fast: 0.1s;
  --transition-normal: 0.2s;
  --transition-slow: 0.3s;

  /* Z-Index Scale */
  --z-dropdown: 1000;
  --z-modal: 1001;

  /* Layout */
  --container-sm: 540px;
  --container-md: 720px;
  --container-lg: 960px;
  --container-xl: 1140px;
  --container-max: 800px;

  /* Touch Targets */
  --touch-target: 44px;
  --touch-target-sm: 32px;
}

/* CSS Reset & Base Styles */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Base Typography & Layout */
body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 16px;

  /* Base 16px for better mobile accessibility */
}

/* Links */
a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  color: #c0392b;
}

/* Navigation Bar */
.navbar {
  background: var(--color-bg-white);
  border-bottom: 2px solid var(--color-primary);
  padding: var(--space-xl);
  margin-bottom: var(--space-4xl);
  box-shadow: var(--shadow-sm);
}

.navbar-content {
  max-width: var(--container-xl);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-xl);
}

.navbar-brand a {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--color-primary);
  text-decoration: none;
}

.language-links {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: var(--text-base);
}

.language-links a {
  color: var(--color-text-muted);
  text-decoration: none;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  transition: all var(--transition-normal);
}

/* Pagination links - placed here for CSS specificity */
.pagination a,
.pagination span {
  padding: 0.5rem 0.875rem;
  background: white;
  border-radius: 4px;
  text-decoration: none;
  color: #333;
  border: 1px solid #ddd;
  min-height: 44px;
  display: flex;
  align-items: center;
  font-size: 0.9rem;
}

.navbar-brand a:hover {
  color: var(--color-primary-dark);
}

.language-links a:hover {
  color: var(--color-primary);
  background: var(--color-bg-gray-light);
}

.language-links a.active {
  color: var(--color-primary);
  font-weight: var(--font-semibold);
}

.language-links .separator {
  color: var(--color-border);
}

/* Auth pages */
.auth-container {
  max-width: 600px;
}

.auth-password-toggle {
  margin-top: 2rem;
}

.auth-password-toggle summary {
  cursor: pointer;
  font-weight: bold;
  padding: 0.5rem;
  background-color: #f5f5f5;
  border-radius: 4px;
}

.auth-password-toggle-content {
  margin-top: 1rem;
  padding: 1rem;
  border-left: 3px solid #ccc;
}

/* Messages */
.messages {
  margin-bottom: var(--space-xl);
}

/* Container */
.container {
  max-width: 100%;
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

/* Headings */
h1 {
  color: var(--color-text);
  border-bottom: 2px solid var(--color-primary);
  padding-bottom: var(--space-md);
  margin: 0 0 var(--space-3xl);
  font-size: var(--text-2xl);
}

h2 {
  color: var(--color-primary);
  font-size: var(--text-xl);
  margin: 0 0 var(--space-xl);
  border-bottom: 1px solid var(--color-border-light);
  padding-bottom: var(--space-md);
}

h3 {
  margin: 0 0 var(--space-lg);
  font-size: var(--text-lg);
  color: var(--color-text);
}

/* Card-specific heading styles - placed after general h3 for CSS specificity */
.card-sm h3 {
  margin-top: 0;
  color: var(--color-text);
}

.card-sm p {
  margin-bottom: 1rem;
  color: var(--color-text-muted);
}

/* Cards */

/* Cards - Base and variants */
.card {
  background: var(--color-bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
}

/* Smaller card variant for compact content */
.card-sm {
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgb(0 0 0 / 8%);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

/* Card with hover effect */
.card-hover {
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgb(0 0 0 / 15%);
}

/* Forms - Mobile First */
.form-field {
  margin-bottom: var(--space-2xl);
}

label {
  display: block;
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-md);
  color: var(--color-text);
  font-size: var(--text-base);
}

.required-indicator {
  color: var(--color-error);
  margin-left: 0.25rem;
  font-weight: bold;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: var(--space-lg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--text-md);

  /* Minimum 16px to prevent zoom on iOS */
  box-sizing: border-box;
  background: var(--color-bg-white);

  /* Remove iOS styling */
  appearance: none;
}

/* Touch-friendly focus states */
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgb(231 76 60 / 10%);
}

/* Button System - Base Classes */
button,
.btn,
.btn-primary,
.btn-secondary,
.btn-success,
.btn-danger {
  border: none;
  padding: var(--space-lg) var(--space-3xl);
  font-size: var(--text-md);
  font-weight: var(--font-semibold);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-normal);
  text-decoration: none;
  display: inline-block;
  min-height: var(--touch-target);
  min-width: var(--touch-target);
  text-align: center;
  line-height: 1.2;
  background: var(--color-primary);
  color: var(--color-bg-white);
}

/* Button Hover States */
button:hover,
.btn:hover,
.btn-primary:hover {
  background: var(--color-primary-dark);
  color: var(--color-bg-white);
}

/* Button Variants */
.btn-secondary,
button.secondary,
.btn.secondary {
  background: var(--color-primary-light);
}

.btn-secondary:hover,
button.secondary:hover,
.btn.secondary:hover {
  background: var(--color-primary);
  color: var(--color-bg-white);
}

.btn-success {
  background: var(--color-success-alt);
  flex: 1;
}

.btn-success:hover {
  background: var(--color-success);
  color: var(--color-bg-white);
}

.btn-danger {
  background: var(--color-danger);
}

.btn-danger:hover {
  background: var(--color-danger-dark);
  color: var(--color-bg-white);
}

/* Button Active States */
button:active,
.btn:active,
.btn-primary:active,
.btn-secondary:active,
.btn-success:active,
.btn-danger:active {
  transform: translateY(1px);
}

/* Button Sizes */
.btn-sm {
  padding: var(--space-md) var(--space-lg);
  font-size: var(--text-base);
}

.btn-lg {
  padding: var(--space-lg) var(--space-4xl);
  font-size: var(--text-lg);
}

/* Layout Utilities */
.flex {
  display: flex;
}

.flex-column {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.justify-between {
  justify-content: space-between;
}

.align-center {
  align-items: center;
}

.gap-1 {
  gap: var(--space-md);
}

.gap-2 {
  gap: var(--space-xl);
}

/* Additional spacing utilities */
.gap-sm {
  gap: var(--space-sm);
}

.gap-lg {
  gap: var(--space-lg);
}

/* Spacing Utilities */
.p-0 {
  padding: 0;
}

.p-1 {
  padding: var(--space-md);
}

.p-2 {
  padding: var(--space-xl);
}

.p-3 {
  padding: var(--space-3xl);
}

.p-4 {
  padding: var(--space-4xl);
}

.pt-1 {
  padding-top: var(--space-md);
}

.pt-2 {
  padding-top: var(--space-xl);
}

.pr-1 {
  padding-right: var(--space-md);
}

.pr-2 {
  padding-right: var(--space-xl);
}

.pb-1 {
  padding-bottom: var(--space-md);
}

.pb-2 {
  padding-bottom: var(--space-xl);
}

.pl-1 {
  padding-left: var(--space-md);
}

.pl-2 {
  padding-left: var(--space-xl);
}

.m-0 {
  margin: 0;
}

.m-1 {
  margin: var(--space-md);
}

.m-2 {
  margin: var(--space-xl);
}

.m-3 {
  margin: var(--space-3xl);
}

.m-4 {
  margin: var(--space-4xl);
}

.mt-1 {
  margin-top: var(--space-md);
}

.mt-2 {
  margin-top: var(--space-xl);
}

.mr-1 {
  margin-right: var(--space-md);
}

.mr-2 {
  margin-right: var(--space-xl);
}

.mb-1 {
  margin-bottom: var(--space-md);
}

.mb-2 {
  margin-bottom: var(--space-xl);
}

.ml-1 {
  margin-left: var(--space-md);
}

.ml-2 {
  margin-left: var(--space-xl);
}

/* Text Utilities */
.text-xs {
  font-size: var(--text-xs);
}

.text-sm {
  font-size: var(--text-sm);
}

.text-base {
  font-size: var(--text-base);
}

.text-lg {
  font-size: var(--text-lg);
}

.text-xl {
  font-size: var(--text-xl);
}

.font-normal {
  font-weight: var(--font-normal);
}

.font-medium {
  font-weight: var(--font-medium);
}

.font-semibold {
  font-weight: var(--font-semibold);
}

.font-bold {
  font-weight: var(--font-bold);
}

.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

/* Color Utilities */
.text-primary {
  color: var(--color-primary);
}

.text-success {
  color: var(--color-success);
}

.text-danger {
  color: var(--color-danger);
}

.text-muted {
  color: var(--color-text-muted);
}

.bg-primary {
  background-color: var(--color-primary);
}

.bg-success {
  background-color: var(--color-success);
}

.bg-danger {
  background-color: var(--color-danger);
}

.bg-white {
  background-color: var(--color-bg-white);
}

.bg-gray {
  background-color: var(--color-bg-gray);
}

/* Grid System */
.grid {
  display: grid;
  gap: var(--space-xl);
}

.grid-auto {
  grid-template-columns: 1fr;
}

/* Detail Rows - Stacked on Mobile */
.detail-row {
  display: block;
  padding: var(--space-lg) 0;
  border-bottom: 1px solid var(--color-border-light);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-weight: var(--font-semibold);
  color: var(--color-text-subtle);
  font-size: var(--text-base);
  margin-bottom: var(--space-sm);
}

.detail-value {
  color: var(--color-text);
  overflow-wrap: break-word;
}

/* Dropdown & Autocomplete System */
.dropdown-wrapper,
.autocomplete-wrapper {
  position: relative;
}

.dropdown-results,
.autocomplete-results,
.multiselect-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  max-height: 200px;
  overflow-y: auto;
  z-index: var(--z-dropdown);
  box-shadow: var(--shadow-lg);
}

.dropdown-item,
.autocomplete-result,
.autocomplete-item {
  padding: var(--space-lg);
  cursor: pointer;
  border-bottom: 1px solid var(--color-border-light);
  min-height: var(--touch-target);
  display: flex;
  align-items: center;
}

.dropdown-item:hover,
.autocomplete-result:hover,
.autocomplete-item:hover {
  background: var(--color-bg-gray);
}

.dropdown-no-results,
.autocomplete-no-results,
.multiselect-no-results {
  padding: var(--space-lg);
  color: var(--color-text-muted);
  background: var(--color-bg-white);
}

.dropdown-create,
.autocomplete-create,
.multiselect-create-item {
  padding: var(--space-lg);
  cursor: pointer;
  background: var(--color-bg-gray-light);
  border-top: 2px solid var(--color-border-gray);
  font-weight: var(--font-bold);
  color: var(--color-text);
}

/* Multiselect Tag Styles */
.item-tag {
  display: inline-flex;
  align-items: center;
  background: #e3f2fd;
  border: 1px solid #2196f3;
  border-radius: 16px;
  padding: 0.375rem 0.75rem;
  margin: 0.125rem;
  font-size: 0.85rem;
  gap: 0.5rem;
}

/* Remove Button Styles */
.item-tag .remove-item {
  background: none;
  border: none;
  color: #f44336;
  cursor: pointer;
  font-weight: bold;
  padding: 0;
  min-width: 24px;
  min-height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

/* Multiselect Container Styles */
.multiselect-container {
  min-height: 80px;
  position: relative;
}

.multiselect-container input[type="text"] {
  border: none;
  outline: none;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  padding: 0.5rem;
}

/* Common Inline Form Styling */
.inline-form-card {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 1rem;
  margin-top: 0.5rem;
  box-shadow: 0 2px 4px rgb(0 0 0 / 10%);
}

.inline-form-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
  gap: 1rem;
}

.close-inline-form {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: #666;
  padding: 0;
  min-width: 32px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Error Messages */
.errorlist {
  color: #d32f2f;
  list-style: none;
  padding: 0;
  margin: 0.25rem 0;
}

.errorlist li {
  font-size: 0.875rem;
  margin-bottom: 0.125rem;
}

.error {
  color: #d32f2f;
  font-size: 0.875rem;
  margin: 0.25rem 0;
  display: block;
}

.help-text {
  font-size: 0.8rem;
  color: #666;
  margin-top: 0.25rem;
}

/* Header Actions */
.header-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.back-link {
  color: #e74c3c;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.back-link:hover {
  color: #c0392b;
}

/* Intro Sections */
.intro {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 4px rgb(0 0 0 / 10%);
  border-left: 4px solid #e74c3c;
}

/* Action Form Cards */
.action-forms {
  display: grid;
  gap: 1rem;
}

/* Legacy: .action-form-card replaced by .card-sm.card-hover */

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* Alert Styles */
.alert {
  padding: 0.75rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.alert-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-info {
  background: #e3f2fd;
  color: #0d47a1;
  border-left: 3px solid #2196f3;
}

/* Responsive Breakpoints */

/* Small tablets and large phones (576px and up) */
@media (width >=576px) {
  body {
    padding: 1.5rem;
  }

  .container {
    max-width: 540px;
  }

  h1 {
    font-size: 2rem;
  }

  .card {
    padding: 1.5rem;
  }

  .header-actions {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .action-buttons {
    flex-flow: row wrap;
  }
}

/* Medium devices (tablets, 768px and up) */
@media (width >=768px) {
  body {
    padding: 2rem;
  }

  .container {
    max-width: 720px;
  }

  .grid-auto {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }

  .action-forms {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }

  /* Detail rows can be side-by-side on tablets */
  .detail-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1rem;
  }

  .detail-label {
    margin-bottom: 0;
  }
}

/* Large devices (desktops, 992px and up) */
@media (width >=992px) {
  .container {
    max-width: 960px;
  }

  .intro {
    padding: 2rem;
  }

  .card {
    padding: 2rem;
  }
}

/* Extra large devices (1200px and up) */
@media (width >=1200px) {
  .container {
    max-width: 1140px;
  }
}

/* Print Styles */
@media print {
  body {
    background: white;
    padding: 0;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }

  .header-actions .back-link {
    display: none;
  }
}

/* High DPI Display Adjustments */
@media (resolution >=192dpi) {
  .card {
    box-shadow: 0 1px 2px rgb(0 0 0 / 10%);
  }
}

/* Tables - Responsive */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
}

th,
td {
  padding: 0.75rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
  overflow-wrap: break-word;
}

th {
  background: #f8f9fa;
  font-weight: 600;
  color: #555;
  font-size: 0.875rem;
}

tr:hover {
  background: #f8f9fa;
}

.view-link {
  color: #e74c3c;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.875rem;
}

.view-link:hover {
  color: #c0392b;
}

/* Mobile-first table approach - stack cells vertically */
@media (width <=767px) {
  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
  }

  tr {
    border: 1px solid #ddd;
    margin-bottom: 1rem;
    border-radius: 6px;
    background: white;
    padding: 1rem;
    box-shadow: 0 2px 4px rgb(0 0 0 / 10%);
  }

  thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  td {
    border: none;
    padding: 0.5rem 0;
    position: relative;
    border-bottom: 1px solid #f0f0f0;
    overflow-wrap: break-word;
    white-space: normal;
  }

  td:last-child {
    border-bottom: none;
  }

  td::before {
    content: attr(data-label);
    display: block;
    font-weight: 600;
    color: #555;
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  /* Special handling for actions cell */
  td[data-label="Actions"] .actions-cell {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: 0.5rem;
  }

  td[data-label="Actions"] .view-link,
  td[data-label="Actions"] .btn {
    width: 100%;
    text-align: center;
    padding: 0.75rem;
    display: block;
  }
}

/* Pagination */
.pagination {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pagination a:hover {
  background: #e74c3c;
  color: white;
  border-color: #e74c3c;
}

.pagination .current {
  background: #e74c3c;
  color: white;
  border-color: #e74c3c;
}

/* Empty State */
.empty-state {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  text-align: center;
  color: #666;
  box-shadow: 0 2px 4px rgb(0 0 0 / 10%);
}

.empty-state h2 {
  color: #999;
  margin-bottom: 1rem;
}

/* Autocomplete and Widget Specific Styles */
.autocomplete-container {
  position: relative;
}

.autocomplete-input {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.autocomplete-results-positioned {
  position: absolute;
  z-index: 1000;
  width: 100%;
  max-height: 300px;
  overflow-y: auto;
  background: white;
  border: 1px solid #ccc;
  border-top: none;
}

.autocomplete-inline-form {
  position: relative;
  z-index: 999;
  width: 100%;
}

.autocomplete-item-clickable {
  padding: 8px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
}

.autocomplete-item-clickable:hover,
.autocomplete-item:hover {
  background: #f5f5f5;
}

.autocomplete-no-results {
  padding: 8px;
  color: #666;
}

.autocomplete-create {
  padding: 8px;
  cursor: pointer;
  background: #f0f0f0;
  border-top: 2px solid #ccc;
  font-weight: bold;
  color: #333;
}

.autocomplete-create:hover {
  background: #e0e0e0;
}

.multiselect-autocomplete-item {
  padding: 8px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  background: white;
}

.multiselect-autocomplete-item:hover {
  background: #f5f5f5;
}

.multiselect-no-results {
  padding: 8px;
  color: #666;
  background: white;
}

.multiselect-create-item {
  padding: 8px;
  cursor: pointer;
  background: #f0f0f0;
  border-top: 2px solid #ccc;
  font-weight: bold;
  color: #333;
}

.multiselect-create-item:hover {
  background: #e0e0e0;
}

.add-indicator {
  float: right;
  color: #4caf50;
  font-weight: bold;
}

.form-error-list {
  margin: 0.5rem 0 0 1.5rem;
}

.form-grid-two-col {
  grid-template-columns: 2fr 1fr;
  gap: 0.75rem;
}

.form-grid-equal-col {
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.form-gap-default {
  gap: 0.75rem;
}

.form-button-row {
  margin-top: var(--space-md);
}

.inline-form-actions {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-lg);
  flex-shrink: 0;
}

.multiselect-search-input {
  margin-top: var(--space-md);
  position: relative;
}

.multiselect-inline-form {
  margin-top: var(--space-md);
}

.success-message {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #d4edda;
  color: #155724;
  padding: 0.5rem;
  border: 1px solid #c3e6cb;
  border-radius: 0 0 4px 4px;
  z-index: 1001;
  text-align: center;
  font-size: 0.9rem;
}

/* Form Building Template Styles */

/* Thank you page styles */
.thank-you-page {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem;
  line-height: 1.6;
  background: #f8f9fa;
}

.thank-you-message {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgb(0 0 0 / 10%);
  text-align: center;
}

.thank-you-message h1 {
  color: #27ae60;
  margin-top: 0;
}

.thank-you-message p {
  color: #333;
  font-size: 1.1rem;
}

/* Submission detail inline edit styles */
.detail-value-editable {
  position: relative;
  padding-right: 30px;
}

.edit-icon {
  position: absolute;
  right: 5px;
  top: 0;
  font-size: 0.9em;
}

.detail-value input,
.detail-value select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1em;
  font-family: inherit;
}

.detail-value input:focus,
.detail-value select:focus {
  outline: none;
  border-color: #e74c3c;
  box-shadow: 0 0 0 2px rgb(231 76 60 / 10%);
}

/* Checkbox and radio styles in detail view */
.detail-value ul.checkbox-list,
.detail-value ul.radio-list {
  list-style: none;
  padding-left: 0;
}

.detail-value ul.checkbox-list li,
.detail-value ul.radio-list li {
  margin-bottom: 0.5rem;
}

.detail-value input[type="checkbox"],
.detail-value input[type="radio"] {
  width: auto;
  margin-right: 0.5rem;
}

/* Mobile-specific adjustments for detail values */
@media (width <=767px) {
  .detail-value ul {
    padding-left: 1rem;
  }
}

/* Field editing form styles */
.field-edit-form {
  display: flex;
  gap: 0.5rem;
  align-items: start;
}

.field-edit-input-container {
  flex: 1;
}

/* Checkbox and radio groups inherit styles from parent container */

.field-edit-choice-label {
  display: block;
  margin-bottom: 0.5rem;
}

.field-edit-choice-text {
  margin-left: 0.5rem;
}

.field-edit-actions {
  display: flex;
  gap: var(--space-md);
  flex-shrink: 0;
}

/* Mobile-specific adjustments for field edit form */
@media (width <= 767px) {
  .field-edit-form {
    flex-direction: column;
    align-items: stretch;
  }

  .field-edit-actions {
    flex-direction: column;
    margin-top: var(--space-md);
  }

  .field-edit-actions button {
    width: 100%;
  }
}

.field-edit-error {
  color: var(--color-error);
  font-size: var(--text-base);
  margin-top: var(--space-sm);
}

/* Submission list table styles */
.submission-table {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgb(0 0 0 / 10%);
  overflow: hidden;
}

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

.submission-table th {
  background: #e74c3c;
  color: white;
  padding: 1rem;
  text-align: left;
  font-weight: 600;
}

.submission-table td {
  padding: 1rem;
  border-bottom: 1px solid #f0f0f0;
}

.submission-table tr:hover {
  background: #f8f9fa;
}

.submission-table tr:last-child td {
  border-bottom: none;
}

.submission-delete-form {
  margin: 0;
}

.actions-cell {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Table toolbar - for actions like export */
.table-toolbar {
  display: flex;
  justify-content: flex-start;
  gap: 0.5rem;
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
  align-items: center;
}

/* Desktop-only utility class */
@media (width <= 576px) {
  .desktop-only {
    display: none;
  }
}

/* Hidden utility class */
.hidden {
  display: none;
}

/* Filter Card Styles */
.filter-card {
  margin-bottom: 1.5rem;
}

.filter-card h2 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.filter-grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.filter-field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
  color: var(--color-text);
}

.filter-card .filter-field input,
.filter-card .filter-field select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.filter-card .filter-field input:focus,
.filter-card .filter-field select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgb(231 76 60 / 20%);
}

.filter-field select[multiple] {
  height: auto;
  min-height: 80px;
}

.filter-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Aggregates Card Styles */
.aggregates-card {
  margin-bottom: 1.5rem;
}

.aggregates-card h2 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.aggregates-table-wrapper {
  overflow-x: auto;
}

.aggregates-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.aggregates-card .aggregates-table th,
.aggregates-card .aggregates-table tbody td {
  padding: 0.5rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border-light);
}

.aggregates-card .aggregates-table thead th {
  background: var(--color-bg-gray);
  font-weight: 600;
  color: var(--color-text);
}

.aggregates-card .aggregates-table tbody tr:hover {
  background: var(--color-bg-gray);
}

.aggregates-card .aggregates-table .totals-row {
  background: var(--color-bg-gray);
  font-weight: 600;
}

.aggregates-card .aggregates-table .totals-row th {
  border-top: 2px solid var(--color-primary);
}

/* Responsive filter grid */
@media (width >= 576px) {
  .filter-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (width >= 992px) {
  .filter-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
