/* ==========================================================================
   DocuFlow Frontend Styles (Scoped)
   - Reverted previous global :has() and full-page WooCommerce hides
   - All rules below are scoped to the dedicated DocuFlow template container
   - Keeps theme layout intact outside of the template
   ========================================================================== */

/* Dedicated template container */
.docuflow-template {}

/* Hide WooCommerce default add to cart button when DocuFlow is present */
.docuflow-columns .quantity {
  display: none !important;
}

.docuflow-columns .single_add_to_cart_button {
  display: none !important;
}

.docuflow-columns button.single_add_to_cart_button {
  display: none !important;
}

.docuflow-columns form.cart > button[type="submit"] {
  display: none !important;
}

/* More specific targeting */
#product-62.docuflow-columns form.cart .quantity,
#product-62.docuflow-columns form.cart .single_add_to_cart_button {
  display: none !important;
}

/* Two-column layout with resizable splitter: form + preview */
.docuflow-template .docuflow-data-entry-container {
  display: flex;
  position: relative;
  align-items: stretch;
  min-height: 600px;
}

.docuflow-template .docuflow-data-entry-form {
  flex: 0 0 60%;
  min-width: 400px;
  max-width: 80%;
  padding-right: 15px;
}

.docuflow-template .docuflow-data-entry-preview {
  flex: 0 0 40%;
  min-width: 350px;
  max-width: 80%;
  padding-left: 15px;
  display: flex;
  flex-direction: column;
}

/* Resizable splitter between form and preview */
.docuflow-template .docuflow-resizer {
  width: 8px;
  background: #e0e0e0;
  cursor: col-resize;
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(60% - 4px);
  z-index: 10;
  transition: background 0.2s ease;
}

.docuflow-template .docuflow-resizer:hover,
.docuflow-template .docuflow-resizer:active {
  background: #007cba;
  box-shadow: 0 0 4px rgba(0, 124, 186, 0.3);
}

.docuflow-template .docuflow-resizer::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 20px;
  background: #999;
}

/* Resizer handle styling */
.docuflow-template .docuflow-resizer-handle {
  position: relative;
  width: 100%;
  height: 100%;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='20'%3E%3Cg fill='%23666'%3E%3Ccircle cx='2' cy='4' r='1'/%3E%3Ccircle cx='2' cy='8' r='1'/%3E%3Ccircle cx='2' cy='12' r='1'/%3E%3Ccircle cx='2' cy='16' r='1'/%3E%3C/g%3E%3C/svg%3E") no-repeat center center;
}

/* Preview header and controls */
.docuflow-template .docuflow-preview-header {
  margin-bottom: 10px;
}

.docuflow-template .docuflow-realtime-toggle {
  margin-top: 8px;
}

/* Preview content: top-aligned image (no vertical centering) */
.docuflow-template .docuflow-preview-content {
  flex: 1 1 auto;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 12px;
  overflow: auto;
  display: block;       /* top aligned content */
  min-height: 240px;
  text-align: left;
}

.docuflow-template #docuflow-preview-image {
  display: block;
}

.docuflow-template #docuflow-preview-image img.docuflow-preview-img,
.docuflow-columns #docuflow-preview-image img.docuflow-preview-img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Preview fields list */
.docuflow-template .docuflow-preview-fields {
  margin-top: 10px;
  font-size: 12px;
  color: #444;
}

.docuflow-template .docuflow-preview-field-list {
  list-style: disc;
  padding-left: 18px;
}

/* Notices */
.docuflow-template .docuflow-preview-error {
  background: #ffe6e6;
  border: 1px solid #d54e21;
  border-radius: 4px;
  padding: 12px;
  color: #a40000;
}

.docuflow-template .docuflow-watermark-notice {
  font-size: 12px;
  color: #666;
  font-style: italic;
  margin-top: 8px;
}

/* Responsive */
@media (max-width: 768px) {
  .docuflow-template .docuflow-data-entry-container {
    flex-direction: column;
    position: static; /* Remove absolute positioning for mobile */
  }
  .docuflow-template .docuflow-data-entry-preview {
    flex: none;
    min-width: 0;
    max-width: none;
  }
  .docuflow-template .docuflow-data-entry-form {
    flex: none;
    min-width: 0;
    max-width: none;
    padding-right: 0;
  }
  /* Hide resizer on mobile */
  .docuflow-template .docuflow-resizer {
    display: none;
  }
}

/* Minimum widths for very small screens */
@media (max-width: 480px) {
  .docuflow-template .docuflow-data-entry-form {
    padding-right: 0;
    padding-bottom: 20px;
  }
  .docuflow-template .docuflow-data-entry-preview {
    padding-left: 0;
  }
}

/* ==========================================================================
   Navigation Shortcode Styling
   ========================================================================== */
.docuflow-navigation-shortcode {
    width: 100%;
    max-width: 100%;
    margin: 0 auto 30px;
    padding: 20px 0;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
}

/* Ensure it appears below header navigation */
.docuflow-navigation-shortcode {
    position: relative;
    z-index: 10;
}

/* Responsive adjustment */
@media (max-width: 768px) {
    .docuflow-navigation-shortcode {
        padding: 15px 10px;
        margin-bottom: 20px;
    }
}

/* ==========================================================================
   Preview Zoom Styling
   ========================================================================== */

/* Preview link container */
.docuflow-preview-link,
.docuflow-grid-preview-link {
    display: block;
    cursor: zoom-in;
    position: relative;
}

/* Preview image hover effect */
.docuflow-preview-link img,
.docuflow-grid-preview-link img {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.docuflow-preview-link:hover img,
.docuflow-grid-preview-link:hover img {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Zoom indicator icon */
.docuflow-preview-link::after {
    content: '\f179'; /* WordPress dashicon zoom icon */
    font-family: 'dashicons';
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px;
    border-radius: 4px;
    font-size: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.docuflow-preview-link:hover::after {
    opacity: 1;
}

/* Override GLightbox default styles if needed */
.glightbox-container {
    z-index: 999999 !important;
}

.gslide-description {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px;
    border-radius: 4px;
}

/* ==========================================================================
   Preview Help Text & View Cart Button
   ========================================================================== */

/* View Cart button next to Add to Cart */
.view-cart-btn {
    margin-left: 10px !important;
    background: #0073aa !important;
    color: white !important;
    border-color: #0073aa !important;
}

.view-cart-btn:hover {
    background: #005177 !important;
    border-color: #005177 !important;
}

/* Preview zoom help text */
.preview-zoom-help {
    text-align: center;
    margin-top: 10px;
}

.preview-zoom-help .dashicons {
    color: #0073aa;
}

@media (max-width: 768px) {
    .view-cart-btn {
        margin-left: 0 !important;
        margin-top: 10px !important;
        display: block;
        width: 100%;
    }
}
