/**
 * Lumber Calculator Styles v2.0
 */

/* Main wrapper */
.lumber-calculator-wrapper {
    width: 100%;
  	margin: 20px 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lumber-calculator-wrapper.fade-in {
    opacity: 1;
}

/* Calculator inputs container */
.calculator-inputs {
    display: flex;
    flex-direction: row;
  	flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

/* Input groups */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Input controls container */
.input-controls {
    position: relative;
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid #ddd;
    border-radius: 6px;
    transition: border-color 0.3s ease;
    overflow: visible; /* Important for browser spinners */
}

.input-controls:hover {
    border-color: #bbb;
}

.input-controls:focus-within {
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

/* Custom quantity inputs */
.custom-qty-input {
    flex: 1;
    border: none !important;
    outline: none !important;
    padding: 12px 15px;
    font-size: 18px;
    font-weight: 500;
    background: transparent;
    color: #333;
    transition: background-color 0.3s ease;
}

/* M³ input - text field, no spinners */
.m3-input {
    /* Remove any potential spinners */
    -moz-appearance: textfield;
}

.m3-input::-webkit-inner-spin-button,
.m3-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
    display: none;
}

/* Pieces input - keep browser spinners */
.pieces-input {
    /* Allow browser default spinners */
    -moz-appearance: auto;
    -webkit-appearance: auto;
    appearance: auto;
}

/* Style browser spinners (where supported) */
.pieces-input::-webkit-inner-spin-button,
.pieces-input::-webkit-outer-spin-button {
    opacity: 1;
    height: 100%;
    width: 20px;
    margin-left: 10px;
    cursor: pointer;
}

/* Input suffix */
.input-suffix {
    padding: 0 15px;
    color: #666;
    font-weight: 500;
    font-size: 16px;
    background: #f5f5f5;
    border-left: 1px solid #ddd;
    display: flex;
    align-items: center;
    height: 100%;
}

/* Animation for value updates */
.custom-qty-input.updating {
    background-color: #e8f4fd !important;
    animation: pulse 0.3s ease;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.01); }
    100% { transform: scale(1); }
}

/* Placeholder styling */
.custom-qty-input::placeholder {
    color: #999;
    opacity: 0.6;
}

/* Focus styles */
.custom-qty-input:focus {
    background-color: #fafafa;
}

/* Summary section */
.quantity-summary {
    background: white;
    border: 2px solid #0073aa;
    border-radius: 6px;
    padding: 15px;
    transition: all 0.3s ease;
}

.quantity-summary.updated {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.15);
}

.summary-row {
    display: flex;
  	flex-wrap: wrap;
  	gap: 10px;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
}

.summary-row:last-child {
    display: none;
}

.summary-label {
    color: #666;
    font-size: 14px;
}

.summary-value {
    font-size: 16px;
    color: #333;
}

.summary-separator {
    margin: 0 10px;
    color: #ddd;
}

.summary-m3 {
    color: #0073aa;
    font-size: 18px;
}

.summary-pieces {
    color: #666;
    font-style: italic;
}

.summary-price {
    color: #0073aa;
    font-size: 20px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .lumber-calculator-wrapper {
        padding: 15px;
    }
    
    .custom-qty-input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 15px;
    }
    
    /* Larger touch targets on mobile */
    .input-controls {
        min-height: 50px;
    }
    
    /* Hide browser spinners on mobile for better UX */
    @media (pointer: coarse) {
        .pieces-input::-webkit-inner-spin-button,
        .pieces-input::-webkit-outer-spin-button {
            width: 30px; /* Larger touch target */
        }
    }
}

/* Tablet and up - side by side layout */
@media (min-width: 769px) {
    .input-group {
        flex: 1;
    }
}

/* Disabled state */
.lumber-calculator-wrapper.disabled {
    opacity: 1;
    pointer-events: none;
}

/* Loading state */
.lumber-calculator-wrapper.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .input-controls {
        border-width: 3px;
    }
    
    .custom-qty-input {
        font-weight: 600;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .lumber-calculator-wrapper,
    .custom-qty-input,
    .quantity-summary,
    .input-controls {
        transition: none !important;
        animation: none !important;
    }
}

/* Print styles */
@media print {
    .lumber-calculator-wrapper {
        border: 1px solid #000;
        background: white;
    }
    
    .input-controls {
        border: 1px solid #000;
    }
}

/* Disabled state with overlay effect */
.lumber-calculator-wrapper {
    position: relative;
}

.lumber-calculator-wrapper.disabled {
    pointer-events: none;
}

.lumber-calculator-wrapper.disabled .calculator-inputs,
.lumber-calculator-wrapper.disabled .quantity-summary {
    opacity: 0.4;
    filter: grayscale(100%);
}

/* Instruction message */
.calculator-instruction {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: 12px 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #856404;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.instruction-icon {
    font-size: 18px;
}

/* Disabled inputs styling */
.custom-qty-input:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
    color: #999;
}

.input-controls:has(.custom-qty-input:disabled) {
    background-color: #f9f9f9;
    border-color: #e0e0e0;
}

/* Ensure spinners are visible and styled */
.pieces-input::-webkit-inner-spin-button,
.pieces-input::-webkit-outer-spin-button {
    -webkit-appearance: inner-spin-button !important;
    opacity: 1 !important;
    height: auto !important;
    cursor: pointer;
}

.pieces-input {
    -moz-appearance: textfield; /* Reset Firefox */
    -moz-appearance: number-input !important; /* Force number input */
}

/* For Firefox specifically */
@-moz-document url-prefix() {
    .pieces-input {
        -moz-appearance: number-input !important;
    }
}

/* Ensure m³ input has NO spinners */
.m3-input::-webkit-inner-spin-button,
.m3-input::-webkit-outer-spin-button {
    -webkit-appearance: none !important;
    display: none !important;
}

.m3-input {
    -moz-appearance: textfield !important;
}