/* edp-generator.css */

/*
  1) Ensure consistent appearance for text-based inputs inside the form.
     Tailwind already applies some styles, but you might want slight overrides or added effects.
*/
#edp-generator-container input[type="text"],
#edp-generator-container input[type="number"],
#edp-generator-container input[type="date"],
#edp-generator-container select,
#edp-generator-container textarea {
  /* Provide a consistent box shadow and transition for focus */
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.2s;
}

/*
  2) On focus, highlight the field a bit more
*/
#edp-generator-container input:focus,
#edp-generator-container select:focus,
#edp-generator-container textarea:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4); /* a Tailwind "blue-500" tinted ring */
}

/*
  3) Slight hover effect on the "design-entry" and "lineitem" blocks for interactivity
*/
#edp-generator-container .design-entry:hover,
#edp-generator-container .lineitem-entry:hover {
  background-color: #fdfdfd; /* Slightly lighter background */
}

/*
  4) Subtle style for remove buttons
  (Though we already have Tailwind classes, you can add transitions or overrides)
*/
#edp-generator-container button.remove-csq-btn,
#edp-generator-container button.remove-lineitem-btn,
#edp-generator-container button.remove-design-btn {
  transition: background-color 0.2s, opacity 0.2s;
}

#edp-generator-container button.remove-csq-btn:hover,
#edp-generator-container button.remove-lineitem-btn:hover,
#edp-generator-container button.remove-design-btn:hover {
  opacity: 0.9;
}

/*
  5) If you'd like a more "card-like" feel for newly created blocks,
     you can add small box-shadow or corner rounding
*/
#edp-generator-container .lineitem-entry,
#edp-generator-container .design-entry {
  /* If you want a subtle shadow beyond the border */
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  border-radius: 0.25rem; /* Tailwind's rounded-md */
}

/* Panel sizing and layout */
.panel-container {
    min-height: 500px;
    border: 1px solid #e5e7eb; /* Explicit border instead of @apply */
    border-radius: 0.5rem;
    padding: 1rem;
    display: flex;
    gap: 1rem;
}

.panel-left {
    width: 33.333333%;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    display: flex;
    flex-direction: column;
}

.panel-right {
    width: 66.666667%;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    display: flex;
    flex-direction: column;
}

.panel-scroll-area {
    padding: 0.75rem;
    flex: 1;
    overflow-y: auto;
}

.panel-footer {
    padding: 0.75rem;
    border-top: 1px solid #e5e7eb;
    background-color: #f9fafb;
}

/* Portal headers */
.portal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    background-color: #f9fafb;
    border-top-left-radius: 0.375rem;
    border-top-right-radius: 0.375rem;
}

/* Button Standardization */
.btn-primary {
    background-color: #4b5563; /* gray-600 */
    color: white;
    border-radius: 0.25rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    width: 100%;
}

.btn-primary:hover {
    background-color: #374151; /* gray-700 */
}

/* Symbol buttons (for add/remove) */
.btn-symbol {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 150ms ease-in-out;
}

.btn-symbol.add {
    background-color: #2563eb;
    color: white;
}

.btn-symbol.add:hover {
    background-color: #1d4ed8;
}

.btn-symbol.remove {
    background-color: #ef4444;
    color: white;
}

.btn-symbol.remove:hover {
    background-color: #dc2626;
}

/* List Items */
.list-item {
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    padding: 0.375rem 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.list-item:hover {
    background-color: #f9fafb;
}

.list-item.active {
    background-color: #f3f4f6;
}

/* Size grid layout */
.sizes-area {
    display: grid;
    gap: 0.75rem;
}

/* Default (mobile): 1 column */
@media (min-width: 640px) {
    /* sm breakpoint: 2 columns */
    .sizes-area {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    /* lg breakpoint: 3 columns */
    .sizes-area {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Size row styling - more compact */
.size-row {
    background-color: white;
    transition: all 150ms ease-in-out;
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.size-row:hover {
    border-color: #d1d5db;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Make size label more compact */
.size-row .text-sm {
    min-width: 2rem;
    font-size: 0.813rem;
}

/* Make quantity input group take remaining space */
.qty-control-group {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Quantity input controls - smaller and more modern */
.qty-control-group {
  position: relative;
  display: flex;
  align-items: center;
}

.qty-input {
  width: 60px;
  padding: 0.25rem 0.375rem;
  font-size: 0.813rem;
  appearance: textfield; /* Standard */
  -moz-appearance: textfield; /* Firefox */
  height: 28px;
}

/* Hide default number input arrows */
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Smaller arrow buttons */
.btn-qty {
    width: 18px;
    height: 14px;
    font-size: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f3f4f6;
    border: 1px solid #e5e7eb;
    color: #374151;
    cursor: pointer;
    transition: all 150ms ease-in-out;
}

.btn-qty:hover {
    background-color: #e5e7eb;
}

.btn-qty:active {
    background-color: #d1d5db;
}

/* Adjust the arrow symbols to be smaller */
.qty-up::after {
    content: "▲";
    font-size: 8px;
    display: block;
    line-height: 1;
}

.qty-down::after {
    content: "▼";
    font-size: 8px;
    display: block;
    line-height: 1;
}

/* Remove original arrow content from HTML */
.qty-up, .qty-down {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f3f4f6;
    border: 1px solid #e5e7eb;
    color: #374151;
    cursor: pointer;
    transition: all 150ms ease-in-out;
}

.qty-up:hover, .qty-down:hover {
    background-color: #e5e7eb;
}

.qty-up {
  border-top-right-radius: 0.375rem;
}

.qty-down {
  border-bottom-right-radius: 0.375rem;
  border-top: none;
}

.size-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-size-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    font-size: 16px;
    cursor: pointer;
    transition: all 150ms ease-in-out;
    color: white;
}

.btn-size-action.add {
    background-color: #10b981; /* emerald-500 */
}

.btn-size-action.add:hover {
    background-color: #059669; /* emerald-600 */
}

.btn-size-action.remove {
    background-color: #f43f5e; /* rose-500 */
}

.btn-size-action.remove:hover {
    background-color: #e11d48; /* rose-600 */
}

.size-input-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.size-input-group select,
.size-input-group input {
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
}

.size-input-group input {
    width: 80px;
}

/* Autocomplete styling */
.ui-autocomplete {
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    background: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.ui-menu-item {
    padding: 8px 12px;
    font-size: 0.875rem;
    cursor: pointer;
}

.ui-menu-item:hover {
    background-color: #f3f4f6;
}

.ui-helper-hidden-accessible {
    display: none;
}

/* Input field styling */
.detail-sku {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.detail-sku:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Modal styling */
#orders-modal,
#order-detail-modal,
#po-pdf-modal {
    z-index: 9999;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    overflow-y: auto;
    padding-top: 2rem; /* Add padding to prevent header overlap */
}

/* Modal content container */
#orders-modal > div,
#order-detail-modal > div,
#po-pdf-modal > div {
    position: relative;
    z-index: 10000;
    background: white;
    margin: 2rem auto; /* Changed from 5rem to 2rem */
    padding: 1.25rem;
    border-radius: 0.375rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 90%; /* Increased from 80% to 90% */
    max-width: 1200px;
    overflow-x: hidden; /* Prevent horizontal scrolling */
}

/* Add these styles for PDF generation */
#po-pdf-content {
    width: 8.5in;
    max-width: 100%;
    margin: 0 auto;
    padding: 0.4in 0.2in 0.5in 0.2in; /* Top Right Bottom Left - Reduced left and right padding */
    box-sizing: border-box;
    background: white;
    position: relative;
    left: 0;
    overflow: visible !important;
    transform: scale(0.95); /* Slightly scale down the content */
    transform-origin: top center; /* Scale from the top center */
}

@media print {
    #po-pdf-content {
        width: 8.5in;
        max-width: 100%;
        padding: 0.4in 0.2in 0.5in 0.2in; /* Match the same padding as non-print */
        margin: 0;
        transform: scale(0.95); /* Slightly scale down the content */
        transform-origin: top center; /* Scale from the top center */
    }
}

#po-pdf-content {
    page-break-inside: avoid;
}

.avoid-break {
    break-inside: avoid;
    page-break-inside: avoid;
}

/* New classes for more control */
.page-break-before {
    break-before: page;
    page-break-before: always;
}

.page-break-after {
    break-after: page;
    page-break-after: always;
}

.page-break-inside {
    break-inside: auto;
    page-break-inside: auto;
}

/* Prevent breaks within these elements */
.no-break-section {
    break-inside: avoid;
    page-break-inside: avoid;
}

/* Suggested break points - breaks may occur here if needed */
.soft-break {
    break-inside: auto;
    page-break-inside: auto;
    padding-bottom: 1em;
    margin-bottom: 1em;
}

table {
    page-break-inside: auto;
}

/* Make PDF table more compact */
#pdf-line-items-table {
    table-layout: fixed;
    width: 100%;
}

/* Make PDF table columns more compact */
#pdf-line-items-table th,
#pdf-line-items-table td {
    padding: 2px 3px !important;
    font-size: 0.7rem !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Set specific widths for columns to prevent overflow */
#pdf-line-items-table th:nth-child(1),
#pdf-line-items-table td:nth-child(1) {
    width: 10%; /* SKU */
}
#pdf-line-items-table th:nth-child(2),
#pdf-line-items-table td:nth-child(2) {
    width: 32%; /* Description */
}
#pdf-line-items-table th:nth-child(3),
#pdf-line-items-table td:nth-child(3) {
    width: 10%; /* Color */
}
#pdf-line-items-table th:nth-child(4),
#pdf-line-items-table td:nth-child(4) {
    width: 20%; /* Sizes */
}
#pdf-line-items-table th:nth-child(5),
#pdf-line-items-table td:nth-child(5),
#pdf-line-items-table th:nth-child(6),
#pdf-line-items-table td:nth-child(6),
#pdf-line-items-table th:nth-child(7),
#pdf-line-items-table td:nth-child(7) {
    width: 9%; /* Unit Price, Total Qty, Line Total */
}

tr {
    page-break-inside: avoid;
    page-break-after: auto;
}

.no-print {
    display: none !important;
}

@media print {
    .no-print {
        display: none !important;
    }
}

/* Add styles for the EDP code display */
#edp-code-content {
    max-height: none;
    overflow: visible;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Courier New', Courier, monospace;
    line-height: 1.4;
    background-color: #f3f4f6;
    border: 1px solid #e5e7eb;
}

/* Strict page break - multiple properties for maximum compatibility */
.force-page-break-before {
    page-break-before: always !important;
    break-before: page !important;
    display: block !important;
    height: 0 !important;
    margin: 0 !important;
    border: none !important;
    clear: both !important;
}

@media print {
    .force-page-break-before {
        page-break-before: always !important;
        break-before: page !important;
    }
}

/* Order Information Grid Layout */
.order-info-grid {
    display: grid;
    gap: 1rem;
    width: 100%;
}

/* Mobile: Stack fields vertically (1 column) */
@media (max-width: 639px) {
    .order-info-grid {
        grid-template-columns: 1fr;
    }

    .order-info-grid > div {
        width: 100%;
    }
}

/* Tablet and above: 2 columns */
@media (min-width: 640px) {
    .order-info-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop: 3 columns */
@media (min-width: 1024px) {
    .order-info-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Strengthen the no-break rules for these sections */
.no-break-section {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    display: block;
}

/* Ensure tables don't break */
.no-break-section table {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
}

/* Add spacing between major sections */
.page-break-before {
    break-before: page !important;
    page-break-before: always !important;
    margin-top: 2rem;
}

/* Style for design items in PDF */
#pdf-designs .design-item {
    margin-top: 0 !important;
    margin-bottom: 0.5rem !important;
    padding-top: 0 !important;
    padding-bottom: 0.5rem !important;
    position: relative !important;
}

/* Control image dimensions in PDF */
.design-image {
    max-height: 180px !important;
    height: 180px !important;
    width: auto !important;
    max-width: 300px !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 auto !important;
}

/* Design image container */
.design-image-container {
    height: 200px !important;
    max-height: 200px !important;
    overflow: hidden !important;
    margin-bottom: 10px !important;
    position: relative !important;
}

/* Wrapper for designs to control spacing */
#pdf-designs .designs-wrapper {
    margin: 0 !important;
    padding: 0 !important;
}

/* Page break element that will be inserted before each design */
.design-page-break {
    display: block;
    page-break-before: always !important;
    break-before: page !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    clear: both !important;
}

/* Fix for design pages to prevent increasing spacing */
#pdf-designs .design-item {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    position: relative !important;
    top: 0 !important;
    margin-top: 20px !important;
    padding-top: 0 !important;
    height: auto !important;
    overflow: visible !important;
    max-height: none !important;
}

/* Fix for design page breaks */
#pdf-designs .design-page-break + .design-item {
    margin-top: 20px !important;
    padding-top: 0 !important;
    position: relative !important;
    top: 0 !important;
}

/* Ensure Notes section is visible */
#pdf-notes {
    display: block !important;
    page-break-before: always !important;
    break-before: page !important;
    margin-top: 0 !important;
    position: relative !important;
    z-index: 10 !important;
}

/* Notes content styling */
.notes-content {
    padding-top: 0.5in !important;
    margin-top: 0 !important;
}

/* Ensure notes table is visible */
#pdf-notes table {
    display: table !important;
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    margin-top: 0.25in !important;
}

#pdf-notes table tbody {
    display: table-row-group !important;
}

#pdf-notes table tr {
    display: table-row !important;
}

#pdf-notes table td {
    display: table-cell !important;
    padding: 0.1in 0.1in !important;
    border-bottom: 1px solid #eee !important;
}

/* Add spacing above section headers in PDF */
#po-pdf-content h2 {
    margin-top: 1.5rem !important;
    padding-top: 0.5rem !important;
}

/* Allow breaks between major sections */
.soft-break {
    break-inside: auto;
    page-break-inside: auto;
    margin-bottom: 2rem;
}

