/**
 * All of the CSS for your public-facing functionality should be
 * included in this file.
 */

.webphotonc-container {
    margin: 20px 0;
    max-width: 800px;
}

.webphotonc-container h2 {
    margin-bottom: 20px;
}

.webphotonc-public-form {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
}

.webphotonc-image-upload {
    margin-bottom: 20px;
}

#webphotonc-image-preview {
    width: 100%;
    height: 250px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    overflow: hidden;
}

#webphotonc-preview-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.webphotonc-upload-actions {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.webphotonc-options {
    margin-bottom: 20px;
}

.webphotonc-options h3 {
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.webphotonc-option-group {
    margin-bottom: 15px;
}

.webphotonc-option-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.webphotonc-option-group input[type="number"],
.webphotonc-option-group select {
    width: 100%;
    max-width: 300px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.webphotonc-actions {
    margin-top: 20px;
    display: flex;
    align-items: center;
}

.webphotonc-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 10px;
    background-image: url('../images/spinner.svg');
    background-size: 20px 20px;
    background-repeat: no-repeat;
    visibility: hidden;
}

.webphotonc-spinner.is-active {
    visibility: visible;
}

.webphotonc-preview-card,
.webphotonc-result {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 20px;
    margin-top: 20px;
}

.webphotonc-preview-card h3,
.webphotonc-result h3 {
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.webphotonc-preview-container {
    margin-bottom: 20px;
}

#webphotonc-carving-preview {
    width: 100%;
    height: 400px;
    border: 1px solid #ddd;
    background-color: #f9f9f9;
    margin-bottom: 20px;
}

.webphotonc-preview-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 15px;
}

.webphotonc-preview-control-group {
    flex: 1;
    min-width: 200px;
    margin-bottom: 15px;
}

.webphotonc-preview-control-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.webphotonc-preview-control-group select {
    width: 100%;
    max-width: 300px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.webphotonc-preview-control-group input[type="range"] {
    width: 100%;
    max-width: 280px;
    vertical-align: middle;
}

.webphotonc-range-value {
    display: inline-block;
    width: 40px;
    text-align: center;
    margin-left: 10px;
}

.webphotonc-result-info {
    margin-bottom: 15px;
}

.webphotonc-preview-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 0;
    border-bottom: 1px solid #ddd;
}

.webphotonc-preview-tab-btn {
    padding: 10px 20px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-bottom: none;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.webphotonc-preview-tab-btn:hover {
    background: #e8e8e8;
}

.webphotonc-preview-tab-btn.active {
    background: #fff;
    border-bottom: 2px solid #fff;
    margin-bottom: -1px;
    font-weight: 600;
}

.webphotonc-preview-tab-content {
    border: 1px solid #ddd;
    border-top: none;
}

.webphotonc-preview-tab-content.active {
    display: block;
}

#webphotonc-gcode-text {
    width: 100%;
    height: 400px;
    border: none;
    background-color: #f9f9f9;
    overflow: auto;
    padding: 10px;
    margin: 0;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
    color: #333;
}

.webphotonc-gcode-text-controls {
    padding: 10px;
    background: #f9f9f9;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.webphotonc-gcode-lines {
    font-size: 13px;
    color: #666;
}

#webphotonc-gcode-line-count {
    font-weight: 600;
    color: #333;
}

.webphotonc-result-actions {
    margin-top: 15px;
}

/* Responsive adjustments */
@media screen and (max-width: 600px) {
    .webphotonc-container {
        padding: 0 10px;
    }
    
    .webphotonc-public-form,
    .webphotonc-preview-card,
    .webphotonc-result {
        padding: 15px;
    }
    
    #webphotonc-image-preview {
        height: 200px;
    }
    
    #webphotonc-carving-preview,
    #webphotonc-gcode-viewer {
        height: 300px;
    }
    
    .webphotonc-preview-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .webphotonc-preview-control-group {
        width: 100%;
    }
}

/* Image Editor Modal Styles */
.webphotonc-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100000;
}

.webphotonc-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
}

.webphotonc-modal-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    height: 90%;
    max-height: 800px;
    margin: 5% auto;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.webphotonc-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #ddd;
}

.webphotonc-modal-header h3 {
    margin: 0;
    font-size: 20px;
}

.webphotonc-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
}

.webphotonc-modal-close:hover {
    color: #000;
}

.webphotonc-editor-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    background-color: #f5f5f5;
}

.webphotonc-editor-tab {
    flex: 1;
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.webphotonc-editor-tab:hover {
    background-color: #e8e8e8;
}

.webphotonc-editor-tab.active {
    background-color: #fff;
    border-bottom-color: #2271b1;
    color: #2271b1;
}

.webphotonc-editor-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.webphotonc-editor-canvas-container {
    flex: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #f9f9f9;
    padding: 20px;
    overflow: auto;
}

#webphotonc-editor-canvas {
    max-width: 100%;
    max-height: 100%;
    border: 1px solid #ddd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.webphotonc-editor-controls {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    border-left: 1px solid #ddd;
    background-color: #fff;
}

.webphotonc-editor-tab-content {
    display: none;
}

.webphotonc-editor-tab-content.active {
    display: block;
}

.webphotonc-editor-control-group {
    margin-bottom: 25px;
}

.webphotonc-editor-control-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
}

.webphotonc-editor-control-group label .value {
    font-weight: normal;
    color: #2271b1;
}

.webphotonc-editor-control-group input[type="range"] {
    width: 100%;
    margin: 0;
}

.webphotonc-editor-control-group .description {
    margin: 5px 0 0 0;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

.webphotonc-editor-control-group input[type="checkbox"] {
    margin-right: 8px;
}

.webphotonc-editor-presets {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}

.webphotonc-editor-presets .button {
    width: 100%;
    text-align: center;
}

.webphotonc-editor-rotate-buttons,
.webphotonc-editor-flip-buttons {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.webphotonc-editor-rotate-buttons .button,
.webphotonc-editor-flip-buttons .button {
    flex: 1;
    text-align: center;
}

.webphotonc-modal-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #ddd;
    background-color: #f5f5f5;
}

.webphotonc-modal-footer .button {
    margin: 0;
}

.webphotonc-modal-footer .button-primary {
    background-color: #2271b1;
    border-color: #2271b1;
    color: #fff;
}

.webphotonc-modal-footer .button-primary:hover {
    background-color: #135e96;
    border-color: #135e96;
}

/* Edit Image Button */
#webphotonc-edit-image-btn {
    margin-left: 10px;
}

/* Responsive Design for Modal */
@media (max-width: 768px) {
    .webphotonc-modal-content {
        width: 95%;
        height: 95%;
        margin: 2.5% auto;
    }
    
    .webphotonc-editor-body {
        flex-direction: column;
    }
    
    .webphotonc-editor-canvas-container {
        flex: 1;
        min-height: 300px;
    }
    
    .webphotonc-editor-controls {
        flex: 1;
        border-left: none;
        border-top: 1px solid #ddd;
        max-height: 300px;
    }
    
    .webphotonc-editor-presets {
        grid-template-columns: 1fr;
    }
    
    .webphotonc-editor-rotate-buttons,
    .webphotonc-editor-flip-buttons {
        flex-direction: column;
    }
    
    .webphotonc-modal-footer {
        flex-wrap: wrap;
    }
}