/**
 * Gravity Forms Entry Display - Styles
 */

/* Container */
.gfed-entry-container {
  max-width: 1200px;
  margin: 30px auto;
  padding: 30px;
  background: #fff;
  border-radius: 8px !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
}

/* Header */
.gfed-header {
  border-bottom: 3px solid #8b0015 !important;
  padding-bottom: 20px;
  margin-bottom: 30px;
}

.gfed-header h1 {
  margin: 0 0 15px 0;
  color: #333;
  font-size: 32px;
}

.gfed-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
}

.gfed-form-name {
  font-weight: 600;
  color: #555;
  font-size: 16px;
}

.gfed-date {
  color: #777;
  font-size: 14px;
}

.gfed-status {
  padding: 5px 15px;
  border-radius: 20px;
  font-weight: bold;
  font-size: 13px;
  text-transform: uppercase;
}

.gfed-status.status-active {
  background-color: #4caf50;
  color: white;
}

.gfed-status.status-spam {
  background-color: #f44336;
  color: white;
}

.gfed-status.status-trash {
  background-color: #999;
  color: white;
}

/* Entry Information Section */
.gfed-entry-info {
  background: #f9f9f9;
  padding: 25px;
  margin-bottom: 30px;
  border-radius: 6px;
  border-left: 4px solid #8b0015;
}

.gfed-entry-info h2 {
  margin: 0 0 20px 0;
  color: #333;
  font-size: 20px;
}

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

.gfed-info-item {
  display: flex;
  gap: 10px;
}

.gfed-label {
  font-weight: 600;
  color: #555;
  min-width: 140px;
}

.gfed-value {
  color: #333;
  word-break: break-word;
}

/* Fields Section */
.gfed-fields {
  margin-top: 30px;
  display: flex;
  flex-wrap: wrap;
  /* order: -1; */
  flex-direction: column;
}

.gfed-fields h2 {
  margin: 0 0 25px 0;
  color: #333;
  font-size: 24px;
  border-bottom: 2px solid #ddd;
  padding-bottom: 10px;
}

/* Individual Field */
.gfed-field,
.gfcom-action-section {
  background: #fff;
  border: 1px solid #ddd !important;
  border-radius: 6px !important;
  padding: 20px 6px !important;
  margin: 20px 6px !important;
  transition: box-shadow 0.2s !important;
}

.gfed-field:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/*.gfed-field-admin {
  border-left: 4px solid #ff9800;
  background-color: #fff8f0;
}

.gfed-field-hidden {
  border-left: 4px solid #9c27b0;
  background-color: #f8f0ff;
}*/

.gfed-field-status {
  order: -2;
}
.gfed-field-notes {
  order: -1;
}

.gfed-field-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-weight: 600;
  color: #333;
  font-size: 16px;
  flex-wrap: wrap;
}

.gfed-field-id {
  font-size: 12px;
  color: #999;
  font-weight: normal;
  margin-left: auto;
}

.gfed-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.gfed-badge-admin {
  background-color: #ff9800;
  color: white;
}

.gfed-badge-hidden {
  background-color: #9c27b0;
  color: white;
}

.gfed-field-value {
  color: #555;
  font-size: 15px;
  line-height: 1.6;
}

.gfed-empty {
  color: #999;
  font-style: italic;
}

/* Complex Fields */
.gfed-complex-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gfed-subfield {
  padding: 8px 0;
}

.gfed-subfield strong {
  color: #555;
  margin-right: 8px;
}

/* Textarea Fields */
.gfed-textarea {
  white-space: pre-wrap;
  padding: 12px;
  background: #f5f5f5;
  border-radius: 4px;
  border: 1px solid #e0e0e0;
}

/* File Upload Fields */
.gfed-files {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gfed-file {
  display: flex;
  align-items: center;
  padding: 10px;
  background: #f5f5f5;
  border-radius: 4px;
  border: 1px solid #e0e0e0;
}

.gfed-file a {
  color: #2196f3;
  text-decoration: none;
  font-weight: 500;
}

.gfed-file a:hover {
  text-decoration: underline;
}

/* List Field Table */
.gfed-list-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.gfed-list-table td {
  padding: 10px;
  border: 1px solid #ddd;
  background: #f9f9f9;
}

.gfed-list-table tr:nth-child(even) td {
  background: #fff;
}

/* Loading State */
.gfed-loading {
  text-align: center;
  padding: 50px;
  color: #777;
  font-size: 18px;
}

.gfed-loading::after {
  content: "...";
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%,
  20% {
    content: ".";
  }
  40% {
    content: "..";
  }
  60%,
  100% {
    content: "...";
  }
}

/* Error State */
.gfed-error {
  background: #fff3cd;
  border: 1px solid #ffc107;
  color: #856404;
  padding: 15px 20px;
  border-radius: 4px;
  margin: 20px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
  .gfed-entry-container {
    padding: 20px 15px;
    margin: 15px;
  }

  .gfed-header h1 {
    font-size: 24px;
  }

  .gfed-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .gfed-info-grid {
    grid-template-columns: 1fr;
  }

  .gfed-field-label {
    flex-direction: column;
    align-items: flex-start;
  }

  .gfed-field-id {
    margin-left: 0;
  }
}

/* Print Styles */
@media print {
  .gfed-entry-container {
    box-shadow: none;
    max-width: 100%;
  }

  .gfed-field:hover {
    box-shadow: none;
  }

  .gfed-badge {
    border: 1px solid #333;
  }
}

/* Dashboard Styles */
.gfed-dashboard-container {
  max-width: 1400px;
  margin: 30px auto;
  padding: 30px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.gfed-dashboard-header {
  border-bottom: 3px solid #8b0015;
  padding-bottom: 20px;
  margin-bottom: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gfed-dashboard-header h1 {
  margin: 0;
  color: #333;
  font-size: 32px;
}

.gfed-dashboard-count {
  color: #777;
  font-size: 16px;
  margin: 0;
}

.gfed-dashboard-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}

.gfed-dashboard-table thead {
  background-color: #f5f5f5;
  border-bottom: 2px solid #ddd;
}

.gfed-dashboard-table th {
  padding: 15px 12px;
  text-align: left;
  font-weight: 600;
  color: #555;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.gfed-dashboard-table td {
  padding: 15px 12px;
  border-bottom: 1px solid #eee;
  color: #333;
  font-size: 14px;
}

.gfed-dashboard-table tbody tr {
  transition: background-color 0.2s;
}

.gfed-dashboard-table tbody tr:hover {
  background-color: #f9f9f9;
}

.gfed-status-badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.gfed-status-badge.status-active,
.gfed-status-badge.status-pending,
.gfed-status-badge.status-in-progress {
  background-color: #ff9800;
  color: white;
}

.gfed-status-badge.status-complete,
.gfed-status-badge.status-approved {
  background-color: #4caf50;
  color: white;
}

.gfed-status-badge.status-denied,
.gfed-status-badge.status-cancelled {
  background-color: #f44336;
  color: white;
}

.gfed-status-badge.status-empty,
.gfed-status-badge.status-not-configured {
  background-color: #9e9e9e;
  color: white;
  font-style: italic;
}

.gfed-view-button {
  display: inline-block;
  padding: 8px 16px;
  background-color: #2196f3;
  color: white !important;
  text-decoration: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  transition: background-color 0.2s;
}

.gfed-view-button:hover {
  background-color: #0b7dda;
  color: white !important;
}

.gfed-no-entries {
  text-align: center;
  padding: 60px 20px;
  color: #999;
  font-size: 16px;
}

#gfed-dashboard-content {
  animation: fadeIn 0.3s;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Responsive Dashboard */
@media (max-width: 1200px) {
  .gfed-dashboard-table {
    font-size: 13px;
  }

  .gfed-dashboard-table th,
  .gfed-dashboard-table td {
    padding: 12px 8px;
  }
}

@media (max-width: 768px) {
  .gfed-dashboard-container {
    padding: 20px 15px;
    margin: 15px;
  }

  .gfed-dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .gfed-dashboard-header h1 {
    font-size: 24px;
  }

  /* Stack table on mobile */
  .gfed-dashboard-table {
    display: block;
  }

  .gfed-dashboard-table thead {
    display: none;
  }

  .gfed-dashboard-table tbody,
  .gfed-dashboard-table tr,
  .gfed-dashboard-table td {
    display: block;
    width: 100%;
  }

  .gfed-dashboard-table tr {
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    background: #fafafa;
  }

  .gfed-dashboard-table td {
    text-align: left;
    padding: 8px 0;
    border: none;
  }

  .gfed-dashboard-table td::before {
    content: attr(data-label);
    font-weight: 600;
    display: inline-block;
    width: 100px;
    color: #555;
  }

  .gfed-view-button {
    display: block;
    text-align: center;
    margin-top: 10px;
  }
}

/* DataTables Integration */
.dataTables_wrapper {
  padding: 0;
  margin-top: 20px;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
  margin-bottom: 20px;
}

.dataTables_wrapper .dataTables_length {
  float: left;
}

.dataTables_wrapper .dataTables_filter {
  float: right;
}

.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
  font-size: 14px;
  font-weight: 500;
  color: #555;
}

.dataTables_wrapper .dataTables_length select {
  padding: 6px 30px 6px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  margin: 0 8px;
  background: white;
}

.dataTables_wrapper .dataTables_filter input {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  margin-left: 8px;
  width: 250px;
}

.dataTables_wrapper .dataTables_info {
  padding-top: 20px;
  color: #666;
  font-size: 14px;
  float: left;
  clear: both;
}

.dataTables_wrapper .dataTables_paginate {
  padding-top: 20px;
  float: right;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  padding: 6px 12px;
  margin: 0 2px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: white;
  color: #8b0015;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-block;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: #8b0015;
  color: white;
  border-color: #8b0015;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: #8b0015;
  color: white;
  border-color: #8b0015;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
  opacity: 0.4;
  cursor: not-allowed;
  background: white;
  color: #999;
  border-color: #ddd;
}

/* DataTables Sorting Icons */
.gfed-dashboard-table thead th {
  cursor: pointer;
  position: relative;
  padding-right: 25px !important;
}

.gfed-dashboard-table thead th.sorting:before,
.gfed-dashboard-table thead th.sorting_asc:before,
.gfed-dashboard-table thead th.sorting_desc:before {
  position: absolute;
  right: 10px;
  opacity: 0.3;
  font-size: 11px;
}

.gfed-dashboard-table thead th.sorting_asc:before,
.gfed-dashboard-table thead th.sorting_desc:before {
  opacity: 1;
}

/* Make table responsive */
.dataTables_wrapper .dataTables_scroll {
  overflow-x: auto;
}

/* Clear floats */
.dataTables_wrapper:after {
  content: "";
  display: table;
  clear: both;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter {
    float: none;
    text-align: left;
    margin-bottom: 15px;
  }

  .dataTables_wrapper .dataTables_filter input {
    width: 100%;
    max-width: 300px;
  }

  .dataTables_wrapper .dataTables_info,
  .dataTables_wrapper .dataTables_paginate {
    float: none;
    text-align: center;
  }

  .dataTables_wrapper .dataTables_paginate {
    margin-top: 15px;
  }
}

/* Field ID Toggle - Hidden by default, shown on hover */
.gfed-field-id-toggle {
  display: inline-block;
  margin-left: 8px;
  font-size: 11px;
  color: #999;
  font-weight: normal;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.gfed-field-label:hover .gfed-field-id-toggle,
.gfed-field-label:focus-within .gfed-field-id-toggle {
  opacity: 1;
}

/* Status Dropdown Styling */
.gfed-status-dropdown {
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: white;
  cursor: pointer;
  transition: border-color 0.2s;
}

.gfed-status-dropdown:hover {
  border-color: #8b0015;
}

.gfed-status-dropdown:focus {
  outline: none;
  border-color: #8b0015;
  box-shadow: 0 0 0 2px rgba(139, 0, 21, 0.1);
}

.gfed-status-saving,
.gfed-status-saved {
  font-size: 13px;
  font-weight: 500;
  animation: fadeIn 0.3s;
}
.gfed-textarea-input {
  font-family: inherit;
  font-size: inherit;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  resize: vertical;
}

.gfed-textarea-actions {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.gfed-textarea-save,
.gfed-textarea-cancel {
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.gfed-textarea-save {
  background: #0073aa;
  color: white;
}

.gfed-textarea-save:hover {
  background: #005177;
}

.gfed-textarea-cancel {
  background: #f0f0f0;
  color: #333;
}

.gfed-textarea-cancel:hover {
  background: #e0e0e0;
}

.gfed-textarea-edit-btn {
  padding: 4px 10px;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

.gfed-textarea-edit-btn:hover {
  background: #e0e0e0;
}

.gfed-textarea-saving {
  color: #666;
  font-style: italic;
}

.gfed-textarea-saved {
  color: #46b450;
  font-weight: bold;
}

.gfed-textarea-display {
  min-height: 20px;
  padding: 5px 0;
}

.gfed-html-content {
  line-height: 1.6;
}

.gfed-html-content p {
  margin: 0 0 1em 0;
}

.gfed-image-thumbnail:hover {
  opacity: 0.8;
  transform: scale(1.02);
  transition: all 0.2s ease;
}

.gfed-image-file {
  margin: 10px 0;
  display: inline-block;
  text-align: center;
}

.gfed-files {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Viewas section tables */
.gfed-viewas-section {
  margin-bottom: 40px;
}

.gfed-viewas-section-title {
  font-size: 1.1em;
  font-weight: 600;
  margin: 0 0 12px 0;
  padding-bottom: 6px;
  border-bottom: 2px solid #8b0015;
  color: #8b0015;
}

/* View toggle bar for admins (switch between personal and full view) */
.gfed-view-toggle-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.gfed-toggle-view {
  padding: 8px 18px;
  background: #fff;
  color: #8b0015;
  border: 2px solid #8b0015;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background-color 0.2s,
    color 0.2s;
}

.gfed-toggle-view:hover {
  background: #8b0015;
  color: #fff;
}

/* Viewas admin notice */
.gfed-viewas-notice {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-left: 4px solid #ffc107;
  border-radius: 4px;
  padding: 10px 16px;
  margin-bottom: 20px;
  font-size: 0.95em;
  color: #856404;
}
