/* Hydroponic Setup Designer - Frontend Styles */

.hsd-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
}

.hsd-header {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.hsd-header h2 {
    margin: 0 0 10px 0;
    font-size: 28px;
    font-weight: 700;
}

.hsd-header p {
    margin: 0;
    font-size: 16px;
    opacity: 0.95;
}

/* Designer Interface */
.hsd-designer {
    display: grid;
    grid-template-columns: 300px 1fr 300px;
    grid-template-rows: 60px 1fr 200px;
    gap: 15px;
    height: 80vh;
    min-height: 600px;
}

/* Toolbar */
.hsd-toolbar {
    grid-column: 1 / -1;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 20px;
}

.hsd-toolbar-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hsd-toolbar-group:not(:last-child) {
    border-right: 1px solid #e2e8f0;
    padding-right: 20px;
}

.hsd-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.hsd-btn-primary {
    background: #3498db;
    color: white;
}

.hsd-btn-primary:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.hsd-btn-secondary {
    background: #ecf0f1;
    color: #2c3e50;
}

.hsd-btn-secondary:hover {
    background: #bdc3c7;
}

.hsd-btn-success {
    background: #27ae60;
    color: white;
}

.hsd-btn-success:hover {
    background: #229954;
}

.hsd-btn-danger {
    background: #e74c3c;
    color: white;
}

.hsd-btn-danger:hover {
    background: #c0392b;
}

/* Component Library */
.hsd-component-library {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.hsd-library-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.hsd-library-header h3 {
    margin: 0;
    font-size: 16px;
    color: #2c3e50;
}

.hsd-library-search {
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
}

.hsd-library-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.hsd-library-categories {
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
}

.hsd-category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.hsd-category-tab {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.hsd-category-tab.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.hsd-library-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.hsd-component-item {
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-bottom: 10px;
    cursor: grab;
    transition: all 0.3s ease;
    background: white;
}

.hsd-component-item:hover {
    border-color: #3498db;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2);
    transform: translateY(-1px);
}

.hsd-component-item:active {
    cursor: grabbing;
}

.hsd-component-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
    font-size: 14px;
}

.hsd-component-price {
    color: #27ae60;
    font-weight: 500;
    font-size: 13px;
}

.hsd-component-category {
    color: #7f8c8d;
    font-size: 11px;
    text-transform: uppercase;
    margin-top: 4px;
}

/* Design Canvas */
.hsd-canvas-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

.hsd-canvas-toolbar {
    padding: 10px 15px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8f9fa;
}

.hsd-view-toggle {
    display: flex;
    background: #ecf0f1;
    border-radius: 4px;
    overflow: hidden;
}

.hsd-view-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.hsd-view-btn.active {
    background: #3498db;
    color: white;
}

.hsd-canvas {
    width: 100%;
    height: calc(100% - 50px);
    position: relative;
    background: 
        radial-gradient(circle at 25% 25%, rgba(52, 152, 219, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(39, 174, 96, 0.1) 0%, transparent 50%),
        linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.hsd-canvas-2d {
    width: 100%;
    height: 100%;
    position: relative;
}

.hsd-canvas-3d {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    display: none;
}

.hsd-canvas-3d.active {
    display: block;
}

/* Component on Canvas */
.hsd-canvas-component {
    position: absolute;
    border: 2px solid #3498db;
    border-radius: 4px;
    background: rgba(52, 152, 219, 0.1);
    cursor: move;
    transition: all 0.3s ease;
    min-width: 80px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 500;
    color: #2c3e50;
}

.hsd-canvas-component:hover {
    border-color: #2980b9;
    background: rgba(52, 152, 219, 0.2);
}

.hsd-canvas-component.selected {
    border-color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.2);
}

.hsd-canvas-component .component-name {
    text-align: center;
    word-break: break-word;
    padding: 4px;
}

/* 3D Controls */
.hsd-3d-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: none;
}

.hsd-3d-controls.active {
    display: block;
}

.hsd-3d-control {
    margin: 5px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hsd-3d-control label {
    font-size: 12px;
    color: #2c3e50;
    min-width: 60px;
}

.hsd-3d-control input {
    width: 60px;
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 11px;
}

/* Properties Panel */
.hsd-properties-panel {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.hsd-properties-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.hsd-properties-header h3 {
    margin: 0;
    font-size: 16px;
    color: #2c3e50;
}

.hsd-properties-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.hsd-property-group {
    margin-bottom: 20px;
}

.hsd-property-group h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #2c3e50;
    font-weight: 600;
}

.hsd-property {
    margin-bottom: 12px;
}

.hsd-property label {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    color: #7f8c8d;
    font-weight: 500;
}

.hsd-property input,
.hsd-property select,
.hsd-property textarea {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

.hsd-property textarea {
    resize: vertical;
    min-height: 60px;
}

/* Cost Calculator */
.hsd-cost-calculator {
    grid-column: 1 / -1;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.hsd-cost-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hsd-cost-header h3 {
    margin: 0;
    font-size: 16px;
    color: #2c3e50;
}

.hsd-total-cost {
    font-size: 24px;
    font-weight: 700;
    color: #27ae60;
}

.hsd-cost-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.hsd-cost-breakdown {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.hsd-cost-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.hsd-cost-table th,
.hsd-cost-table td {
    border: 1px solid #e2e8f0;
    padding: 8px 12px;
    text-align: left;
    font-size: 13px;
}

.hsd-cost-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

.hsd-cost-chart {
    height: 200px;
    background: #f8f9fa;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7f8c8d;
    font-size: 14px;
}

/* System Validation */
.hsd-validation {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-top: 15px;
}

.hsd-validation-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.hsd-validation-header h3 {
    margin: 0;
    font-size: 16px;
    color: #2c3e50;
}

.hsd-validation-content {
    padding: 20px;
}

.hsd-validation-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 4px;
}

.hsd-validation-item.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.hsd-validation-item.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.hsd-validation-item.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.hsd-validation-icon {
    font-size: 16px;
}

/* Loading States */
.hsd-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #7f8c8d;
}

.hsd-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

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

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

.hsd-modal.active {
    display: flex;
}

.hsd-modal-content {
    background: white;
    border-radius: 8px;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.hsd-modal-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hsd-modal-header h3 {
    margin: 0;
    color: #2c3e50;
}

.hsd-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #7f8c8d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hsd-modal-close:hover {
    color: #2c3e50;
}

.hsd-modal-body {
    padding: 20px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .hsd-designer {
        grid-template-columns: 250px 1fr 250px;
    }
}

@media (max-width: 992px) {
    .hsd-designer {
        grid-template-columns: 1fr;
        grid-template-rows: 60px 300px 1fr 200px;
        height: auto;
        min-height: 800px;
    }
    
    .hsd-component-library {
        grid-row: 2;
    }
    
    .hsd-canvas-container {
        grid-row: 3;
    }
    
    .hsd-properties-panel {
        grid-row: 4;
        grid-column: 1;
    }
    
    .hsd-cost-calculator {
        grid-row: 5;
        grid-column: 1;
    }
}

@media (max-width: 768px) {
    .hsd-container {
        padding: 10px;
    }
    
    .hsd-designer {
        grid-template-rows: 60px 250px 1fr 200px;
        gap: 10px;
    }
    
    .hsd-toolbar {
        flex-wrap: wrap;
        padding: 10px;
        gap: 10px;
    }
    
    .hsd-toolbar-group {
        border-right: none;
        padding-right: 0;
        margin-bottom: 5px;
    }
    
    .hsd-cost-breakdown {
        grid-template-columns: 1fr;
    }
}

/* Print Styles */
@media print {
    .hsd-toolbar,
    .hsd-component-library,
    .hsd-properties-panel,
    .hsd-3d-controls {
        display: none !important;
    }
    
    .hsd-designer {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
    }
    
    .hsd-canvas-container {
        grid-row: 1;
        grid-column: 1;
    }
}

/* Accessibility */
.hsd-btn:focus,
.hsd-canvas-component:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

.hsd-component-item:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Animation for new components */
@keyframes componentDrop {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.hsd-canvas-component.new {
    animation: componentDrop 0.3s ease-out;
}

/* Drag and drop indicators */
.hsd-drop-zone {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px dashed #3498db;
    border-radius: 8px;
    background: rgba(52, 152, 219, 0.1);
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #3498db;
    font-weight: 600;
}

.hsd-drop-zone.active {
    display: flex;
}

/* Grid overlay for alignment */
.hsd-canvas-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0,0,0,0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    opacity: 0.3;
}

.hsd-canvas-grid.active {
    opacity: 0.6;
}
