def _extract_rules(self, css: str) -> list[str]:
        """Extract selectors and their declarations from CSS content."""
        # Remove comments to simplify parsing
        css_without_comments = re.sub(r"/\*.*?\*/", "", css, flags=re.DOTALL)

        # Pattern to match CSS rules
        rule_pattern = r"([^{]+)\{([^}]*)\}"
        matches = re.findall(rule_pattern, css_without_comments)

        rules = []
        for selector, declarations in matches:
            selector = selector.strip()
            if not selector:
                continue

            rules.append(f"Selector: {selector}")

            # Process declarations
            declaration_list = declarations.strip().split(";")
            for declaration in declaration_list:
                declaration = declaration.strip()
                if declaration:
                    property_value = declaration.split(":", 1)
                    if len(property_value) == 2:
                        property_name = property_value[0].strip()
                        value = property_value[1].strip()
                        rules.append(f"  {property_name}: {value}")

            rules.append("")  # Empty line for readability

        return rules
Extract selectors and their declarations from CSS content.
py/core/parsers/text/css_parser.py