      * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            padding: 20px;
        }

        .container {
            max-width: 1400px;
            margin: 0 auto;
        }

        .header {
            text-align: center;
            color: white;
            margin-bottom: 30px;
            animation: fadeIn 0.5s ease;
        }

        .header h1 {
            font-size: 2.5em;
            margin-bottom: 10px;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
        }

        .stats-bar {
            background: white;
            border-radius: 15px;
            padding: 20px;
            margin-bottom: 30px;
            display: flex;
            justify-content: space-around;
            box-shadow: 0 10px 30px rgba(0,0,0,0.2);
            animation: slideDown 0.6s ease;
            flex-wrap: wrap;
            gap: 10px;
        }

        .stat {
            text-align: center;
        }

        .stat-label {
            font-size: 0.9em;
            color: #666;
            margin-bottom: 5px;
        }

        .stat-value {
            font-size: 2em;
            font-weight: bold;
            transition: all 0.3s ease;
        }

        .weight-value {
            color: #4CAF50;
        }

        .weight-value.overweight {
            color: #f44336;
            animation: pulse 1s infinite;
        }

        .negative-margin {
            color: #f44336;
            font-weight: bold;
        }

        .build-progress {
            background: #f5f5f5;
            border-radius: 10px;
            padding: 15px;
            margin-bottom: 20px;
        }

        .progress-bar {
            background: #e0e0e0;
            border-radius: 10px;
            height: 8px;
            overflow: hidden;
            margin-bottom: 10px;
        }

        .progress-fill {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            height: 100%;
            width: 0%;
            transition: width 0.3s ease;
            border-radius: 10px;
        }

        .progress-fill.complete {
            background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
        }

        .build-actions {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
        }

        .export-btn {
            background: #2196F3;
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 1em;
            transition: all 0.3s ease;
            flex: 1;
            min-width: 140px;
        }

        .export-btn:hover {
            background: #1976D2;
            transform: translateY(-2px);
        }

        .library-controls {
            display: flex;
            gap: 10px;
            margin-bottom: 15px;
            flex-wrap: wrap;
        }

        .search-input, .category-filter {
            flex: 1;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 8px;
            font-size: 14px;
            min-width: 150px;
        }

        .search-input:focus, .category-filter:focus {
            outline: none;
            border-color: #667eea;
            box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
        }

        @keyframes pulse {
            0%, 100% { transform: scale(1); }
            50% { transform: scale(1.1); }
        }

        .main-content {
            display: grid;
            grid-template-columns: 1fr 2fr;
            gap: 30px;
        }

        .build-area {
            background: white;
            border-radius: 15px;
            padding: 25px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.2);
            min-height: 600px;
        }

        .build-area h2 {
            color: #333;
            margin-bottom: 20px;
            padding-bottom: 10px;
            border-bottom: 2px solid #667eea;
        }

        .build-list {
            background: #f8f9fa;
            border-radius: 10px;
            padding: 15px;
            margin-bottom: 20px;
        }

        .build-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 8px 12px;
            margin-bottom: 4px;
            background: white;
            border-radius: 6px;
            border-left: 4px solid #667eea;
            user-select: text;
            transition: all 0.2s ease;
            cursor: default;
        }

        .build-item:hover {
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            transform: translateX(2px);
        }

        .build-item:has(.component-name.selected) {
            cursor: pointer;
        }

        .build-item:has(.component-name.selected):hover {
            background: #ffebee;
            border-left-color: #f44336;
        }

        .build-item:last-child {
            margin-bottom: 0;
        }

        .component-type {
            font-weight: 600;
            color: #333;
            min-width: 140px;
            font-size: 14px;
        }

        .component-name {
            color: #666;
            font-size: 14px;
            text-align: right;
            flex: 1;
        }

        .component-name.selected {
            color: #4CAF50;
            font-weight: 500;
        }

        /* Provided by AIO distinct style */
        .component-name.provided-by-aio {
            color: #ff9800;
            font-weight: 600;
            font-style: italic;
        }

        /* Build item hover when provided by AIO */
        .build-item:has(.component-name.provided-by-aio):hover {
            background: #fff3e0;
            border-left-color: #ff9800;
        }

        .component-library {
            background: white;
            border-radius: 15px;
            padding: 25px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.2);
            max-height: 800px;
            overflow-y: auto;
            overflow-x: visible;
        }

        .component-library h2 {
            color: #333;
            margin-bottom: 20px;
            padding-bottom: 10px;
            border-bottom: 2px solid #764ba2;
        }

        .category {
            margin-bottom: 25px;
        }

        .category-title {
            font-weight: bold;
            color: #444;
            margin-bottom: 10px;
            padding: 5px;
            background: #f0f0f0;
            border-radius: 5px;
        }

        .component {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 8px 12px;
            margin-bottom: 6px;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 2px 6px rgba(0,0,0,0.2);
            position: relative;
            user-select: text;
            font-size: 14px;
            line-height: 1.3;
            z-index: 1;
        }

        .component:hover {
            transform: translateX(3px) scale(1.01);
            box-shadow: 0 3px 10px rgba(0,0,0,0.3);
            outline: none;
            z-index: 9999;
        }

        .component:focus {
            box-shadow: 0 3px 10px rgba(0,0,0,0.3), 0 0 0 2px rgba(255,255,255,0.3);
            z-index: 9999;
        }

        .component.selected {
            background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
            transform: translateX(3px) scale(1.02);
            box-shadow: 0 3px 12px rgba(76, 175, 80, 0.4);
            border: 1px solid #4CAF50;
        }

        .component-condensed {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-weight: 500;
        }

        .component-tooltip {
            position: absolute;
            top: 100%;
            left: 0;
            right: 0;
            background: rgba(0, 0, 0, 0.95);
            color: white;
            padding: 10px;
            border-radius: 6px;
            font-size: 12px;
            opacity: 0;
            visibility: hidden;
            transform: translateY(-5px);
            transition: all 0.3s ease;
            z-index: 99999;
            box-shadow: 0 4px 12px rgba(0,0,0,0.4);
            pointer-events: none;
            margin-top: 2px;
        }

        .component:hover .component-tooltip {
            opacity: 1;
            visibility: visible;
            transform: translateY(0);
        }

        .tooltip-specs {
            margin-bottom: 6px;
            line-height: 1.4;
        }

        .tooltip-price {
            font-weight: 600;
            color: #4CAF50;
        }

        .component-info {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .delete-custom-btn {
            background: #f44336;
            color: white;
            border: none;
            border-radius: 4px;
            padding: 2px 6px;
            cursor: pointer;
            font-size: 11px;
            margin-left: 8px;
            transition: background 0.3s ease;
            flex-shrink: 0;
        }

        .delete-custom-btn:hover {
            background: #d32f2f;
        }

        .placed-component {
            position: relative;
            animation: dropIn 0.3s ease;
            user-select: text;
        }

        .placed-component .component-condensed {
            padding-right: 35px; /* Make room for remove button */
        }

        @keyframes dropIn {
            from {
                transform: translateY(-20px);
                opacity: 0;
            }
            to {
                transform: translateY(0);
                opacity: 1;
            }
        }

        .remove-btn {
            position: absolute;
            top: 5px;
            right: 5px;
            background: #f44336;
            color: white;
            border: none;
            border-radius: 50%;
            width: 25px;
            height: 25px;
            cursor: pointer;
            font-size: 16px;
            line-height: 1;
            transition: all 0.3s ease;
        }

        .remove-btn:hover {
            background: #d32f2f;
            transform: scale(1.1);
        }

        .presets {
            background: white;
            border-radius: 15px;
            padding: 20px;
            margin-bottom: 30px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.2);
        }

        .preset-buttons {
            display: flex;
            gap: 15px;
            flex-wrap: wrap;
        }

        .preset-btn {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 1em;
            transition: all 0.3s ease;
        }

        .preset-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(0,0,0,0.3);
        }

        .clear-btn {
            background: #f44336;
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 1em;
            transition: all 0.3s ease;
            flex: 1;
            min-width: 140px;
        }

        .clear-btn:hover {
            background: #d32f2f;
            transform: translateY(-2px);
        }

        .custom-component-form h4 {
            margin-bottom: 15px;
            color: #333;
        }

        .form-actions {
            display: flex;
            gap: 10px;
            margin-top: 15px;
        }

        .toast {
            position: fixed;
            top: 20px;
            right: 20px;
            background: #333;
            color: white;
            padding: 12px 20px;
            border-radius: 8px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.3);
            transform: translateX(400px);
            transition: transform 0.3s ease;
            z-index: 1000;
            max-width: 300px;
        }

        .toast.show {
            transform: translateX(0);
        }

        .toast.success {
            background: #4CAF50;
        }

        .toast.error {
            background: #f44336;
        }

        .toast.warning {
            background: #ff9800;
        }

        .toast.info {
            background: #2196F3;
        }

        .loading-indicator {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: white;
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0 4px 20px rgba(0,0,0,0.3);
            display: none;
            align-items: center;
            gap: 15px;
            z-index: 1001;
        }

        .spinner {
            width: 20px;
            height: 20px;
            border: 2px solid #f3f3f3;
            border-top: 2px solid #667eea;
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }

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

        /* Responsive design improvements */
        @media (max-width: 768px) {
            .main-content {
                grid-template-columns: 1fr;
            }

            .stats-bar {
                flex-direction: column;
                align-items: center;
                gap: 15px;
            }

            .preset-buttons {
                flex-direction: column;
            }

            .library-controls {
                flex-direction: column;
            }

            .build-actions {
                flex-direction: column;
            }
        }

        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }

        @keyframes slideDown {
            from {
                transform: translateY(-20px);
                opacity: 0;
            }
            to {
                transform: translateY(0);
                opacity: 1;
            }
        }

        .custom-component-form {
            display: none;
            background: #f9f9f9;
            padding: 15px;
            border-radius: 8px;
            margin-top: 20px;
        }

        .custom-component-form.active {
            display: block;
        }

        .form-group {
            margin-bottom: 10px;
        }

        .form-group label {
            display: block;
            margin-bottom: 5px;
            color: #666;
        }

        .form-group input, .form-group select {
            width: 100%;
            padding: 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
        }

        .add-custom-btn {
            background: #4CAF50;
            color: white;
            border: none;
            padding: 8px 15px;
            border-radius: 5px;
            cursor: pointer;
            margin-right: 10px;
        }

        .cancel-custom-btn {
            background: #666;
            color: white;
            border: none;
            padding: 8px 15px;
            border-radius: 5px;
            cursor: pointer;
        }

        .toggle-custom-btn {
            background: #2196F3;
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 8px;
            cursor: pointer;
            margin-bottom: 15px;
            width: 100%;
        }

        ::-webkit-scrollbar {
            width: 10px;
        }

        ::-webkit-scrollbar-track {
            background: #f1f1f1;
            border-radius: 10px;
        }

        ::-webkit-scrollbar-thumb {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 10px;
        }
