*,
*::before,
*::after {
    box-sizing: border-box;
}

/* --- Layout --- */
.mlf-grid-cols-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

/* New Responsive Grid (1 col mobile, 2 cols desktop) */
.mlf-grid-responsive-cols {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr)); /* 1 column by default */
    gap: 1rem;
}

@media (min-width: 640px) { /* Example breakpoint (sm in Tailwind) */
    .mlf-grid-responsive-cols {
        grid-template-columns: repeat(2, minmax(0, 1fr)); /* 2 columns on screens >= 640px */
    }
}

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

.mlf-space-y-4 > * + * {
    margin-top: 1rem;
}

.mlf-mb-4 { margin-bottom: 1rem; }
.mlf-mb-6 { margin-bottom: 1.5rem; }
.mlf-mt-1 { margin-top: 0.25rem; }
.mlf-mt-3 { margin-top: 0.75rem; }
.mlf-mt-4 { margin-top: 1rem; }
.mlf-mt-6 { margin-top: 1.5rem; }
.mlf-mx-auto { margin-left: auto; margin-right: auto; }
.mlf-p-2 { padding: 0.5rem; }
.mlf-p-3 { padding: 0.75rem; }
.mlf-p-4 { padding: 1rem; }
.mlf-py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.mlf-pl-2 { padding-left: 0.5rem; }
.mlf-pt-1 { padding-top: 0.25rem; }
.mlf-pt-4 { padding-top: 1rem; }

/* --- Buttons --- */
.mlf-button,
.mlf-option-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    border: 1px solid #ccc;
    border-radius: 0.375rem;
    background-color: #f8f9fa;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    font-weight: 500;
}

.mlf-button:hover,
.mlf-option-button:hover {
    background-color: #e9ecef;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06); /* shadow-md */
}

.mlf-button:focus,
.mlf-option-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.mlf-button-primary {
    background-color: #9FC047;
    color: white;
    border-color: transparent;
}

.mlf-button-primary:hover {
    background-color: #87ac36;
}

.mlf-button-full-width {
    width: 100%;
}

.mlf-button[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.mlf-back-button {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    padding: 0;
    margin-bottom: 1rem;
    cursor: pointer;
}

.mlf-back-button:hover {
    color: #111827;
    background: none;
    box-shadow: none;
}

.mlf-back-button svg {
    height: 1rem;
    width: 1rem;
    margin-right: 0.25rem;
}

/* Specific button sizing */
.mlf-cut-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    height: auto;
    padding: 0.75rem;
    border: 2px solid #eee;
    background-color: #fff;
    box-shadow: none;
    width: 100%;
}

.mlf-cut-button:hover {
     border-color: #ccc;
     background-color: #f9f9f9;
}

/* Styles for the image inside the button */
.mlf-cut-main-image {
    display: block !important;
    width: 100% !important;
    max-width: 200px !important;
    object-fit: cover !important; 
    margin-bottom: 0.5rem !important;
    border-radius: 2px !important; 
}

/* Placeholder style if no image */
.mlf-cut-main-image-placeholder {
    display: block;
    width: 100%;
    max-width: 150px;
    height: 100px;
    background-color: #f0f0f0;
    margin-bottom: 0.5rem;
    border-radius: 2px;
}

/* Styles for the name inside the button */
.mlf-cut-button-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #333;
}

.mlf-cut-button:focus {
    border-color: #9FC047;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

/* Styles for the details below the cut button */
.mlf-cut-details {
    padding: 0 0.5rem;
    text-align: center;
}

.mlf-cut-price {
    font-weight: bold;
    font-size: 1rem;
    margin-bottom: 0.25rem;
    color: #333;
}

.mlf-cut-description {
    font-size: 0.8rem;
    color: #666;
    line-height: 1.3;
}

.mlf-size-button { 
    /* No specific height/font overrides needed here now */
    /* Ensure it doesn't inherit column properties if not desired */
    flex-direction: row; /* Override if needed */
    align-items: center; /* Override if needed */
    justify-content: center; /* Override if needed */
    height: 4rem; /* Restore original height if desired */
    font-size: 1.125rem; /* Restore original font-size if desired */
}

.mlf-color-button { height: 5rem; }

/* --- Text & Typography --- */
.mlf-text-xl { font-size: 1.25rem !important; }
.mlf-text-2xl { font-size: 1.5rem !important; }
.mlf-font-semibold { font-weight: 600; }
.mlf-text-gray-600 { color: #6b7280; }
.mlf-text-gray-500 { color: #6b7280; }
.mlf-text-gray-700 { color: #374151; }
.mlf-text-green-700 { color: #047857; }
.mlf-text-red-500 { color: #ef4444; }
.mlf-text-xs { font-size: 0.75rem; }
.mlf-whitespace-pre-wrap { white-space: pre-wrap; }

/* For calculated contrast */
.mlf-text-light { color: white; }
.mlf-text-dark { color: black; }

/* --- Forms --- */
.mlf-input,
.mlf-textarea {
    box-sizing: border-box;
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 0.375rem;
}

.mlf-input:focus,
.mlf-textarea:focus {
    outline: none;
    border-color: #9ca3af;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.mlf-textarea {
    height: 8rem;
}

/* Input error state */
.mlf-input-error {
    border-color: #ef4444;
}

.mlf-input-error:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3);
}

.mlf-error-message {
    color: #ef4444;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    min-height: 1rem;
}

/* --- Progress Bar --- */
.mlf-progress-bar-container {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.mlf-progress-bar-track {
    overflow: hidden;
    height: 0.5rem;
    margin-bottom: 1rem;
    display: flex;
    border-radius: 0.25rem;
    background-color: #ecf3d4;
}

.mlf-progress-bar-fill {
    box-shadow: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
    color: white;
    background-color: #9FC047;
    transition: width 0.5s ease-in-out;
}

/* --- Summary --- */
.mlf-summary-box {
    margin-bottom: 1.5rem;
    padding: 1rem;
    border: 1px solid #eee;
    border-radius: 0.25rem;
    background-color: #f9fafb;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}

.mlf-summary-box p {
    margin-bottom: 0.75rem;
}
.mlf-summary-box p:last-child {
    margin-bottom: 0;
}

.mlf-summary-box hr {
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
    border: 0;
    border-top: 1px solid #eee;
}

.mlf-summary-label {
    font-weight: 500;
    color: #374151;
}

/* --- Confirmation --- */
.mlf-confirmation-icon {
    height: 4rem;
    width: 4rem;
    color: #10b981;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 1rem;
}

/* --- Utilities --- */
.mlf-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.mlf-italic { font-style: italic; }

/* Placeholder for fabric image */
.mlf-fabric-image-placeholder {
    width: 100%;
    height: 6rem;
    background-color: #e5e7eb;
    margin-bottom: 0.5rem;
    border-radius: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 0.875rem;
    font-style: italic;
}

.mlf-paypal-logo {
    height: 20px;
    width: auto;
    margin-left: 0.5rem;
}

/* --- Gallery Thumbnails --- */
.mlf-cut-item-container {
    margin-bottom: 1rem;
}

.mlf-examples-gallery {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.mlf-examples-gallery a {
    display: block;
    width: 80px;
    height: 80px;
    cursor: pointer;
    overflow: hidden;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.mlf-examples-gallery a:hover {
    border-color: #aaa;
}

.mlf-example-thumbnail {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensure image covers the area */
}

/* --- PayPal Button --- */
.mlf-paypal-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background-color: #0070ba;
    color: white;
}

.mlf-paypal-button:hover {
    background-color: #005ea6;
}

/* Styles for the details below the cut button */
.mlf-cut-details {
    padding: 0 0.5rem;
    text-align: center;
}

.mlf-cut-price {
    font-weight: bold;
    font-size: 1rem;
    margin-bottom: 0.25rem;
    color: #333;
}

.mlf-cut-description {
    font-size: 0.8rem;
    color: #666;
    line-height: 1.3;
}

/* New rule for columnar option buttons */
.mlf-option-button-column {
    flex-direction: column; /* Stack items vertically */
    justify-content: flex-start; /* Align items to the top */
    align-items: center; /* Center items horizontally */
    height: auto; /* Let height be determined by content */
    padding: 0.75rem;
}

/* Generic styling for images/placeholders inside option buttons */
.mlf-option-image {
    display: block !important;
    width: 100% !important;
    max-width: 150px !important;
    height: 100px !important;
    object-fit: cover !important;
    margin-bottom: 0.5rem !important;
    border-radius: 2px !important;
}

/* Specific placeholder styles */
.mlf-cut-main-image-placeholder,
.mlf-fabric-image-placeholder,
.mlf-color-image-placeholder,
.mlf-size-placeholder {
    background-color: #f0f0f0;
    border: 1px dashed #ccc;
}

/* Ensure the name is below the image */
.mlf-option-button-name {
    margin-top: 0.25rem; /* Add a little space if needed */
    font-weight: 600;
    font-size: 0.9rem;
    color: #333;
}

/* Adjust grid for sizes if needed */
.mlf-grid-cols-sizes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); /* Keep responsive columns for sizes */
    gap: 0.75rem;
    justify-content: center;
}