/* Reset and Base Styles */
.granite-constructor-wrapper {
    font-family: 'Arial', sans-serif;
    background: #f8f9fa;
    margin: 0;
    padding: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Main Container */
.constructor-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    height: 100%;
    gap: 0;
}

/* Canvas Section */
.canvas-section {
    background: #1a1a1a;
    position: relative;
    overflow: hidden;
    cursor: grab;
    touch-action: none;
}

.canvas-section:active {
    cursor: grabbing;
}

.canvas-container {
    width: 100%;
    height: 100%;
    position: relative;
}

#granite-3d-canvas {
    width: 100%;
    height: 100%;
    display: block;
    outline: none;
}

.canvas-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
    background: rgba(0,0,0,0.7);
    padding: 10px;
    border-radius: 6px;
    backdrop-filter: blur(10px);
    z-index: 10;
}

.control-btn {
    background: #1A2F3D;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 60px;
}

.control-btn:hover {
    background: #152532;
    transform: translateY(-1px);
}

.control-btn.active {
    background: #152532;
    border: 2px solid #1A2F3D;
}

/* Controls Panel */
.controls-section {
    background: #ffffff;
    overflow-y: auto;
    border-left: 1px solid #e0e0e0;
}

.controls-panel {
    padding: 25px 20px;
    color: #333333;
    min-height: 100%;
    box-sizing: border-box;
}

.panel-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 2rem;
    color: #2c3e50;
    text-align: center;
    border-bottom: 2px solid #1A2F3D;
    padding-bottom: 15px;
}

/* Control Groups */
.control-group {
    margin-bottom: 2rem;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.control-label {
    display: block;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #2c3e50;
    font-size: 1rem;
}

/* Select Styles */
.granite-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 1rem;
    background: #ffffff;
    color: #333333;
    cursor: pointer;
    transition: all 0.3s ease;
}

.granite-select:focus {
    border-color: #1A2F3D;
    outline: none;
    box-shadow: 0 0 0 3px rgba(26, 47, 61, 0.1);
}

/* Стили для выпадающего списка с иконками цвета */
.granite-select option {
    background: #ffffff;
    color: #333333;
    padding: 10px;
    font-size: 1rem;
}

.granite-select option::before {
    content: attr(data-color);
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    background: attr(data-color);
}

/* Checkbox Styles */
.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    color: #2c3e50;
    margin: 15px 0;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    margin-right: 10px;
    position: relative;
    transition: all 0.3s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: #1A2F3D;
    border-color: #1A2F3D;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Dimensions Buttons */
.dimensions-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.dimensions-row {
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.dimension-btn {
    flex: 1;
    padding: 12px 8px;
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #2c3e50;
    transition: all 0.3s ease;
    text-align: center;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dimension-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.dimension-btn.active {
    background: #1A2F3D;
    color: white;
    border-color: #152532;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 12px;
    margin: 2rem 0;
}

.action-btn {
    flex: 1;
    padding: 15px;
    border: none;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn.primary {
    background: #1A2F3D;
    color: white;
}

.action-btn.primary:hover {
    background: #152532;
    transform: translateY(-1px);
}

.action-btn.secondary {
    background: #6c757d;
    color: white;
}

.action-btn.secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

/* Success Message */
.add-to-cart-success {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 15px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 1000;
    font-weight: 500;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Scrollbar Styling */
.controls-section::-webkit-scrollbar {
    width: 6px;
}

.controls-section::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.controls-section::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.controls-section::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Loading indicator for 3D models */
.model-loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 20px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    z-index: 100;
    backdrop-filter: blur(10px);
    min-width: 200px;
    text-align: center;
}

.loading-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    font-size: 14px;
    font-weight: 500;
}

.loading-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
}

.loading-progress {
    height: 100%;
    background: #1A2F3D;
    transition: width 0.3s ease;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Model selection info */
.model-info {
    background: #e8f4fd;
    border: 1px solid #b6d7e8;
    border-radius: 6px;
    padding: 12px;
    margin-top: 10px;
    font-size: 0.9rem;
    color: #2c3e50;
}

.model-info .model-name {
    font-weight: bold;
    color: #1A2F3D;
}

/* Ensure canvas is visible */
#granite-3d-canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    background: #EEF7FF !important;
}

/* Mobile Optimizations */
@media (max-width: 1024px) {
    .constructor-container {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
    }
    
    .controls-section {
        max-height: 400px;
        border-left: none;
        border-top: 1px solid #e0e0e0;
    }
    
    .dimensions-row {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .dimension-btn {
        flex: 0 0 calc(33.333% - 10px);
        min-width: 80px;
    }

    .canvas-controls {
        bottom: 10px;
        right: 10px;
        padding: 8px;
    }

    .control-btn {
        padding: 6px 10px;
        font-size: 11px;
        min-width: 50px;
    }
}

@media (max-width: 768px) {
    .controls-panel {
        padding: 20px 15px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .dimensions-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .dimension-btn {
        flex: 1;
        width: 100%;
        min-width: auto;
    }
    
    .control-group {
        padding: 15px;
    }
    
    .panel-title {
        font-size: 1.3rem;
    }

    .canvas-section {
        height: 50vh;
        min-height: 300px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .canvas-section {
        cursor: default;
    }
    
    .control-btn {
        padding: 10px 14px;
        min-width: 65px;
    }
    
    .dimension-btn {
        padding: 14px 8px;
        font-size: 1.2rem;
    }
}

/* Error Message */
.add-to-cart-error {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #dc3545;
    color: white;
    padding: 15px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 1000;
    font-weight: 500;
    animation: slideIn 0.3s ease-out;
}

/* Loading state for buttons */
.action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Enhanced product selection */
.product-with-model {
    position: relative;
}

.product-with-model::after {
    content: '3D';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: #1A2F3D;
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: bold;
}

#granite-3d-canvas {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
}

    display: block;
    font-size: 16px;
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 8px;
}