/* Step 4: Artwork Location Selection Styles */

/* Ensure full width container */
#step4 {
    max-width: 100%;
    width: 100%;
}

#step4 .section {
    max-width: 100%;
    width: 100%;
}

/* Force main content area to be wider */
.main-content {
    max-width: none !important;
    width: 100% !important;
}

.step-container {
    max-width: none !important;
    width: 100% !important;
}

.artwork-description {
    margin-bottom: 1.5rem;
    color: #666;
    line-height: 1.5;
}

.artwork-location-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.artwork-location-card {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.artwork-location-card:hover {
    border-color: #3498db;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.artwork-location-card.active {
    border-color: #3498db;
    background: #f8fafe;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.2);
}

.location-visual {
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 120px;
    background: #f9f9f9;
    border-radius: 6px;
    border: 1px solid #eee;
    overflow: hidden;
}

.location-example-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.stone-mockup {
    position: relative;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #666 0%, #555 100%);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.stone-mockup.border-style {
    border: 3px solid #444;
    position: relative;
}

.artwork-zone {
    position: absolute;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #333;
}

.top-zone {
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 15px;
}

.side-zone {
    left: -5px;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 30px;
}

.text-zone {
    font-size: 8px;
    color: white;
    text-align: center;
    line-height: 1.2;
}

.border-decoration {
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 2px dashed rgba(255, 255, 255, 0.5);
    border-radius: 4px;
    pointer-events: none;
}

.artwork-location-card h4 {
    margin: 0 0 0.5rem 0;
    color: #333;
    font-size: 1.1rem;
    font-weight: 600;
}

.artwork-location-card p {
    margin: 0 0 0.5rem 0;
    color: #666;
    font-size: 0.9rem;
    line-height: 1.4;
}

.artwork-location-card small {
    color: #888;
    font-size: 0.8rem;
    font-style: italic;
}

.artwork-location-card.active h4 {
    color: #3498db;
}

/* New Artwork Browser Styles */
.new-artwork-browser {
    margin-top: 1rem;
    padding: 0 1rem;
    background: #f9f9f9;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.artwork-tabs {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.5rem 0;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.artwork-tabs::-webkit-scrollbar {
    height: 6px;
}

.artwork-tabs::-webkit-scrollbar-track {
    background: transparent;
}

.artwork-tabs::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.artwork-tab {
    flex-shrink: 0;
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background: white;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.artwork-tab.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.artwork-tab:hover {
    background: #f8f9fa;
    border-color: #bbb;
}

.artwork-location-selector {
    margin: 1rem 0;
    display: flex;
    align-items: center;
}

.artwork-location-selector label {
    margin-right: 0.5rem;
    font-weight: bold;
    color: #2c3e50;
}

.artwork-location-selector select {
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: white;
    font-size: 0.85rem;
    cursor: pointer;
}

.new-artwork-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
    padding-bottom: 1rem;
}

.artwork-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 0;
}

.loading-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Previous styles preserved below */

.artwork-item {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.artwork-item:hover {
    border-color: #3498db;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.artwork-item.selected {
    border-color: #27ae60;
    background: #f8fff8;
}

.artwork-image {
    width: 100%;
    height: 100px;
    object-fit: contain;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    background: #f9f9f9;
}

.artwork-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
}

.artwork-category {
    font-size: 0.8rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Selected Artwork Preview */
.selected-artwork-preview {
    border: 2px solid #27ae60;
    border-radius: 8px;
    padding: 1.5rem;
    background: #f8fff8;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.preview-artwork-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.preview-artwork-info h4 {
    margin: 0 0 0.5rem 0;
    color: #27ae60;
    font-size: 1.2rem;
}

.preview-artwork-info p {
    margin: 0 0 0.25rem 0;
    color: #666;
}

.preview-placement-indicator {
    background: #e8f5e8;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #2d5016;
    border-left: 3px solid #27ae60;
}

/* Category filter buttons */
.category-filter {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.category-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background: white;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-btn:hover {
    border-color: #3498db;
    background: #f8f9fa;
}

.category-btn.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

/* New Dynamic Artwork Selection Styles */

/* Category Cards */
.artwork-category-card {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.artwork-category-card:hover {
    border-color: #3498db;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.artwork-category-card.active {
    border-color: #3498db;
    background: #f8fafe;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.2);
}

.category-preview {
    position: relative;
    height: 150px;
    background: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.category-preview-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.category-overlay {
    position: absolute;
    top: 0;
    right: 0;
    background: rgba(52, 152, 219, 0.9);
    color: white;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    border-bottom-left-radius: 4px;
}

.category-info {
    padding: 1rem;
    text-align: center;
}

.category-info h4 {
    margin: 0 0 0.5rem 0;
    color: #333;
    font-size: 1rem;
    font-weight: 600;
}

.category-info p {
    margin: 0;
    color: #666;
    font-size: 0.85rem;
}

/* Back Button */
.artwork-back-button {
    grid-column: 1 / -1;
    padding: 0.75rem 1rem;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    transition: background 0.3s ease;
    text-align: center;
    display: inline-block;
    width: fit-content;
}

.artwork-back-button:hover {
    background: #5a6268;
}

/* Section Title */
.artwork-section-title {
    grid-column: 1 / -1;
    margin: 0 0 1rem 0;
    color: #333;
    font-size: 1.3rem;
    font-weight: 600;
    text-align: center;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #3498db;
}

/* Artwork Pieces Grid */
.artwork-pieces-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)) !important;
    gap: 0.5rem !important;
    margin-top: 1.5rem;
    padding: 0 !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    min-height: 400px !important;
    box-sizing: border-box !important;
    overflow: visible !important;
    grid-auto-rows: min-content !important;
    background: rgba(0, 255, 0, 0.1) !important; /* Debug background */
    border: 2px solid green !important; /* Debug border */
}

.artwork-piece-card {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.artwork-piece-card:hover {
    border-color: #3498db;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.artwork-piece-card.active {
    border-color: #27ae60;
    background: #f8fff8;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.2);
}

.artwork-image-container {
    position: relative;
    height: 120px;
    background: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 1px solid #eee;
}

.artwork-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.artwork-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.25rem 0.5rem;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.artwork-piece-card:hover .artwork-overlay {
    transform: translateY(0);
}

.artwork-id {
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
}

.artwork-info {
    padding: 0.75rem;
    text-align: center;
}

.artwork-info h5 {
    margin: 0 0 0.25rem 0;
    color: #333;
    font-size: 0.9rem;
    font-weight: 600;
}

.artwork-info p {
    margin: 0;
    color: #666;
    font-size: 0.8rem;
}

.image-error {
    padding: 1rem;
    color: #999;
    font-size: 0.8rem;
    text-align: center;
}

/* Selected Artwork Display */
.selected-artwork-display {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    border: 2px solid #27ae60;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.selected-artwork-image {
    flex-shrink: 0;
}

.selected-artwork-image img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    background: #f9f9f9;
}

.selected-artwork-info {
    flex: 1;
}

.selected-artwork-info h4 {
    margin: 0 0 0.75rem 0;
    color: #27ae60;
    font-size: 1.3rem;
    font-weight: 600;
}

.selected-artwork-info p {
    margin: 0 0 0.5rem 0;
    color: #666;
    font-size: 0.95rem;
}

.change-artwork-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 1rem;
    transition: background 0.3s ease;
}

.change-artwork-btn:hover {
    background: #2980b9;
}

.no-designs {
    grid-column: 1 / -1;
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 2rem;
}

/* Responsive design */
@media (max-width: 1200px) {
    .artwork-catalog-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 1.25rem;
    }
    
    .artwork-pieces-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1.25rem;
    }
}

@media (max-width: 900px) {
    .artwork-catalog-grid {
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
        gap: 1rem;
    }
    
    .artwork-pieces-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .artwork-location-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .artwork-location-card {
        padding: 1rem;
    }
    
    .location-visual {
        height: 80px;
    }
    
    .stone-mockup {
        width: 60px;
        height: 60px;
    }
    
    .artwork-catalog-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }
    
    .artwork-pieces-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 1rem;
    }
    
    .selected-artwork-preview,
    .selected-artwork-display {
        flex-direction: column;
        text-align: center;
    }
    
    .selected-artwork-image img {
        width: 100px;
        height: 100px;
    }
    
    .category-preview {
        height: 120px;
    }
    
    .artwork-image-container {
        height: 100px;
    }
}

/* Artwork Controls Styles */
.artwork-controls {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.control-group label {
    font-weight: 600;
    color: #2c3e50;
    min-width: 70px;
    font-size: 0.9em;
}

.artwork-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #e9ecef;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.artwork-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

.artwork-slider::-webkit-slider-thumb:hover {
    background: #2980b9;
    transform: scale(1.1);
}

.size-value, .padding-value {
    font-weight: 600;
    color: #2c3e50;
    min-width: 45px;
    text-align: right;
    font-size: 0.9em;
}

.artwork-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.change-artwork-btn, .remove-artwork-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.change-artwork-btn {
    background: #3498db;
    color: white;
}

.change-artwork-btn:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.remove-artwork-btn {
    background: #e74c3c;
    color: white;
}

.remove-artwork-btn:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

/* Artwork Layers Panel */
.artwork-layers-panel {
    background: #f8f9fa;
    border: 2px solid #3498db;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.artwork-layers-panel h4 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 1em;
    font-weight: 600;
}

.layers-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.layer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    transition: all 0.2s ease;
}

.layer-item:hover {
    border-color: #3498db;
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.1);
}

.layer-thumbnail {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    background: #f8f9fa;
}

.layer-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.layer-name {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9em;
}

.layer-location {
    font-size: 0.8em;
    color: #666;
    text-transform: capitalize;
}

.remove-layer-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.2s ease;
}

.remove-layer-btn:hover {
    background: #c0392b;
    transform: scale(1.1);
}
