/**
 * Laser Cutting Service Pro - Frontend Styles
 * Version: 1.0.0
 * 
 * Table of Contents:
 * 1. General Layout & Container
 * 2. Material Selection
 * 3. File Upload Area
 * 4. Canvas Preview
 * 5. Processing Options
 * 6. Price Display
 * 7. Loading States
 * 8. Messages & Notifications
 * 9. Responsive Design
 * 10. Utility Classes
 */

/* ==========================================================================
   1. General Layout & Container
   ========================================================================== */

.lcsp-configurator {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: #333;
    line-height: 1.6;
}

.lcsp-configurator * {
    box-sizing: border-box;
}

.lcsp-section {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.3s ease;
}

.lcsp-section:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.lcsp-section-title {
    font-size: 1.4em;
    font-weight: 600;
    margin-bottom: 20px;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
}

.lcsp-section-title::before {
    content: '';
    width: 4px;
    height: 24px;
    background: #3498db;
    border-radius: 2px;
}

.lcsp-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.lcsp-col {
    flex: 1;
}

.lcsp-col-6 {
    flex: 0 0 50%;
}

.lcsp-col-4 {
    flex: 0 0 33.333%;
}

.lcsp-col-8 {
    flex: 0 0 66.666%;
}

/* ==========================================================================
   2. Material Selection
   ========================================================================== */

.lcsp-material-selection {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.lcsp-material-card {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
    position: relative;
    overflow: hidden;
}

.lcsp-material-card:hover {
    border-color: #3498db;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.15);
}

.lcsp-material-card.selected {
    border-color: #3498db;
    background: #e3f2fd;
}

.lcsp-material-card.selected::after {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    background: #3498db;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.lcsp-material-name {
    font-weight: 600;
    margin-bottom: 5px;
    color: #2c3e50;
}

.lcsp-material-thickness {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 10px;
}

.lcsp-material-price {
    font-size: 1.1em;
    color: #3498db;
    font-weight: 600;
}

.lcsp-material-properties {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
}

.lcsp-material-property {
    display: flex;
    justify-content: space-between;
    font-size: 0.85em;
    margin-bottom: 5px;
}

.lcsp-material-property-label {
    color: #666;
}

.lcsp-material-property-value {
    font-weight: 500;
    color: #333;
}

/* ==========================================================================
   3. File Upload Area
   ========================================================================== */

.lcsp-file-upload-area {
    border: 3px dashed #cbd5e0;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    background: #f7fafc;
    transition: all 0.3s ease;
    position: relative;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.lcsp-file-upload-area.drag-over {
    border-color: #3498db;
    background: #e3f2fd;
    transform: scale(1.02);
}

.lcsp-file-upload-area.has-file {
    border-style: solid;
    border-color: #27ae60;
    background: #e8f5e9;
}

.lcsp-upload-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%233498db"><path d="M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z"/></svg>') no-repeat center;
    background-size: contain;
}

.lcsp-upload-text {
    margin-bottom: 15px;
}

.lcsp-upload-text h3 {
    margin: 0 0 10px;
    color: #2c3e50;
    font-size: 1.2em;
}

.lcsp-upload-text p {
    margin: 0;
    color: #666;
    font-size: 0.95em;
}

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

.lcsp-upload-button {
    display: inline-block;
    padding: 12px 24px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.lcsp-upload-button:hover {
    background: #2980b9;
}

.lcsp-file-info {
    margin-top: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    text-align: left;
}

.lcsp-file-name {
    font-weight: 600;
    margin-bottom: 5px;
    color: #2c3e50;
}

.lcsp-file-details {
    font-size: 0.9em;
    color: #666;
}

.lcsp-file-remove {
    color: #e74c3c;
    cursor: pointer;
    font-size: 0.9em;
    margin-top: 10px;
    display: inline-block;
}

.lcsp-file-remove:hover {
    text-decoration: underline;
}

/* ==========================================================================
   4. Canvas Preview
   ========================================================================== */

.lcsp-canvas-container {
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    min-height: 400px;
    position: relative;
    overflow: hidden;
}

.lcsp-canvas-preview {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lcsp-canvas {
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    max-width: 100%;
    max-height: 100%;
}

.lcsp-canvas-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
}

.lcsp-canvas-control {
    width: 36px;
    height: 36px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lcsp-canvas-control:hover {
    background: #f0f0f0;
    border-color: #3498db;
}

.lcsp-canvas-info {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 0.9em;
}

.lcsp-dimensions {
    font-weight: 600;
    color: #2c3e50;
}

/* ==========================================================================
   5. Processing Options
   ========================================================================== */

.lcsp-processing-options {
    display: grid;
    gap: 20px;
}

.lcsp-option-group {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.lcsp-option-group-title {
    font-weight: 600;
    margin-bottom: 15px;
    color: #2c3e50;
}

.lcsp-form-group {
    margin-bottom: 15px;
}

.lcsp-form-group:last-child {
    margin-bottom: 0;
}

.lcsp-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.lcsp-input,
.lcsp-select,
.lcsp-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.3s ease;
    background: white;
}

.lcsp-input:focus,
.lcsp-select:focus,
.lcsp-textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.lcsp-checkbox-group,
.lcsp-radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lcsp-checkbox-label,
.lcsp-radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: normal;
}

.lcsp-checkbox-label input[type="checkbox"],
.lcsp-radio-label input[type="radio"] {
    margin-right: 8px;
}

.lcsp-quantity-input {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lcsp-quantity-input input {
    width: 80px;
    text-align: center;
}

.lcsp-quantity-button {
    width: 36px;
    height: 36px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.lcsp-quantity-button:hover {
    background: #f0f0f0;
    border-color: #3498db;
}

/* ==========================================================================
   6. Price Display
   ========================================================================== */

.lcsp-price-display {
    background: #f8f9fa;
    border: 2px solid #3498db;
    border-radius: 8px;
    padding: 25px;
    margin-top: 20px;
}

.lcsp-price-breakdown {
    margin-bottom: 20px;
}

.lcsp-price-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.lcsp-price-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.lcsp-price-label {
    color: #666;
}

.lcsp-price-value {
    font-weight: 600;
    color: #333;
}

.lcsp-price-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #3498db;
}

.lcsp-price-total-label {
    font-size: 1.2em;
    font-weight: 600;
    color: #2c3e50;
}

.lcsp-price-total-value {
    font-size: 1.8em;
    font-weight: bold;
    color: #3498db;
}

.lcsp-price-note {
    margin-top: 15px;
    font-size: 0.9em;
    color: #666;
    font-style: italic;
}

/* ==========================================================================
   7. Loading States
   ========================================================================== */

.lcsp-loading {
    display: inline-block;
    position: relative;
}

.lcsp-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: lcsp-spin 1s linear infinite;
}

@keyframes lcsp-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.lcsp-loading-overlay {
    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;
    z-index: 10;
}

.lcsp-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: lcsp-spin 1s linear infinite;
}

.lcsp-loading-text {
    margin-top: 15px;
    color: #666;
    font-weight: 500;
}

/* ==========================================================================
   8. Messages & Notifications
   ========================================================================== */

.lcsp-message {
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    animation: lcsp-fade-in 0.3s ease;
}

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

.lcsp-message-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.lcsp-message-content {
    flex: 1;
}

.lcsp-message-close {
    flex-shrink: 0;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.lcsp-message-close:hover {
    opacity: 1;
}

.lcsp-message.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.lcsp-message.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.lcsp-message.warning {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
}

.lcsp-message.info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* ==========================================================================
   9. Responsive Design
   ========================================================================== */

@media (max-width: 1024px) {
    .lcsp-configurator {
        padding: 15px;
    }
    
    .lcsp-row {
        flex-direction: column;
    }
    
    .lcsp-col-6,
    .lcsp-col-4,
    .lcsp-col-8 {
        flex: 1 1 100%;
    }
}

@media (max-width: 768px) {
    .lcsp-section {
        padding: 20px 15px;
    }
    
    .lcsp-section-title {
        font-size: 1.2em;
    }
    
    .lcsp-material-selection {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
    
    .lcsp-material-card {
        padding: 12px;
    }
    
    .lcsp-file-upload-area {
        padding: 30px 15px;
    }
    
    .lcsp-canvas-container {
        min-height: 300px;
    }
    
    .lcsp-canvas-controls {
        bottom: 10px;
        right: 10px;
    }
    
    .lcsp-price-total-value {
        font-size: 1.5em;
    }
}

@media (max-width: 480px) {
    .lcsp-configurator {
        padding: 10px;
    }
    
    .lcsp-section {
        margin-bottom: 15px;
        padding: 15px;
    }
    
    .lcsp-material-selection {
        grid-template-columns: 1fr;
    }
    
    .lcsp-price-display {
        padding: 20px 15px;
    }
    
    .lcsp-upload-button {
        width: 100%;
        padding: 14px;
    }
    
    .lcsp-canvas-info {
        font-size: 0.8em;
        padding: 8px 12px;
    }
}

/* ==========================================================================
   10. Utility Classes
   ========================================================================== */

/* Material Select Dropdown Styles */
.lcsp-material-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
    background: white;
    color: #333;
    cursor: pointer;
    transition: border-color 0.3s ease;
    /* Override any theme styles that might hide it */
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 1 !important;
}

.lcsp-material-select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.lcsp-material-select option {
    padding: 5px;
    background: white;
    color: #333;
}

.lcsp-material-select optgroup {
    font-weight: bold;
    font-style: normal;
    color: #2c3e50;
}

/* Ensure the materials section is visible */
.lcsp-materials-section {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Fix for any potential theme conflicts */
.lcsp-configurator select.lcsp-material-select {
    -webkit-appearance: menulist;
    -moz-appearance: menulist;
    appearance: menulist;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='none' stroke='rgba(40,40,40,.8)' stroke-linecap='round' stroke-width='12'%3E%3Cpath d='m2.7 2.3 46.4 54.9L95.5 2.3'/%3E%3C/svg%3E");
    background-position: calc(100% - .7em) calc(50% + .15em);
    background-repeat: no-repeat;
    background-size: .85em;
    padding-right: 2em;
}

.lcsp-hidden {
    display: none !important;
}

.lcsp-visible {
    display: block !important;
}

.lcsp-disabled {
    opacity: 0.6;
    pointer-events: none;
}

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

.lcsp-text-right {
    text-align: right;
}

.lcsp-text-left {
    text-align: left;
}

.lcsp-mt-10 {
    margin-top: 10px;
}

.lcsp-mt-20 {
    margin-top: 20px;
}

.lcsp-mb-10 {
    margin-bottom: 10px;
}

.lcsp-mb-20 {
    margin-bottom: 20px;
}

.lcsp-p-10 {
    padding: 10px;
}

.lcsp-p-20 {
    padding: 20px;
}

.lcsp-btn {
    display: inline-block;
    padding: 12px 24px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
}

.lcsp-btn:hover {
    background: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.lcsp-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.lcsp-btn-secondary {
    background: #95a5a6;
}

.lcsp-btn-secondary:hover {
    background: #7f8c8d;
}

.lcsp-btn-success {
    background: #27ae60;
}

.lcsp-btn-success:hover {
    background: #219a52;
}

.lcsp-btn-danger {
    background: #e74c3c;
}

.lcsp-btn-danger:hover {
    background: #c0392b;
}

.lcsp-btn-large {
    padding: 16px 32px;
    font-size: 1.1em;
}

.lcsp-btn-small {
    padding: 8px 16px;
    font-size: 0.9em;
}

.lcsp-btn-block {
    display: block;
    width: 100%;
}

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

/* Focus styles for better accessibility */
.lcsp-configurator *:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .lcsp-configurator {
        max-width: 100%;
    }
    
    .lcsp-section {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #333;
    }
    
    .lcsp-canvas-controls,
    .lcsp-file-remove,
    .lcsp-message-close {
        display: none;
    }
}