body {
    font-family: 'Space Grotesk', sans-serif;
    background-color: #02050c;
    color: #fafafa;
}

input[type="color"] {
    -webkit-appearance: none;
    appearance: none;
    width: 48px;
    height: 48px;
    border: none;
    cursor: pointer;
    background-color: transparent;
    border-radius: 50%;
    border: 2px solid #fafafa;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
}

.file-upload-button {
    background-color: #ff3333;
    color: #fafafa;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    text-align: center;
    border: none;
}

.file-upload-button:hover {
    background-color: #e62e2e;
}

#canvas-container {
    position: relative;
    cursor: default;
}

#threejs-canvas.grabbable {
    cursor: grab;
}

#threejs-canvas.grabbing {
    cursor: grabbing;
}

#color-svg-layer,
#threejs-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#threejs-canvas {
    z-index: 10;
}

#color-svg-layer {
    z-index: 20;
    pointer-events: none;
    mix-blend-mode: multiply;
}

#transform-box {
    position: absolute;
    border: 1px solid #4a90e2;
    pointer-events: none;
    display: none;
    z-index: 30;
}

.handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: #fff;
    border: 1px solid #4a90e2;
    border-radius: 2px;
    pointer-events: all;
}

.handle.scale {
    cursor: nwse-resize;
}

.handle.rotate {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #4a90e2;
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><path fill="white" d="M20.49,2A12,12,0,0,0,11,5.51V2H9v7h7V7H12.55A10,10,0,0,1,20.49,4a10,10,0,0,1,0,20,1,1,0,0,0,0,2,12,12,0,0,0,0-24Z"/><path fill="white" d="M11.51,22A10,10,0,0,1,11.51,2a1,1,0,0,0,0-2,12,12,0,0,0,0,24,12,12,0,0,0,9.49-19.51V30h2V23H16v2h3.45A10,10,0,0,1,11.51,22Z"/></svg>') 16 16, auto;
}

.download-icon-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 40;
    background-color: rgba(2, 5, 12, 0.7);
    border: 1px solid #fafafa;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.download-icon-button:hover {
    background-color: #ff3333;
}

.download-icon-button svg {
    width: 24px;
    height: 24px;
    fill: #fafafa;
}

#interaction-buttons {
    z-index: 40;
}

.btn-interaction {
    background-color: #02050C;
    border: 1px solid #FF3333;
    color: #FAFAFA;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    transition: background-color 0.2s, border-color 0.2s;
}

.btn-interaction:hover {
    background-color: #0d121c;
    border-color: #ff5555;
}

/* Previne o CLS (Cumulative Layout Shift) causado pelo carregamento de fontes */
@font-face {
    font-family: "Space Grotesk Fallback";
    src: local("Arial");
    ascent-override: 92.5%;
    descent-override: 24.48%;
    line-gap-override: 0%;
    size-adjust: 105.4%;
}

body {
    font-family: 'Space Grotesk', 'Space Grotesk Fallback', sans-serif;
}

/* Security measure to make content selection and screenshots harder. Not foolproof. */
.no-select {
    -webkit-user-select: none;
    /* Safari */
    -moz-user-select: none;
    /* Firefox */
    -ms-user-select: none;
    /* IE 10+ */
    user-select: none;
    /* Standard syntax */
}

#open-product-gallery-btn {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 40;
    background-color: #ff3333;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid #ff3333;
    transition: background-color 0.2s;
    cursor: pointer;
}

#open-product-gallery-btn:hover {
    background-color: #e62e2e;
    border-color: #e62e2e;
}

#product-gallery-modal .bg-rotha-dark {
    max-height: 90vh;
    overflow-y: auto;
}

#accessories-modal-overlay .bg-rotha-dark {
    max-height: 90vh;
    overflow-y: auto;
}

#product-grid,
#accessories-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

@media (min-width: 768px) {

    #product-grid,
    #accessories-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.product-item {
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
    padding: 0.5rem;
    border-radius: 0.5rem;
}

.product-item:hover,
.product-item.selected {
    border-color: #ff3333;
}

.product-item img {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 0.25rem;
}

#sticky-modal-footer {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 896px;
    /* Corresponds to Tailwind's max-w-4xl */
    z-index: 60;
    /* Higher than the modal's z-index (z-50) */

    /* Glassmorphism Effect */
    background-color: rgba(2, 5, 12, 0.75);
    /* bg-rotha-dark with transparency */
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);

    padding: 1.5rem;
    border-radius: 1.5rem;
    /* Corresponds to Tailwind's rounded-3xl */
    border: 1px solid rgba(255, 51, 51, 0.1);
    /* border-rotha-primary/10 */
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

/* Custom Color Picker Styles */
#custom-color-picker {
    position: absolute;
    /* Crucial for positioning and preventing CLS */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    /* Appearance & Spacing */
    padding: 1rem;
    /* Corresponds to p-4 */
    padding-bottom: 1.5rem;
    /* Add extra space at the bottom to prevent clipping */
    background-color: rgba(2, 5, 12);
    border: 1px solid #ff3333;
}

/* Estilos para os inputs dentro do color picker */
.form-input-sm {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.375rem;
    /* 6px */
    padding: 0.5rem 0.75rem;
    /* 8px 12px */
    font-size: 0.875rem;
    /* 14px */
    color: #ffffff;
    transition: border-color 0.2s;
}

.form-input-sm:focus {
    outline: none;
    border-color: #ff3333;
    box-shadow: 0 0 0 2px rgba(255, 51, 51, 0.5);
}

/* Remove as setas dos inputs de número no Chrome/Safari/Edge */
.form-input-sm::-webkit-outer-spin-button,
.form-input-sm::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Remove as setas dos inputs de número no Firefox */
.form-input-sm[type=number] {
    -moz-appearance: textfield;
}

#color-palette,
#hue-slider-container {
    cursor: crosshair;
}

#hue-slider-container {
    height: 0.75rem;
    /* 12px, mais fino que o anterior h-6 (24px) */
}

#hue-cursor {
    top: 50%;
    /* Garante que o cursor fique sempre no meio da barra */
}