body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f2f5;
    display: flex;
    justify-content: center;
    padding-top: 50px; /* Added padding for scrolling */
    margin: 0;
}

.app-container {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    width: 90%;
    max-width: 800px;
}

/* Accordion Styles */
.accordion {
    background-color: #eee;
    color: #444;
    cursor: pointer;
    padding: 18px;
    width: 100%;
    border: none;
    text-align: left;
    outline: none;
    font-size: 16px;
    font-weight: bold;
    transition: 0.4s;
    border-bottom: 1px solid #ddd;
    margin-top: 10px;
}

.active, .accordion:hover {
    background-color: #ccc;
}

.panel {
    padding: 0 18px;
    background-color: white;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease-out;
}

.panel-content {
    padding: 20px 0;
}

/* Standard UI Elements */
input[type="file"] { display: none; }

.btn {
    background-color: #007bff;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    display: inline-block;
}

.btn-small {
    background-color: #6c757d;
    color: white;
    padding: 5px 10px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8rem;
    margin-bottom: 10px;
}

.canvas-wrapper {
    width: 100%;
    height: 500px; /* Fixed viewing window */
    background-color: #333; /* Dark background to see image edges */
    overflow: hidden; /* Hide parts of image outside the box */
    border: 1px solid #ccc;
    margin-top: 10px;
    position: relative;
    cursor: grab; /* Default cursor is a hand */
}

.canvas-wrapper:active {
    cursor: grabbing; /* Cursor clutches when dragging */
}

canvas {
    display: block;
    /* We no longer use max-width: 100% because JS controls the size */
}

/* Container for the list of selected colors */
#paletteContainer {
    display: flex;
    flex-direction: column; /* Stack them vertically */
    gap: 10px;
    margin-bottom: 20px;
}

/* A single row representing one chosen color */
.color-row {
    display: flex;
    align-items: center;
    background: #f9f9f9;
    padding: 8px;
    border-radius: 5px;
    border: 1px solid #ddd;
    justify-content: space-between;
}

/* The visual color box */
.swatch-box {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    border: 1px solid #ccc;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* The container for the input and label */
.height-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.height-control input {
    width: 60px;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 3px;
}

/* The delete button (X) */
.delete-btn {
    background: #ff4d4d;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.2s;
}

.delete-btn:hover {
    background: #cc0000;
}
/* ADD THESE STYLES */

.action-btn {
    background-color: #28a745; /* Green color for "Go" actions */
    font-size: 1rem;
    padding: 12px 24px;
}

.action-btn:hover {
    background-color: #218838;
}

.preview-wrapper {
    width: 100%;
    height: 500px;
    border: 1px solid #ccc;
    position: relative;
    cursor: grab;
    overflow: hidden;

    /* Checkerboard Pattern */
    background-color: #ffffff;
    background-image:
        linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
        linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
        linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.preview-wrapper:active {
    cursor: grabbing;
}

#previewCanvas {
    max-width: 100%;
    display: block;
    margin: 0 auto;
}

.action-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.btn-warning {
    background-color: #ffc107;
    color: #333;
    border: none;
    font-weight: bold;
}

.btn-warning:hover {
    background-color: #e0a800;
}

/* Ensure the action button stands out */
.action-btn {
    background-color: #28a745;
    color: white;
}

/* The Floating Context Menu */
.context-menu {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1000;
    background: white;
    border: 1px solid #ccc;
    box-shadow: 2px 2px 10px rgba(0,0,0,0.2);
    border-radius: 5px;
    padding: 10px;
    width: 200px;
    flex-direction: column;
    gap: 5px;
}

.context-menu p {
    margin: 0 0 5px 0;
    font-size: 0.9rem;
    color: #555;
    text-align: center;
}

.context-menu button {
    padding: 8px;
    cursor: pointer;
    border: 1px solid #ddd;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.context-menu button:hover {
    background-color: #e2e6ea;
}

#btnTransCancel {
    margin-top: 5px;
    color: #dc3545;
    border-color: #dc3545;
}
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.setting-group {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.setting-group h3 {
    margin-top: 0;
    font-size: 1rem;
    color: #333;
    border-bottom: 2px solid #007bff;
    padding-bottom: 5px;
    margin-bottom: 10px;
}

.setting-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    font-weight: bold;
}

.setting-group input {
    width: 90%;
    padding: 8px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.info-box {
    background-color: #e2f0fb;
    border-left: 5px solid #007bff;
    padding: 10px;
    font-size: 0.9rem;
    color: #004085;
}

/* Responsive adjustment for mobile */
@media (max-width: 600px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

#threeContainer {
    width: 100%;
    height: 400px;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
}

.print-instructions {
    margin-top: 15px;
    background: #f8f9fa;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.instr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.instr-table th {
    text-align: left;
    border-bottom: 2px solid #ccc;
    padding: 5px;
    color: #555;
}

.instr-table td {
    padding: 8px 5px;
    border-bottom: 1px solid #eee;
}

.instr-table strong {
    color: #d63384; /* Highlight the layer number */
    font-size: 1.1rem;
}

.color-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    border: 1px solid #999;
    margin-right: 5px;
    vertical-align: middle;
}