/*
 * Novarune WC Scheduling - Bricks Element Styles
 * Ensures proper integration with Bricks Builder and fixes layout issues
 */

/* Fix for Variable Product Form Layout - Force custom fields out of table layout */
.novr-sched-plugin-wrap.novr-break-table-layout {
  display: block !important;
  width: 100% !important;
  clear: both !important;
  margin-top: 20px !important;
  /* Break out of any parent table/flex/grid contexts */
  position: relative !important;
  z-index: 1 !important;
}

/* Force table layout reset for custom fields section */
.novr-sched-plugin-wrap.novr-break-table-layout * {
  display: revert !important;
  float: none !important;
  table-layout: auto !important;
  vertical-align: baseline !important;
}

/* Specifically target the custom fields container */
.novr-sched-plugin-wrap .novr-sched-custom-fields {
  display: block !important;
  width: 100% !important;
  clear: both !important;
  /* Reset any inherited table styling */
  border-collapse: separate !important;
  border-spacing: 0 !important;
  table-layout: auto !important;
}

/* Ensure form rows display as proper block elements */
.novr-sched-plugin-wrap .novr-form-row {
  display: block !important;
  width: 100% !important;
  margin-bottom: 16px !important;
  clear: both !important;
  box-sizing: border-box !important;
}

/* Force label and input to display in proper layout */
.novr-sched-plugin-wrap .novr-form-row label {
  display: block !important;
  width: 100% !important;
  margin-bottom: 8px !important;
  font-weight: 600 !important;
}

.novr-sched-plugin-wrap .novr-form-row input,
.novr-sched-plugin-wrap .novr-form-row select,
.novr-sched-plugin-wrap .novr-form-row textarea {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* Bricks Element Custom Field Layout Override */
.novr-bricks-element .novr-enhanced-custom-fields {
  display: block !important;
  width: 100% !important;
}

/* Force single-column layout by default */
.novr-bricks-element .novr-enhanced-custom-fields .novr-form-row,
.novr-bricks-element .novr-enhanced-custom-fields .novr-custom-field-wrapper {
  display: block !important;
  width: 100% !important;
  float: none !important;
  flex: none !important;
  grid-column: auto !important;
  margin-right: 0 !important;
  margin-left: 0 !important;
  box-sizing: border-box;
}

/* Override any theme or WooCommerce flex/grid layouts that cause 2-column display */
.novr-bricks-element form.cart .novr-enhanced-custom-fields {
  display: block !important;
}

.novr-bricks-element form.cart .novr-enhanced-custom-fields .novr-form-row {
  display: block !important;
  width: 100% !important;
  margin-bottom: 20px;
}

.single_variation_wrap {
    width: 100%;
}

/* Table integration: Override any theme or WooCommerce flex/grid layouts */
.novr-bricks-element table.variations,
.novr-bricks-element .novr-created-table {
  display: table !important;
  width: 100% !important;
  table-layout: auto !important;
  border-collapse: collapse !important;
}

.novr-bricks-element table.variations tbody,
.novr-bricks-element .novr-created-table tbody {
  display: table-row-group !important;
}

.novr-bricks-element .novr-date-row,
.novr-bricks-element .novr-custom-field,
.novr-bricks-element .novr-scheduling-header {
  display: table-row !important;
  width: 100% !important;
}

.novr-bricks-element .novr-date-row th.label,
.novr-bricks-element .novr-date-row td.value,
.novr-bricks-element .novr-custom-field th.label,
.novr-bricks-element .novr-custom-field td.value {
  display: table-cell !important;
}

/* Fix simple product form flex layout interference */
.novr-bricks-element form.cart {
  /* Allow the form to be flex for quantity/button layout */
  display: flex !important;
  flex-direction: column !important;
  gap: 20px !important;
}

/* Ensure our table doesn't get affected by the flex layout */
.novr-bricks-element form.cart .novr-created-table {
  /* Force table display even within flex container */
  display: table !important;
  flex: none !important;
  order: -1 !important; /* Place table before quantity/button */
}

/* Style our cart controls wrapper */
.novr-bricks-element form.cart .novr-cart-controls {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  flex: none !important;
}

/* Keep quantity and add to cart in a horizontal flex container */
.novr-bricks-element form.cart .quantity,
.novr-bricks-element form.cart .single_add_to_cart_button {
  flex: none !important;
}

/* Create a wrapper for quantity + button to maintain side-by-side layout */
.novr-bricks-element form.cart .quantity + .single_add_to_cart_button {
  margin-left: 10px;
}

/* Alternative: Group quantity and button together */
.novr-bricks-element form.cart {
  align-items: flex-start !important;
}

/* Force single-column layout for table cells on mobile */
@media (max-width: 768px) {
  .novr-bricks-element .novr-date-row th.label,
  .novr-bricks-element .novr-date-row td.value,
  .novr-bricks-element .novr-custom-field th.label,
  .novr-bricks-element .novr-custom-field td.value {
    display: block !important;
    width: 100% !important;
  }
}

/* Button styling that inherits from Bricks theme */
.novr-bricks-element .cart .single_add_to_cart_button,
.novr-bricks-element a.button[data-product_id] {
  /* Inherit from parent Bricks Add to Cart styling */
  background-color: inherit;
  color: inherit;
  border: inherit;
  border-radius: inherit;
  padding: inherit;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  text-decoration: inherit;
  transition: inherit;
  box-shadow: inherit;
  width: auto; /* Allow button to size naturally */
  display: inline-block; /* Ensure proper button display */
}

/* Ensure button hover states work */
.novr-bricks-element .cart .single_add_to_cart_button:hover,
.novr-bricks-element a.button[data-product_id]:hover {
  background-color: inherit;
  color: inherit;
  border-color: inherit;
  box-shadow: inherit;
  transform: inherit;
}

/* Two-column layout option (when explicitly enabled) */
.novr-bricks-element.novr-form-layout-two-columns .novr-enhanced-custom-fields {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 20px !important;
}

.novr-bricks-element.novr-form-layout-two-columns .novr-enhanced-custom-fields .novr-form-row {
  display: block !important;
  width: 100% !important;
}

/* Responsive: Force single column on mobile */
@media (max-width: 768px) {
  .novr-bricks-element.novr-form-layout-two-columns .novr-enhanced-custom-fields {
    display: block !important;
    grid-template-columns: none !important;
  }

  .novr-bricks-element.novr-form-layout-two-columns .novr-enhanced-custom-fields .novr-form-row {
    width: 100% !important;
    margin-bottom: 20px;
  }
}

/* Inherit theme color variables for consistency */
.novr-bricks-element {
  --novr-primary: var(--bricks-color-primary, var(--woocommerce-primary, #1e62d0));
  --novr-secondary: var(--bricks-color-secondary, #fc5778);
  --novr-text-dark: var(--bricks-text-dark, #212121);
  --novr-text-medium: var(--bricks-text-medium, #616161);
  --novr-border-color: var(--bricks-border-color, rgba(0,0,0,0.08));
  --novr-border-radius: var(--bricks-border-radius, 4px);
  --novr-transition: var(--bricks-transition, all 0.2s);
}

/* Calendar styling inheritance from Bricks */
.novr-bricks-element .novr-scheduling-picker {
  /* Inherit parent element styling */
  background: inherit;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
}

/* Form field styling inheritance */
.novr-bricks-element .novr-text-field,
.novr-bricks-element .novr-textarea-field,
.novr-bricks-element input[type="text"],
.novr-bricks-element input[type="email"],
.novr-bricks-element input[type="tel"],
.novr-bricks-element textarea,
.novr-bricks-element select {
  background: inherit;
  color: inherit;
  border-color: var(--novr-border-color);
  border-radius: var(--novr-border-radius);
  font-family: inherit;
  font-size: inherit;
  transition: var(--novr-transition);
}

.novr-bricks-element .novr-text-field:focus,
.novr-bricks-element .novr-textarea-field:focus,
.novr-bricks-element input:focus,
.novr-bricks-element textarea:focus,
.novr-bricks-element select:focus {
  border-color: var(--novr-primary);
  outline: none;
}

/* Label styling inheritance - Match existing labels */
.novr-bricks-element .novr-field-label,
.novr-bricks-element label,
.novr-date-row label,
.novr-custom-field label {
  /* Match existing label styling exactly */
  color: var(--bricks-text-dark, inherit);
  font-family: var(--bricks-font-family, inherit);
  font-size: var(--bricks-font-size, inherit);
  font-variant: lining-nums;
  font-weight: var(--bricks-font-weight, inherit);
  line-height: var(--bricks-line-height, 27px);
  text-align: left;
  display: block;
  border-collapse: collapse;
  box-sizing: border-box;
  border: 0px none var(--bricks-border-color, rgb(221, 222, 223));
}

/* Ensure proper spacing in Bricks Builder */
.novr-bricks-element .novr-sched-plugin-wrap {
  margin: 0; /* Remove default margins in Bricks context */
}

.novr-bricks-element .novr-sched-custom-fields {
  padding: 0; /* Remove default padding - let Bricks handle it */
  background: transparent; /* Let Bricks handle background */
  border: none; /* Let Bricks handle borders */
  margin: 0;
}

/* Icon styling for button icons */
.novr-bricks-element .cart .single_add_to_cart_button .icon,
.novr-bricks-element a.button[data-product_id] .icon {
  display: inline-block;
  vertical-align: middle;
  margin: 0 4px;
  font-size: inherit;
  line-height: 1;
}

/* Icon position variants */
.novr-bricks-element .cart .single_add_to_cart_button.icon-left .icon {
  margin-right: 8px;
  margin-left: 0;
}

.novr-bricks-element .cart .single_add_to_cart_button.icon-right .icon {
  margin-left: 8px;
  margin-right: 0;
}

.novr-bricks-element .cart .single_add_to_cart_button.icon-only {
  padding: 8px;
}

.novr-bricks-element .cart .single_add_to_cart_button.icon-only .icon {
  margin: 0;
}

/* Table Integration Styles - Match existing variations table */
.novr-date-row,
.novr-custom-field,
.novr-scheduling-header {
  /* Inherit exactly from variations table */
  color: var(--bricks-text-dark, rgb(6, 8, 14));
  font-family: var(--bricks-font-family, freight-sans-pro);
  font-size: var(--bricks-font-size, 18px);
  font-variant: lining-nums;
  line-height: var(--bricks-line-height, 27px);
  vertical-align: middle;
  border-collapse: collapse;
  box-sizing: border-box;
  border: 0px none var(--bricks-border-color, rgb(221, 222, 223));
}

/* Accessibility: Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .novr-date-row,
  .novr-custom-field,
  .novr-scheduling-header,
  .novr-native-date-picker,
  .novr-field-input,
  .novr-field-textarea,
  .novr-field-select {
    animation-delay: -1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    background-attachment: initial !important;
    scroll-behavior: auto !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
  }
}

.novr-date-row th.label,
.novr-custom-field th.label {
  /* Match existing th.label styling exactly */
  color: var(--bricks-text-dark, rgb(6, 8, 14));
  font-family: var(--bricks-font-family, freight-sans-pro);
  font-size: var(--bricks-font-size, 18px);
  font-variant: lining-nums;
  line-height: var(--bricks-line-height, 27px);
  text-align: left;
  vertical-align: top;
  border-collapse: collapse;
  box-sizing: border-box;
  border: 0px none var(--bricks-border-color, rgb(221, 222, 223));
  /* No background or padding to match existing */
}

.novr-date-row td.value,
.novr-custom-field td.value {
  /* Match existing td.value styling exactly */
  color: var(--bricks-text-dark, rgb(6, 8, 14));
  font-family: var(--bricks-font-family, freight-sans-pro);
  font-size: var(--bricks-font-size, 18px);
  font-variant: lining-nums;
  line-height: var(--bricks-line-height, 27px);
  vertical-align: middle;
  position: relative;
  border-collapse: collapse;
  box-sizing: border-box;
  border: 0px none var(--bricks-border-color, rgb(221, 222, 223));
  /* No background or padding to match existing */
}

/* Native Date Picker Input - Match existing select styling */
.novr-native-date-picker {
  /* Match the exact styling from existing selects */
  color: var(--bricks-text-dark, inherit);
  font-family: var(--bricks-font-family, inherit);
  font-size: var(--bricks-font-size, inherit);
  line-height: var(--bricks-line-height, 40px);
  background-color: var(--bricks-background-transparent, rgba(0, 0, 0, 0));
  border-collapse: collapse;
  cursor: pointer;
  transition: var(--bricks-transition, var(--novr-transition));
  background: var(--bricks-background, inherit);
  border-color: var(--bricks-border-color, var(--novr-border-color));
  border-radius: var(--bricks-border-radius, 4px);
  border: var(--bricks-border-width, 1.33333px) solid var(--bricks-border-color, rgb(221, 222, 223));
  /* Ensure full width like selects */
  width: 100%;
  box-sizing: border-box;
}

.novr-native-date-picker:hover {
  border-color: var(--bricks-primary-hover, var(--novr-primary, #999));
}

.novr-native-date-picker:focus {
  border-color: var(--bricks-primary, var(--novr-primary));
  outline: none;
}

/* Make the calendar icon more prominent when no date is selected */
.novr-native-date-picker:invalid {
  color: var(--novr-text-medium, #666);
}

.novr-native-date-picker:invalid::before {
  content: "📅 Click to select date";
  color: var(--novr-text-medium, #666);
  font-style: italic;
}

/* Hide the default calendar icon on some browsers and make our own clickable area */
.novr-native-date-picker::-webkit-calendar-picker-indicator {
  background: transparent;
  bottom: 0;
  color: transparent;
  cursor: pointer;
  height: auto;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  width: auto;
  z-index: 1;
}

/* For Firefox - make the entire field clickable */
.novr-native-date-picker::-moz-focus-inner {
  border: 0;
  padding: 0;
}

/* Date picker error states */
.novr-date-row.novr-field-error .novr-native-date-picker {
  border-color: var(--woocommerce-error, #d63638);
  box-shadow: 0 0 0 1px var(--woocommerce-error, #d63638);
}

/* Enhanced visual states for date picker */
.novr-native-date-picker.novr-date-hover {
  border-color: var(--novr-primary, #007cba);
  background-color: var(--bricks-background-light, #f9f9f9);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Empty state placeholder styling */
.novr-native-date-picker.novr-date-empty {
  color: var(--novr-text-medium, #666);
  font-style: italic;
}

.novr-native-date-picker.novr-date-empty::before {
  content: attr(data-placeholder);
  color: var(--novr-text-medium, #666);
  font-style: italic;
  pointer-events: none;
}

/* Make sure the placeholder doesn't interfere with the actual date value */
.novr-native-date-picker:not(.novr-date-empty)::before {
  display: none;
}

/* Enhanced clickable area - make the calendar picker indicator cover the entire field */
.novr-native-date-picker::-webkit-calendar-picker-indicator {
  background: transparent;
  bottom: 0;
  color: transparent;
  cursor: pointer;
  height: auto;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  width: auto;
  z-index: 1;
  opacity: 0;
}

/* Add a custom calendar icon that's always visible */
.novr-native-date-picker {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px 16px;
  padding-right: 32px; /* Make room for the calendar icon */
}

/* Hide our custom icon when there's a value (let the browser show the date) */
.novr-native-date-picker:not(.novr-date-empty) {
  background-image: none;
  padding-right: 12px;
}

/* Active/focused state */
.novr-native-date-picker:focus {
  outline: none;
  border-color: var(--novr-primary, #007cba);
  box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
  background-color: var(--bricks-background, #fff);
}

/* Field Inputs in Tables - Match existing select styling */
.novr-field-input,
.novr-field-textarea,
.novr-field-select {
  /* Match the exact styling from existing selects */
  color: var(--bricks-text-dark, inherit);
  font-family: var(--bricks-font-family, inherit);
  font-size: var(--bricks-font-size, inherit);
  line-height: var(--bricks-line-height, 40px);
  background-color: var(--bricks-background-transparent, rgba(0, 0, 0, 0));
  border-collapse: collapse;
  cursor: pointer;
  transition: var(--bricks-transition, var(--novr-transition));
  background: var(--bricks-background, inherit);
  border-color: var(--bricks-border-color, var(--novr-border-color));
  border-radius: var(--bricks-border-radius, 4px);
  border: var(--bricks-border-width, 1.33333px) solid var(--bricks-border-color, rgb(221, 222, 223));
  /* Ensure full width like selects */
  width: 100%;
  box-sizing: border-box;
}

.novr-field-input:focus,
.novr-field-textarea:focus,
.novr-field-select:focus {
  border-color: var(--bricks-primary, var(--novr-primary));
  outline: none;
}

.novr-field-textarea {
  resize: vertical;
  min-height: 80px;
}

/* Radio and Checkbox Groups in Tables */
.novr-radio-group,
.novr-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.novr-radio-layout-horizontal,
.novr-checkbox-layout-horizontal {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 16px;
}

.novr-radio-option,
.novr-checkbox-option {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  cursor: pointer;
  font-family: inherit;
  color: var(--novr-text-dark);
}

.novr-radio-option input,
.novr-checkbox-option input {
  margin: 0;
  width: auto;
  accent-color: var(--novr-primary, #007cba);
}

/* File Upload in Tables */
.novr-file-upload-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.novr-file-input {
  display: none;
}

.novr-file-button {
  padding: 8px 16px;
  background: var(--novr-primary, #007cba);
  color: white;
  border: none;
  border-radius: var(--novr-border-radius, 4px);
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
  transition: var(--novr-transition, all 0.2s);
}

.novr-file-button:hover {
  background: var(--novr-primary-dark, #005a87);
}

/* File upload feedback styles */
.novr-file-upload-wrapper.novr-file-uploaded .novr-file-name {
  color: var(--bricks-color-success, #28a745);
  font-weight: 600;
}

.novr-file-upload-wrapper.novr-file-uploaded .novr-file-button {
  background-color: var(--bricks-color-success, #28a745);
  border-color: var(--bricks-color-success, #28a745);
  color: white;
}

.novr-file-upload-wrapper.novr-file-uploaded .novr-file-button:hover {
  background-color: var(--bricks-color-success-dark, #218838);
  border-color: var(--bricks-color-success-dark, #218838);
}

.novr-file-name {
  font-size: inherit;
  color: var(--novr-text-medium, #666);
  font-style: italic;
  font-family: inherit;
}

/* Help Text */
.novr-help-text {
  display: block;
  font-size: 12px;
  color: var(--novr-text-medium, #666);
  margin-top: 4px;
  font-style: italic;
  font-family: inherit;
}

/* Required Indicator */
.required {
  color: var(--woocommerce-error, #d63638);
  font-weight: bold;
}

/* Validation Errors */
.novr-validation-error {
  background: var(--woocommerce-error-background, #fef7f1);
  border: 1px solid var(--woocommerce-error, #d63638);
  color: var(--woocommerce-error, #d63638);
  padding: 8px 12px;
  border-radius: var(--novr-border-radius, 4px);
  margin: 8px 0;
  font-size: 14px;
  font-family: inherit;
}

/* Field Error States */
.novr-custom-field.novr-field-error th.label,
.novr-date-row.novr-field-error th.label {
  border-color: var(--woocommerce-error, #d63638);
  background: var(--woocommerce-error-background, #fef7f1);
}

.novr-custom-field.novr-field-error td.value,
.novr-date-row.novr-field-error td.value {
  border-color: var(--woocommerce-error, #d63638);
}

.novr-custom-field.novr-field-error input,
.novr-custom-field.novr-field-error select,
.novr-custom-field.novr-field-error textarea,
.novr-date-row.novr-field-error input {
  border-color: var(--woocommerce-error, #d63638);
  box-shadow: 0 0 0 1px var(--woocommerce-error, #d63638);
}

.novr-field-error-message {
  color: var(--woocommerce-error, #d63638);
  font-size: 12px;
  font-style: italic;
  margin-top: 4px;
  display: block;
  font-family: inherit;
}

/* Field Focus States */
.novr-field-input.novr-field-focused,
.novr-field-select.novr-field-focused,
.novr-field-textarea.novr-field-focused {
  border-color: var(--novr-primary, #007cba);
  box-shadow: 0 0 0 1px var(--novr-primary, #007cba);
  outline: none;
}

/* Selected States for Radio/Checkbox */
.novr-radio-option.selected,
.novr-checkbox-option.selected {
  background: var(--bricks-background-light, #f9f9f9);
  border-radius: var(--novr-border-radius, 4px);
  padding: 4px 8px;
  margin: -4px -8px;
}

/* Grouped Product Conditional States */
.novr-custom-field.novr-requires-selection,
.novr-date-row.novr-requires-selection {
  opacity: 0.6;
  pointer-events: none;
}

.novr-custom-field.novr-requires-selection th.label::after,
.novr-date-row.novr-requires-selection th.label::after {
  content: ' (select quantity first)';
  font-size: 11px;
  color: var(--novr-text-medium, #666);
  font-weight: normal;
  font-style: italic;
}

/* Section Headers for Grouped Products */
.novr-scheduling-header {
  background: var(--bricks-background-light, #f9f9f9);
}

.novr-section-header {
  font-weight: bold;
  padding: 12px 8px;
  border: 1px solid var(--novr-border-color, #ddd);
  background: var(--bricks-background-accent, #f0f6fc);
  color: var(--novr-text-dark);
  font-family: inherit;
}

.novr-section-header h4 {
  margin: 0;
  font-size: 16px;
  color: inherit;
  font-family: inherit;
  font-weight: inherit;
}

/* Simple Product Table */
.novr-created-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-family: inherit;
  flex: none;
}

.novr-created-table tbody tr:first-child th,
.novr-created-table tbody tr:first-child td {
  border-top: 1px solid var(--novr-border-color, #ddd);
}

/* Date Picker Popup Styles */
.novr-date-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}

.novr-popup-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.novr-popup-content {
  position: relative;
  background: var(--bricks-background, #fff);
  border-radius: var(--novr-border-radius, 8px);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  color: var(--novr-text-dark);
  font-family: inherit;
}

.novr-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--novr-border-color, #ddd);
  background: var(--bricks-background-light, #f9f9f9);
}

.novr-popup-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--novr-text-dark);
  font-family: inherit;
}

.novr-popup-close {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--novr-text-medium, #666);
  padding: 4px;
  border-radius: var(--novr-border-radius, 4px);
  transition: var(--novr-transition, all 0.2s);
}

.novr-popup-close:hover {
  background: var(--novr-border-color, #ddd);
  color: var(--novr-text-dark);
}

.novr-popup-body {
  padding: 20px;
  max-height: 60vh;
  overflow-y: auto;
}

.novr-calendar-container {
  min-height: 300px;
}

/* Fallback Date Picker Styles */
.novr-fallback-container {
  text-align: center;
  padding: 40px 20px;
}

.novr-fallback-container p {
  margin-bottom: 20px;
  font-size: 16px;
  color: var(--novr-text-dark);
  font-family: inherit;
}

.novr-fallback-date-picker {
  padding: 12px 16px;
  border: 1px solid var(--novr-border-color, #ddd);
  border-radius: var(--novr-border-radius, 4px);
  font-size: 16px;
  font-family: inherit;
  background: var(--bricks-background, #fff);
  color: var(--novr-text-dark);
  max-width: 200px;
  width: 100%;
}

.novr-fallback-date-picker:focus {
  outline: none;
  border-color: var(--novr-primary, #007cba);
  box-shadow: 0 0 0 1px var(--novr-primary, #007cba);
}

/* Prevent body scroll when popup is open */
body.novr-popup-open {
  overflow: hidden;
}

/* Mobile Responsive for Popup */
@media (max-width: 768px) {
  .novr-popup-content {
    width: 95%;
    margin: 10px;
    max-height: 90vh;
  }

  .novr-popup-header {
    padding: 15px;
  }

  .novr-popup-header h3 {
    font-size: 16px;
  }

  .novr-popup-body {
    padding: 15px;
    max-height: 70vh;
  }

  .novr-fallback-container {
    padding: 20px 10px;
  }
}

/* Mobile Responsive for Table Integration */
@media (max-width: 768px) {
  .novr-date-row th.label,
  .novr-custom-field th.label {
    width: 100%;
    display: block;
    border-bottom: none;
  }

  .novr-date-row td.value,
  .novr-custom-field td.value {
    width: 100%;
    display: block;
    border-top: none;
  }

  .novr-radio-layout-horizontal,
  .novr-checkbox-layout-horizontal {
    flex-direction: column;
  }

  .novr-file-upload-wrapper {
    flex-direction: column;
    align-items: flex-start;
  }
}