/* Cube Renderer Container */
.cube-renderer {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 450px;
    padding: 1.5rem 1rem;
}

/* 3D Cube Styles */
.cube-3d {
    width: 200px;
    height: 200px;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(-15deg) rotateY(25deg);
    transition: transform 0.5s ease;
    margin: 0 auto;
    touch-action: none; /* Prevent default touch behaviors like scrolling */
    user-select: none; /* Prevent text selection during drag */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.cube-3d:hover {
    transform: rotateX(-15deg) rotateY(25deg) scale(1.05);
}

.cube-face {
    position: absolute;
    width: 200px;
    height: 200px;
    border: 2px solid #333;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 2px;
    padding: 4px;
    background: #333;
}

.cube-face--front {
    transform: translateZ(100px);
}

.cube-face--back {
    transform: rotateY(180deg) translateZ(100px);
}

.cube-face--right {
    transform: rotateY(90deg) translateZ(100px);
}

.cube-face--left {
    transform: rotateY(-90deg) translateZ(100px);
}

.cube-face--top {
    transform: rotateX(90deg) translateZ(100px);
}

.cube-face--bottom {
    transform: rotateX(-90deg) translateZ(100px);
}

.cube-sticker {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 400ms cubic-bezier(0.4, 0.0, 0.2, 1),
                transform 500ms cubic-bezier(0.4, 0.0, 0.2, 1),
                box-shadow 200ms cubic-bezier(0.4, 0.0, 0.2, 1);
    will-change: background-color, transform;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    touch-action: manipulation; /* Allow touch but prevent double-tap zoom */
}

.cube-sticker:hover {
    transform: scale(1.1);
}

.cube-sticker.selected {
    box-shadow: 0 0 0 3px #007bff;
    transform: scale(1.1);
    z-index: 100;
    position: relative;
}

/* Cube colors */
.cube-sticker--white { background-color: #ffffff; color: #333; }
.cube-sticker--yellow { background-color: #ffff00; color: #333; }
.cube-sticker--red { background-color: #FF3333; color: #fff; }
.cube-sticker--orange { background-color: #ffa500; color: #333; }
.cube-sticker--blue { background-color: #4DA6FF; color: #fff; }
.cube-sticker--green { background-color: #00ff00; color: #333; }

/* Net View Styles */
.cube-net {
    display: grid;
    grid-template-columns: repeat(4, 100px);
    grid-template-rows: repeat(3, 100px);
    gap: 5px;
    justify-content: center;
    margin: 0 auto;
}

.net-face {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 2px;
    padding: 2px;
    background: #333;
    border: 2px solid #333;
    border-radius: 4px;
}

.net-face--top {
    grid-column: 2;
    grid-row: 1;
}

.net-face--left {
    grid-column: 1;
    grid-row: 2;
}

.net-face--front {
    grid-column: 2;
    grid-row: 2;
}

.net-face--right {
    grid-column: 3;
    grid-row: 2;
}

.net-face--back {
    grid-column: 4;
    grid-row: 2;
}

.net-face--bottom {
    grid-column: 2;
    grid-row: 3;
}

.net-sticker {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 2px;
    cursor: pointer;
    transition: background-color 400ms cubic-bezier(0.4, 0.0, 0.2, 1),
                transform 500ms cubic-bezier(0.4, 0.0, 0.2, 1),
                box-shadow 200ms cubic-bezier(0.4, 0.0, 0.2, 1);
    will-change: background-color, transform;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: bold;
}

.net-sticker:hover {
    transform: scale(1.2);
    z-index: 10;
    position: relative;
}

.net-sticker.selected {
    box-shadow: 0 0 0 2px #007bff;
    transform: scale(1.2);
    z-index: 10;
    position: relative;
}

/* Net sticker colors */
.net-sticker--white { background-color: #ffffff; color: #333; }
.net-sticker--yellow { background-color: #ffff00; color: #333; }
.net-sticker--red { background-color: #FF3333; color: #fff; }
.net-sticker--orange { background-color: #ffa500; color: #333; }
.net-sticker--blue { background-color: #4DA6FF; color: #fff; }
.net-sticker--green { background-color: #00ff00; color: #333; }

/* Color Editor Styles moved to main.css for better organization */

/* Interactive mode styles */
.cube-renderer.interactive .cube-sticker,
.cube-renderer.interactive .net-sticker {
    cursor: pointer;
}

.cube-renderer.interactive .cube-sticker:hover,
.cube-renderer.interactive .net-sticker:hover {
    box-shadow: 0 0 0 3px #28a745;
    transform: scale(1.1);
}

.cube-renderer.interactive .net-sticker:hover {
    transform: scale(1.2);
    z-index: 10;
    position: relative;
}

/* Face highlighting styles */
.cube-face.highlighted {
    box-shadow: 0 0 0 4px #28a745;
    animation: pulse-highlight 1.5s ease-in-out infinite;
}

.net-face.highlighted {
    box-shadow: 0 0 0 4px #28a745;
    animation: pulse-highlight 1.5s ease-in-out infinite;
}

@keyframes pulse-highlight {
    0%, 100% {
        box-shadow: 0 0 0 4px #28a745;
    }
    50% {
        box-shadow: 0 0 0 6px rgba(40, 167, 69, 0.6);
    }
}

/* Edit mode styles */
.edit-mode .cube-sticker,
.edit-mode .net-sticker {
    cursor: crosshair;
}

.edit-mode .cube-sticker:hover,
.edit-mode .net-sticker:hover {
    box-shadow: 0 0 0 3px #28a745;
}

/* Animation classes */
.cube-transition {
    transition: all 0.5s ease;
}

.view-switching {
    opacity: 0.5;
    pointer-events: none;
}

/* Loading state */
.cube-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    font-size: 1.2rem;
    color: #666;
}

.cube-loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
/* Rota
tion Reset Button Styles */
.rotation-reset-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border: 2px solid #667eea;
    background: rgba(255, 255, 255, 0.9);
    color: #667eea;
    border-radius: 50%;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 0;
    line-height: 1;
}

.rotation-reset-btn:hover {
    background: #667eea;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.rotation-reset-btn:active {
    transform: scale(0.95);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.rotation-reset-btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Show button when it has the flex display */
.rotation-reset-btn[style*="display: flex"] {
    display: flex !important;
}
