/* Frontend Styles - 3D Print Calculator */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&family=Inter:wght@300;400;500;600&display=swap');

/* CSS Variables */
:root {
    --primary-color: #0f172a;
    --text-color: #212529;
    --accent-color: #ff6b35;
    --accent-hover: #ff5517;
    --bg-light: #f5f7fa;
    --border-color: #e5e7eb;
    --white: #ffffff;
}

/* Container */
.tpc-upload-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px;
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.08);
    font-family: 'Inter', sans-serif;
}

.tpc-header h2 {
    margin: 0 0 30px 0;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--primary-color);
    font-size: 32px;
    color: var(--primary-color);
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    text-align: center;
}

/* Sections */
.tpc-section {
    margin-bottom: 35px;
}

.tpc-section h3 {
    font-size: 24px;
    margin-bottom: 20px;
    color: var(--primary-color);
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
}

/* Upload Mode Toggle */
.tpc-upload-mode-toggle {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    padding: 0px;
    border-radius: 8px;
}

.tpc-radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 12px 20px;
    background: var(--white);
    border: 1px solid ;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 15px;
    flex: 1;
    justify-content: center;
}

.tpc-radio-label:hover {
    border-color: var(--accent-color);
    background: #fff5f2;
}

.tpc-radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
    accent-color: var(--accent-color);
}

.tpc-radio-text {
    font-size: 15px;
    color: var(--text-color);
}

.tpc-radio-label input[type="radio"]:checked ~ .tpc-radio-text {
    font-weight: 600;
    color: var(--accent-color);
}

.tpc-radio-label:has(input[type="radio"]:checked) {
    border: 1px solid var(--accent-color);
    background: #fff;
}

/* Upload Area */
.tpc-upload-area {
    margin-bottom: 25px;
}

.tpc-file-input-wrapper {
    position: relative;
}

.tpc-file-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 30px;
    border: 2px dashed;
    border-color: var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-light);
}

.tpc-file-label:hover,
.tpc-file-label.tpc-drag-over {
    border-color: var(--accent-color);
    background: var(--white);
}

.tpc-gcode-file-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 30px;
    border: 2px dashed;
    border-color: var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-light);
}

.tpc-gcode-file-label:hover,
.tpc-gcode-file-label.tpc-drag-over {
    border-color: var(--accent-color);
    background: var(--white);
}

.tpc-upload-icon {
    color: var(--accent-color);
    margin-bottom: 15px;
    font-size: 48px;
}

.tpc-upload-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
    font-family: 'Inter', sans-serif;
}

.tpc-upload-limit {
    font-size: 14px;
    color: #6b7280;
    font-family: 'Inter', sans-serif;
}

#tpc-stl-file,
#tpc-gcode-file {
    display: none;
}

.tpc-file-info {
    padding: 20px;
    background: #ebf3ff;
    border-radius: 8px;
    border-left: 4px solid var(--accent-color);
    margin-top: 15px;
}

.tpc-file-name {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
    font-family: 'Inter', sans-serif;
}

.tpc-file-size {
    font-size: 14px;
    color: #6b7280;
    font-family: 'Inter', sans-serif;
}

.tpc-remove-file {
    margin-top: 12px;
    padding: 8px 16px;
    background: #dc3545;
    color: var(--white);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    transition: all 0.3s ease;
}

.tpc-remove-file:hover {
    background: #c82333;
    color: var(--white);
}

#tpc-remove-gcode {
    margin-top: 12px;
    padding: 8px 16px;
    background: #dc3545;
    color: var(--white);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    transition: all 0.3s ease;
}

#tpc-remove-gcode:hover {
    background: #c82333;
    color: var(--white);
}

#tpc-gcode-file-name {
    font-weight: 600;
    color: var(--primary-color);
    font-family: 'Inter', sans-serif;
}

#tpc-gcode-file-name small {
    display: block;
    margin-top: 5px;
    font-size: 14px;
    color: #6b7280;
    font-weight: 400;
}

.tpc-help-text {
    display: block;
    margin-top: 10px;
    font-size: 13px;
    color: #6b7280;
    font-style: italic;
}

/* 3D Preview */
.tpc-3d-preview {
    margin-top: 25px;
    padding: 25px;
    background: var(--bg-light);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.tpc-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.tpc-preview-header h4 {
    margin: 0;
    font-size: 18px;
    color: var(--primary-color);
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
}

.tpc-3d-canvas {
    width: 100%;
    height: 450px;
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.tpc-preview-controls {
    margin-top: 15px;
    text-align: center;
}

.tpc-preview-controls small {
    color: #6b7280;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
}

#tpc-reset-camera {
    padding: 8px 16px;
    background-color: #fff;
}

#tpc-btn-prev {
    border-radius: 8px !important;
    color: #ffffff !important;
    background: #ff6f33 !important;
    border: none !important;
}

#tpc-btn-prev:hover {
    background: #ff5517 !important;
    color: #ffffff !important;
    border: none !important;
}

/* GCODE Section */
.tpc-gcode-section {
    margin-top: 25px;
}

.tpc-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    color: var(--text-color);
}

.tpc-checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--accent-color);
    appearance: none;
    -webkit-appearance: none;
    border: 2px solid #212529;
    border-radius: 4px;
    position: relative;
    background: var(--white);
}

.tpc-checkbox-label input[type="checkbox"]:checked {
    background: var(--accent-color);
    border-color: var(--accent-color);
}

.tpc-checkbox-label input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 14px;
    font-weight: bold;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.tpc-gcode-upload {
    margin-top: 20px;
    padding: 20px;
    background: var(--bg-light);
    border-radius: 8px;
    border: 1px solid;
    border-color: var(--border-color);
}

.tpc-gcode-upload-area {
    margin-bottom: 10px;
}

.tpc-gcode-file-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    border: 2px dashed;
    border-color: var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--white);
    margin-top: 10px;
}

.tpc-gcode-file-label:hover {
    border-color: var(--accent-color);
}

.tpc-gcode-file-label .tpc-upload-icon {
    color: var(--accent-color);
    margin-bottom: 10px;
}

.tpc-gcode-file-label .tpc-upload-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 6px;
    font-family: 'Inter', sans-serif;
}

.tpc-gcode-file-label .tpc-upload-limit {
    font-size: 13px;
    color: #6b7280;
    font-family: 'Inter', sans-serif;
}

.tpc-gcode-upload .tpc-label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--primary-color);
    font-family: 'Inter', sans-serif;
}

.tpc-gcode-upload .tpc-help-text {
    display: block;
    margin-top: 8px;
    color: #6b7280;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
}

/* Form Groups */
.tpc-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.tpc-form-group {
    margin-bottom: 20px;
}

.tpc-label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--primary-color);
    font-family: 'Inter', sans-serif;
    font-size: 15px;
}

.tpc-select,
.tpc-textarea,
.tpc-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid;
    border-color: var(--border-color);
    border-radius: 4px;
    font-size: 15px;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
    color: var(--text-color);
    background: var(--white);
    font-weight: 400;
}

.tpc-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%230f172a' d='M1.41 0L6 4.59 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.tpc-select:focus,
.tpc-textarea:focus,
.tpc-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: none;
}

.tpc-input::placeholder {
    color: #9ca3af;
    font-style: normal;
}

.tpc-help-text {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    color: #6b7280;
    font-family: 'Inter', sans-serif;
}

/* Color Selector */
.tpc-color-selector {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.tpc-color-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border: 1.2px solid;
    border-color: var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--white);
    position: relative;
}

.tpc-color-option:hover {
    border-color: var(--accent-color);
}

.tpc-color-option input[type="radio"] {
    display: none;
}

.tpc-color-option input[type="radio"]:checked + .tpc-color-swatch {
    border: 2px solid var(--accent-color);
    /* box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.2); */
}

.tpc-color-option input[type="radio"]:checked ~ .tpc-color-name {
    color: var(--accent-color);
    font-weight: 700;
}

.tpc-color-option:has(input[type="radio"]:checked) {
    border-color: var(--accent-color);
    border-width: 2px;
    background: #fff7ed;
}

.tpc-color-option:has(input[type="radio"]:checked)::after {
    content: '✓';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent-color);
    font-size: 20px;
    font-weight: bold;
}

.tpc-color-swatch {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid;
    border-color: var(--border-color);
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.tpc-color-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--primary-color);
    font-family: 'Inter', sans-serif;
}

.tpc-color-na {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    position: relative;
}

.tpc-color-na .tpc-color-swatch {
    filter: grayscale(1);
    opacity: 0.4;
}

.tpc-color-na .tpc-color-name {
    color: #9ca3af;
    text-decoration: line-through;
}

.tpc-color-na:hover {
    border-color: var(--border-color);
    background: transparent;
    transform: none;
}

/* Multi-Color Mapper */
.tpc-multi-color-mapper {
    padding: 25px;
    background: var(--bg-light);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.tpc-multi-color-mapper h4 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 18px;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: var(--primary-color);
}

.tpc-color-map-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 12px;
}

.tpc-color-map-row label {
    min-width: 80px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    color: var(--primary-color);
}

.tpc-color-map-row select {
    flex: 1;
}

.tpc-color-preview {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
}

/* Price Summary */
.tpc-price-summary {
    padding: 30px;
    background: var(--bg-light);
    border-radius: 12px;
    border: 2px solid var(--border-color);
}

.tpc-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    font-family: 'Inter', sans-serif;
    color: var(--text-color);
}

.tpc-summary-row:last-child {
    border-bottom: none;
}

.tpc-price-breakdown {
    margin: 20px 0;
    padding: 20px;
    background: var(--white);
    border-radius: 8px;
}

.tpc-total-price {
    display: flex;
    justify-content: space-between;
    margin-top: 25px;
    padding-top: 25px;
    border-top: 2px solid var(--primary-color);
    font-size: 24px;
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
}

.tpc-price-amount {
    color: var(--accent-color);
}

/* Loading */
.tpc-loading {
    text-align: center;
    padding: 50px 20px;
}

.tpc-spinner {
    border: 4px solid var(--bg-light);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: tpc-spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes tpc-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Actions */
.tpc-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 35px;
    padding-top: 25px;
    border-top: 1px solid var(--border-color);
}

.tpc-btn {
    padding: 14px 32px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
}

.tpc-btn-primary {
    background: var(--accent-color);
    color: var(--white);
}

.tpc-btn-primary:hover {
    background: var(--accent-hover);
    color: var(--white);
}

.tpc-btn-secondary {
    background: #fff;
    color: var(--primary-color);
    border: 2px solid #ccc;
    border-radius: 4px;
}

.tpc-btn-secondary:hover {
    background: #fff;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Messages */
.tpc-error,
.tpc-success {
    padding: 18px 24px;
    margin-top: 20px;
    border-radius: 8px;
    font-size: 15px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
}

.tpc-error {
    background: #fee;
    border-left: 4px solid #dc3545;
    color: #c82333;
}

.tpc-success {
    background: #d4edda;
    border-left: 4px solid #28a745;
    color: #155724;
}

/* Multi-Color Mapper Styles */
.tpc-multi-color-mapper {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.tpc-mapper-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.tpc-mapper-header h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 4px 0;
    color: var(--primary-color);
    font-size: 17px;
    font-weight: 600;
}

.tpc-mapper-header .tpc-help-text {
    margin: 0;
    color: #6c757d;
    font-size: 13px;
}

.tpc-color-map-row {
    background: white;
    padding: 14px 16px;
    border-radius: 8px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    transition: all 0.2s ease;
}

.tpc-color-map-row:hover {
    border-color: var(--accent-color);
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.1);
}

.tpc-color-map-row:last-child {
    margin-bottom: 0;
}

.tpc-color-row-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
}

.tpc-color-number {
    width: 32px;
    height: 32px;
    background: var(--accent-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}

.tpc-color-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tpc-color-label {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 14px;
}

.tpc-detected-color {
    font-weight: 400;
    color: #6c757d;
    font-size: 12px;
}

.tpc-color-weight {
    color: #6c757d;
    font-size: 12px;
}

/* G-code detected color display */
.tpc-gcode-detected {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 4px 8px;
    background: #e7f3ff;
    border-radius: 4px;
    border: 1px solid #b3d9ff;
}

.tpc-gcode-label {
    font-size: 11px;
    color: #0066cc;
    font-weight: 500;
    text-transform: uppercase;
}

.tpc-gcode-color-sample {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid rgba(0,0,0,0.2);
    display: inline-block;
}

.tpc-gcode-color-name {
    font-size: 12px;
    color: #0066cc;
    font-weight: 600;
}

.tpc-color-row-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    justify-content: flex-end;
}

.tpc-tool-color {
    min-width: 180px;
    max-width: 220px;
    padding: 8px 12px;
    border: 1.5px solid ;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    background: white;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%230f172a' d='M1.41 0L6 4.59 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

.tpc-tool-color:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.tpc-color-preview {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 2px solid #ddd;
    flex-shrink: 0;
    transition: all 0.2s ease;
    background: #f0f0f0;
}

/* Mobile Responsive for Multi-Color Mapper */
@media screen and (max-width: 768px) {
    .tpc-multi-color-mapper {
        padding: 16px;
    }
    
    .tpc-color-map-row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 14px;
    }
    
    .tpc-color-row-left {
        width: 100%;
    }
    
    .tpc-color-row-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .tpc-tool-color {
        flex: 1;
        max-width: none;
        min-width: 0;
    }
    
    .tpc-gcode-detected {
        flex-wrap: wrap;
    }
}

@media screen and (max-width: 480px) {
    .tpc-multi-color-mapper {
        padding: 12px;
    }
    
    .tpc-mapper-header h4 {
        font-size: 15px;
    }
    
    .tpc-mapper-header .tpc-help-text {
        font-size: 12px;
    }
    
    .tpc-color-map-row {
        padding: 12px;
        margin-bottom: 8px;
    }
    
    .tpc-color-number {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    
    .tpc-color-label {
        font-size: 13px;
    }
    
    .tpc-color-weight {
        font-size: 11px;
    }
    
    .tpc-color-row-right {
        flex-wrap: wrap;
    }
    
    .tpc-tool-color {
        width: 100%;
    }
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .tpc-upload-container {
        padding: 15px;
    }
    
    .tpc-header h2 {
        font-size: 22px;
    }
    
    .tpc-section h3 {
        font-size: 18px;
    }
    
    .tpc-form-row {
        grid-template-columns: 1fr;
    }
    
    .tpc-color-selector {
        grid-template-columns: 1fr;
    }
    
    .tpc-3d-canvas {
        height: 300px;
    }
    
    .tpc-actions {
        flex-direction: column;
    }
    
    .tpc-btn {
        width: 100%;
    }
    
    .tpc-total-price {
        font-size: 18px;
    }
    
    .tpc-select,
    .tpc-textarea,
    .tpc-input {
        max-width: 320px;
    }
}

@media screen and (max-width: 480px) {
    .tpc-upload-container {
        padding: 10px;
    }
    
    .tpc-file-label {
        padding: 30px 15px;
    }
    
    .tpc-3d-canvas {
        height: 250px;
    }
    
    .tpc-color-map-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .tpc-color-map-row select {
        width: 100%;
    }
}

/* Unavailable/Disabled Items */
.tpc-select option:disabled {
    color: #9ca3af;
    background: #f3f4f6;
}

.tpc-select option {
    padding: 8px;
    color: var(--text-color);
}

select.tpc-select option[value][disabled] {
    background-color: #f3f4f6;
    color: #9ca3af;
}

