/* Shed Designer Styles */

/* Main Container */
#shed-designer-app {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.designer-header {
    text-align: center;
    margin-bottom: 3rem;
}

.designer-header h2 {
    font-size: 2.5rem;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.designer-header p {
    font-size: 1.125rem;
    color: #6b7280;
}

/* Main Designer Layout */
.designer-container {
    display: grid;
    grid-template-columns: 300px 1fr 320px;
    gap: 2rem;
    margin-bottom: 4rem;
}

/* Controls Panel */
.designer-controls {
    background: #f9fafb;
    border-radius: 12px;
    padding: 1.5rem;
    max-height: 80vh;
    overflow-y: auto;
}

.control-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #e5e7eb;
}

.control-section:last-child {
    border-bottom: none;
}

.control-section h3 {
    font-size: 1.125rem;
    color: #1f2937;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Units Selector */
.units-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.units-option {
    padding: 0.75rem;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    font-size: 0.875rem;
}

.units-option:hover {
    border-color: #3730a3;
    transform: translateY(-1px);
}

.units-option.active {
    background: #3730a3;
    color: white;
    border-color: #3730a3;
}

/* Display Options */
.display-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toggle-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-option:hover {
    background: #f9fafb;
}

.toggle-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Foundation Selector */
.foundation-selector {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.foundation-option {
    padding: 0.75rem;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    font-size: 0.875rem;
}

.foundation-option:hover {
    border-color: #3730a3;
    transform: translateX(4px);
}

.foundation-option.active {
    background: #3730a3;
    color: white;
    border-color: #3730a3;
}

/* Size Selector */
.size-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.size-option {
    padding: 0.75rem;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.size-option:hover {
    border-color: #3730a3;
    transform: translateY(-1px);
}

.size-option.active {
    background: #3730a3;
    color: white;
    border-color: #3730a3;
}

#custom-size-inputs {
    margin-top: 1rem;
    display: grid;
    gap: 0.75rem;
}

#custom-size-inputs label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

#custom-size-inputs input {
    width: 80px;
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
}

/* Material Selector */
.material-selector {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.material-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.material-option:hover {
    border-color: #3730a3;
    transform: translateX(4px);
}

.material-option.active {
    border-color: #3730a3;
    box-shadow: 0 4px 6px rgba(55, 48, 163, 0.1);
}

.material-swatch {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.material-info {
    flex: 1;
}

.material-info strong {
    display: block;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

.material-info small {
    color: #6b7280;
    font-size: 0.75rem;
}

.material-price {
    font-weight: 600;
    color: #059669;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Roof Selector */
.roof-selector {
    display: flex;
    gap: 0.5rem;
}

.roof-option {
    flex: 1;
    padding: 0.75rem;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.roof-option:hover {
    border-color: #3730a3;
}

.roof-option.active {
    background: #3730a3;
    color: white;
    border-color: #3730a3;
}

/* Features List */
.features-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.feature-item:hover {
    background: #f3f4f6;
}

.feature-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.feature-icon {
    font-size: 1.25rem;
}

.feature-name {
    flex: 1;
    font-weight: 500;
    color: #1f2937;
}

.feature-price {
    font-size: 0.875rem;
    color: #059669;
    font-weight: 600;
}

/* 3D Viewport */
.designer-viewport {
    background: #f3f4f6;
    border-radius: 12px;
    padding: 1rem;
    position: relative;
}

.viewport-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.viewport-controls button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: white;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    transition: all 0.2s;
}

.viewport-controls button:hover {
    background: #3730a3;
    color: white;
    transform: scale(1.1);
}

#shed-3d-container {
    height: 500px;
    position: relative;
    perspective: 1000px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* CAD-Style Grid System */
#shed-3d-container.show-grid::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 480px;
    height: 480px;
    transform: translate(-50%, -50%);
    background-image: 
        linear-gradient(rgba(55, 48, 163, 0.15) 1px, transparent 1px),
        linear-gradient(90deg, rgba(55, 48, 163, 0.15) 1px, transparent 1px),
        linear-gradient(rgba(55, 48, 163, 0.4) 2px, transparent 2px),
        linear-gradient(90deg, rgba(55, 48, 163, 0.4) 2px, transparent 2px);
    background-size: 24px 24px, 24px 24px, 72px 72px, 72px 72px;
    background-position: center, center, center, center;
    z-index: 1;
    pointer-events: none;
    border: 2px solid rgba(55, 48, 163, 0.5);
    border-radius: 4px;
}

/* CAD Axis Lines */
#shed-3d-container.show-grid .cad-axes {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 480px;
    height: 480px;
    transform: translate(-50%, -50%);
    z-index: 5;
    pointer-events: none;
}

#shed-3d-container.show-grid .cad-axes::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, 
        rgba(255, 48, 48, 0.8) 0%, 
        rgba(255, 48, 48, 0.6) 240px, 
        transparent 250px);
    z-index: 6;
}

#shed-3d-container.show-grid .cad-axes::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    height: 100%;
    width: 2px;
    background: linear-gradient(180deg, 
        rgba(48, 255, 48, 0.8) 0%, 
        rgba(48, 255, 48, 0.6) 240px, 
        transparent 250px);
    z-index: 6;
}

/* Axis Labels */
#shed-3d-container.show-grid .axis-labels {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 7;
    pointer-events: none;
}

#shed-3d-container.show-grid .axis-label {
    position: absolute;
    background: rgba(255, 255, 255, 0.95);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    color: #1f2937;
    border: 1px solid rgba(55, 48, 163, 0.3);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#shed-3d-container.show-grid .axis-label.x-axis {
    color: #dc2626;
    border-color: rgba(220, 38, 38, 0.3);
}

#shed-3d-container.show-grid .axis-label.y-axis {
    color: #16a34a;
    border-color: rgba(22, 163, 74, 0.3);
}

#shed-3d-container.show-grid .axis-label.z-axis {
    color: #2563eb;
    border-color: rgba(37, 99, 235, 0.3);
}

#shed-3d-container.show-grid .origin-marker {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    background: #3730a3;
    border: 2px solid white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 8;
    box-shadow: 0 0 0 1px rgba(55, 48, 163, 0.3);
}

/* Grid measurement labels */
#shed-3d-container.show-grid .grid-labels {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    pointer-events: none;
}

#shed-3d-container.show-grid .grid-label {
    position: absolute;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    color: #3730a3;
    border: 1px solid rgba(55, 48, 163, 0.3);
}

#shed-3d-model {
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
    width: 300px;
    height: 200px;
}

/* Basic 3D Shed Structure */
.shed-base {
    position: absolute;
    width: 100%;
    height: 20px;
    background: #8B4513;
    bottom: 0;
    transform: rotateX(90deg) translateZ(-10px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.shed-walls {
    position: absolute;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}

.wall {
    position: absolute;
    background: #D2691E;
    border: 2px solid #8B4513;
    opacity: 0.9;
}

.wall-front {
    width: 100%;
    height: 100%;
    transform: translateZ(150px);
}

.wall-back {
    width: 100%;
    height: 100%;
    transform: translateZ(-150px) rotateY(180deg);
}

.wall-left {
    width: 300px;
    height: 100%;
    left: -150px;
    transform: rotateY(-90deg);
}

.wall-right {
    width: 300px;
    height: 100%;
    right: -150px;
    transform: rotateY(90deg);
}

.shed-roof {
    position: absolute;
    width: 110%;
    height: 50px;
    background: linear-gradient(to bottom, #8B0000, #661111);
    top: 0;
    left: -5%;
    transform: rotateX(20deg) translateY(-100%);
    transform-origin: center bottom;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    border: 2px solid #4d0000;
    clip-path: polygon(0 100%, 50% 0%, 100% 100%);
}

.shed-roof.pent {
    transform: rotateX(10deg) translateY(-100%);
    height: 40px;
    clip-path: polygon(0 50%, 0 100%, 100% 100%, 100% 0%);
}

.shed-roof.flat {
    transform: translateY(-100%);
    height: 25px;
    clip-path: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* View Mode Selector */
.view-mode-selector {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.view-mode {
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.view-mode:hover {
    background: #f3f4f6;
}

.view-mode.active {
    background: #3730a3;
    color: white;
    border-color: #3730a3;
}

/* Summary Panel */
.designer-summary {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.designer-summary h3 {
    font-size: 1.25rem;
    color: #1f2937;
    margin-bottom: 1rem;
}

.cost-breakdown {
    background: #f9fafb;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.cost-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 0.875rem;
    color: #6b7280;
}

.cost-total {
    display: flex;
    justify-content: space-between;
    padding: 1rem 0 0;
    border-top: 2px solid #e5e7eb;
    font-size: 1.125rem;
    font-weight: 700;
    color: #1f2937;
}

#total-cost {
    color: #059669;
}

.shed-stats {
    margin-bottom: 1.5rem;
}

.shed-stats h4 {
    font-size: 1rem;
    color: #1f2937;
    margin-bottom: 0.75rem;
}

.shed-stats ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.shed-stats li {
    padding: 0.5rem 0;
    font-size: 0.875rem;
    color: #6b7280;
    display: flex;
    justify-content: space-between;
}

.shed-stats span {
    font-weight: 600;
    color: #1f2937;
}

/* Selected Features Display */
.selected-features-display {
    background: #f3f4f6;
    border-radius: 8px;
    padding: 12px;
    margin: 1rem 0;
    font-size: 14px;
}

.selected-features-display h4 {
    font-size: 12px;
    text-transform: uppercase;
    color: #6b7280;
    margin-bottom: 8px;
    font-weight: 600;
}

.selected-features-display .features-list-display {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.selected-features-display .features-list-display li {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 4px 10px;
    font-size: 12px;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 4px;
}

.selected-features-display .features-list-display li .icon {
    font-size: 14px;
}

/* Action Buttons */
.designer-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.action-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    font-size: 0.875rem;
}

.action-btn.primary {
    background: #3730a3;
    color: white;
}

.action-btn.primary:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(55, 48, 163, 0.2);
}

.action-btn.secondary {
    background: white;
    color: #3730a3;
    border: 2px solid #3730a3;
}

.action-btn.secondary:hover {
    background: #3730a3;
    color: white;
}

.action-btn.highlight {
    background: #059669;
    color: white;
}

.action-btn.highlight:hover {
    background: #047857;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.2);
}

.action-btn.amazon {
    background: #ff9900;
    color: white;
}

.action-btn.amazon:hover {
    background: #ff6600;
    transform: translateY(-2px);
}

/* Materials List */
.materials-list {
    background: #f9fafb;
    border-radius: 8px;
    padding: 1rem;
}

.materials-list h4 {
    font-size: 1rem;
    color: #1f2937;
    margin-bottom: 0.75rem;
}

#materials-needed {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 1rem;
    max-height: 150px;
    overflow-y: auto;
}

.material-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e5e7eb;
}

/* Design Gallery */
.design-gallery {
    background: #f9fafb;
    border-radius: 12px;
    padding: 2rem;
}

.design-gallery h3 {
    font-size: 1.5rem;
    color: #1f2937;
    margin-bottom: 1.5rem;
    text-align: center;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.gallery-item {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

.gallery-image {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.gallery-item h4 {
    font-size: 1.125rem;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.gallery-item p {
    font-size: 0.875rem;
    color: #6b7280;
}

/* Modal */
.designer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
}

.modal-content h3 {
    font-size: 1.5rem;
    color: #1f2937;
    margin-bottom: 1rem;
}

.modal-content p {
    color: #6b7280;
    margin-bottom: 1.5rem;
}

#share-url {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

#copy-link, #close-modal {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 0.5rem;
}

#copy-link {
    background: #3730a3;
    color: white;
}

#copy-link:hover {
    background: #1d4ed8;
}

#close-modal {
    background: #e5e7eb;
    color: #6b7280;
}

#close-modal:hover {
    background: #d1d5db;
}

/* Mobile Responsive */
@media (max-width: 1200px) {
    .designer-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .designer-controls {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1rem;
        max-height: none;
    }
    
    .control-section {
        border-bottom: none;
        padding-bottom: 0;
    }
    
    #shed-3d-container {
        height: 400px;
    }
}

@media (max-width: 768px) {
    #shed-designer-app {
        padding: 1rem;
    }
    
    .designer-header h2 {
        font-size: 2rem;
    }
    
    .designer-controls {
        grid-template-columns: 1fr;
    }
    
    .size-selector {
        grid-template-columns: 1fr;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    #shed-3d-container {
        height: 300px;
    }
    
    #shed-3d-model {
        width: 200px;
        height: 150px;
    }
}

/* Loading State */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f4f6;
    border-radius: 50%;
    border-top-color: #3730a3;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.designer-container > * {
    animation: slideIn 0.5s ease-out;
}

/* Print Styles */
@media print {
    .designer-controls,
    .viewport-controls,
    .view-mode-selector,
    .designer-actions,
    .design-gallery {
        display: none;
    }
    
    .designer-container {
        grid-template-columns: 1fr;
    }
    
    .designer-summary {
        box-shadow: none;
        border: 1px solid #000;
    }
}